Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Serde Json Wasm issue #16

Merged
merged 10 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ All notable changes to this project will be documented in this file.

-

## [Version v1.1.0] - 2024-02-24
## [1.0.2] - 2024-03-19

### Fixed

- Bump version of `serde-json-wasm`

## [1.0.1] - 2024-02-24

### Added

- This Changelog file
- `rust-toolchain` file
- Contract migration templates and migrate function

### Changed

-

### Fixed

- Correctly round to `min_quantity_tick_size` in intermediate steps for multi-hop buys
Expand All @@ -41,7 +43,3 @@ All notable changes to this project will be documented in this file.
### Changed

- Updated to latest CosmWasm version

### Fixed

-
4 changes: 2 additions & 2 deletions contracts/swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = [ "Markus Waas <markus@injectivelabs.org>" ]
edition = "2021"
name = "swap-contract"
version = "1.0.1"
version = "1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version changed, check migration constrains to check if still make sense.


exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
Expand Down Expand Up @@ -41,7 +41,7 @@ num-traits = "0.2.15"
protobuf = { version = "2", features = [ "with-bytes" ] }
schemars = "0.8.8"
serde = { version = "1.0.137", default-features = false, features = [ "derive" ] }
serde-json-wasm = "0.5.1"
serde-json-wasm = "1.0.1"
thiserror = { version = "1.0.31" }

[dev-dependencies]
Expand Down
70 changes: 70 additions & 0 deletions contracts/swap/msg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
use cosmwasm_std::{Addr, Coin};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use injective_cosmwasm::MarketId;
use injective_math::FPDecimal;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum FeeRecipient {
Address(Addr),
SwapContract,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InstantiateMsg {
pub fee_recipient: FeeRecipient,
pub admin: Addr,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
SwapMinOutput {
target_denom: String,
min_output_quantity: FPDecimal,
},
SwapExactOutput {
target_denom: String,
target_output_quantity: FPDecimal,
},
SetRoute {
source_denom: String,
target_denom: String,
route: Vec<MarketId>,
},
DeleteRoute {
source_denom: String,
target_denom: String,
},
UpdateConfig {
admin: Option<Addr>,
fee_recipient: Option<FeeRecipient>,
},
WithdrawSupportFunds {
coins: Vec<Coin>,
target_address: Addr,
},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
GetRoute {
source_denom: String,
target_denom: String,
},
GetOutputQuantity {
from_quantity: FPDecimal,
source_denom: String,
target_denom: String,
},
GetInputQuantity {
to_quantity: FPDecimal,
source_denom: String,
target_denom: String,
},
GetAllRoutes {},
GetConfig {},
}
Loading
Loading