Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/fix_estimateXX
Browse files Browse the repository at this point in the history
  • Loading branch information
jcompagni10 committed Jul 25, 2024
2 parents 2a68d5e + 6e7e83d commit 76c4b85
Show file tree
Hide file tree
Showing 51 changed files with 579 additions and 352 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.11.0

### Improvements
* Rust 1.78;
* Cosmwasm optimizer 0.16;
* [CosmWasm STD is upgraded to v2.0](https://github.com/neutron-org/neutron-sdk/pull/147);
* ICQ balances query is [improved](https://github.com/neutron-org/neutron-sdk/pull/130) to support a list of denoms to query balances of;

### Added
* [Proto types generation](https://github.com/neutron-org/neutron-sdk/pull/125); for Stargate queries and messages;
* [ICQ for proposal voters](https://github.com/neutron-org/neutron-sdk/pull/129);
* `MsgRegisterInterchainAccountResponse` binding response [is added](https://github.com/neutron-org/neutron-sdk/pull/138), so now contracts are able to catch `channel_id` and `port_id` directly in a reply handler of `MsgRegisterInterchainAccount`;
* [Bindings](https://github.com/neutron-org/neutron-sdk/pull/141) for Slinky Oracle and MarketMap;
* `limit_sell_price` [is added](https://github.com/neutron-org/neutron-sdk/pull/143) to `PlaceLimitOrder` DEX message;

## 0.10.0

Bindings for [Neutron Dex module](https://docs.neutron.org/neutron/modules/dex/overview/) is added.
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ incremental = false
overflow-checks = true

[workspace.dependencies]
cosmwasm-std = "1.4.0"
cw2 = "1.1.1"
cosmwasm-std = "2.0.4"
cw2 = "2.0.0"
schemars = "0.8.15"
serde = { version = "1.0.188", default-features = false }
serde-json-wasm = "1.0.0"
cw-storage-plus = "1.1.0"
cosmwasm-schema = { version = "1.4.0", default-features = false }
base64 = "0.21.4"
cw-storage-plus = "2.0.0"
cosmwasm-schema = { version = "2.0.4", default-features = false }
base64 = "0.21.7"
prost = "0.12.3"
prost-types = "0.12.1"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
bech32 = "0.9.1"
thiserror = "1.0.49"
protobuf = { version = "3.3.0" }
protobuf = "~3.3.0"
hex = "0.4.3"
serde_json = { version = "1.0.87" }
tendermint-proto = "0.34"
tendermint-proto = "0.34.1"
speedate = "0.13.0"
14 changes: 13 additions & 1 deletion MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ This guide explains what is needed to upgrade contracts when migrating over rele
also view the
[complete CHANGELOG](./CHANGELOG.md) to understand the differences.

## 0.10.0 -> 0.11.0

* Update`neutron-sdk`dependencies in Cargo.toml:

```
[dependencies]
neutron-sdk = "0.11.0"
# ...
```

* Follow [CosmWasm MIGRATING.md instructions ](https://github.com/CosmWasm/cosmwasm/blob/main/MIGRATING.md#15x---20x) to update to v2.0 version of `cosmwasm-std`

## 0.9.0 -> 0.10.0

* Update`neutron-sdk`dependencies in Cargo.toml:
Expand Down Expand Up @@ -45,4 +57,4 @@ neutron-sdk = "0.9.0"
```diff
-use neutron_sdk::interchain_txs::helpers::decode_acknowledgement_response;
+use neutron_sdk::interchain_txs::v047::helpers::decode_acknowledgement_response;
```
```
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ compile:
--mount type=volume,source="$(notdir $(CURDIR))_cache",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
--platform linux/amd64 \
cosmwasm/workspace-optimizer:0.15.0
cosmwasm/workspace-optimizer:0.16.0

check_contracts:
@cargo install cosmwasm-check
Expand All @@ -30,4 +30,4 @@ check_contracts:
build: schema clippy test fmt doc compile check_contracts

build-proto:
@cargo run --bin proto-build $(revision)
@cargo run --bin proto-build $(revision)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We provide sample contracts that either implement or consume these specification

### Environment Setup

- Rust v1.73.0+
- Rust v1.78.0+
- `wasm32-unknown-unknown` target
- Docker

Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc_transfer/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib --features backtraces"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --bin ibc_transfer_schema"
2 changes: 0 additions & 2 deletions contracts/ibc_transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ crate-type = ["cdylib", "rlib"]

[features]
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
Expand Down
3 changes: 2 additions & 1 deletion contracts/ibc_transfer/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"to": {
"type": "string"
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down
3 changes: 2 additions & 1 deletion contracts/ibc_transfer/schema/instantiate_msg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object"
"type": "object",
"additionalProperties": false
}
18 changes: 11 additions & 7 deletions contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use cosmwasm_std::{
coin, entry_point, from_json, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply,
Response, StdError, StdResult, SubMsg,
coin, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response,
StdError, StdResult, SubMsg,
};
use cw2::set_contract_version;
use neutron_sdk::interchain_txs::helpers::decode_message_response;
use neutron_sdk::proto_types::neutron::transfer::MsgTransferResponse;
use neutron_sdk::{
bindings::{
msg::{IbcFee, MsgIbcTransferResponse, NeutronMsg},
msg::{IbcFee, NeutronMsg},
query::NeutronQuery,
},
query::min_ibc_fee::query_min_ibc_fee,
Expand Down Expand Up @@ -112,12 +114,14 @@ fn msg_with_sudo_callback<C: Into<CosmosMsg<T>>, T>(
// and process this payload when an acknowledgement for the SubmitTx message is received in Sudo handler
fn prepare_sudo_payload(mut deps: DepsMut, _env: Env, msg: Reply) -> StdResult<Response> {
let payload = read_reply_payload(deps.storage, msg.id)?;
let resp: MsgIbcTransferResponse = from_json(
msg.result
let resp: MsgTransferResponse = decode_message_response(
&msg.result
.into_result()
.map_err(StdError::generic_err)?
.data
.ok_or_else(|| StdError::generic_err("no result"))?,
.msg_responses[0] // msg_responses must have exactly one Msg response: https://github.com/neutron-org/neutron/blob/28b1d2ce968aaf1866e92d5286487f079eba3370/wasmbinding/message_plugin.go#L307
.clone()
.value
.to_vec(),
)
.map_err(|e| StdError::generic_err(format!("failed to parse response: {:?}", e)))?;
let seq_id = resp.sequence_id;
Expand Down
4 changes: 2 additions & 2 deletions contracts/ibc_transfer/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn save_reply_payload(store: &mut dyn Storage, payload: SudoPayload) -> StdR

pub fn read_reply_payload(store: &dyn Storage, id: u64) -> StdResult<SudoPayload> {
let data = REPLY_QUEUE_ID.load(store, id)?;
from_json(Binary(data))
from_json(Binary::new(data))
}

/// SUDO_PAYLOAD - tmp storage for sudo handler payloads
Expand All @@ -59,5 +59,5 @@ pub fn read_sudo_payload(
seq_id: u64,
) -> StdResult<SudoPayload> {
let data = SUDO_PAYLOAD.load(store, (channel_id, seq_id))?;
from_json(Binary(data))
from_json(Binary::new(data))
}
2 changes: 1 addition & 1 deletion contracts/neutron_interchain_queries/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib --features backtraces"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --bin neutron_interchain_queries_schema"
3 changes: 0 additions & 3 deletions contracts/neutron_interchain_queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ exclude = [
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
Expand All @@ -32,4 +30,3 @@ cosmwasm-schema = { workspace = true }

[dev-dependencies]
base64 = { workspace = true }

39 changes: 26 additions & 13 deletions contracts/neutron_interchain_queries/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -67,7 +68,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand All @@ -93,7 +95,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -126,7 +129,8 @@
"type": "string"
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -159,7 +163,8 @@
"type": "string"
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -194,7 +199,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -232,7 +238,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -269,7 +276,8 @@
"type": "string"
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -306,7 +314,8 @@
"type": "string"
}
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -340,7 +349,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -385,7 +395,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand All @@ -407,7 +418,8 @@
"format": "uint64",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down Expand Up @@ -438,7 +450,8 @@
"description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)",
"type": "string"
}
}
},
"additionalProperties": false
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object"
"type": "object",
"additionalProperties": false
}
Loading

0 comments on commit 76c4b85

Please sign in to comment.