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

Chore: ics v6 #69

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
351 changes: 202 additions & 149 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ overflow-checks = true

[workspace.dependencies]
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" }
neutron-std = { package = "neutron-std", git = "https://github.com/neutron-org/neutron-std", branch = "feat/connect" }
prost = "0.12.4"
prost-types = "0.12.4"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
Expand Down
7 changes: 4 additions & 3 deletions contracts/dex_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ edition = "2021"


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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -32,6 +32,7 @@ library = []

[dependencies]
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }
cosmwasm-std = { workspace = true }
cw2 = { workspace = true }
schemars = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion contracts/dex_grpc/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use cosmwasm_std::{
StdResult,
};
use cw2::set_contract_version;
use neutron_sdk::proto_types::neutron::dex;
use neutron_sdk::sudo::msg::SudoMsg;
use neutron_std::types::neutron::dex;

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -133,6 +133,7 @@ pub fn execute(
}
}

#[allow(deprecated)]
#[entry_point]
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
deps.api
Expand Down
13 changes: 8 additions & 5 deletions contracts/dex_grpc/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use neutron_sdk::proto_types::neutron::dex::{
DepositOptions, MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, MsgPlaceLimitOrder,
MsgWithdrawFilledLimitOrder, MsgWithdrawal, MultiHopRoute,
use neutron_std::shim::Timestamp;
use neutron_std::types::neutron::dex::{DepositOptions, MultiHopRoute};
use neutron_std::types::{cosmos::base::query::v1beta1::PageRequest, neutron::dex};

use neutron_std::types::neutron::dex::{
MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, MsgPlaceLimitOrder,
MsgWithdrawFilledLimitOrder, MsgWithdrawal,
};
use neutron_sdk::proto_types::{cosmos::base::query::v1beta1::PageRequest, neutron::dex};
use neutron_sdk::shim::Timestamp;

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down
7 changes: 4 additions & 3 deletions contracts/grpc_querier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ edition = "2021"


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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -26,6 +26,7 @@ schemars = { workspace = true }
serde = { workspace = true }
serde-json-wasm = { workspace = true }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }
prost = { workspace = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion contracts/grpc_querier/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::str::from_utf8;

use crate::grpc;
use cw2::set_contract_version;
use neutron_sdk::proto_types::{
use neutron_std::types::{
cosmos::{auth, bank},
ibc::{
applications::transfer,
Expand Down
5 changes: 2 additions & 3 deletions contracts/grpc_querier/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ pub mod contractmanager {
#[prost(string, tag = "1")]
pub address: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<
::neutron_sdk::proto_types::cosmos::base::query::v1beta1::PageRequest,
>,
pub pagination:
::core::option::Option<::neutron_std::types::cosmos::base::query::v1beta1::PageRequest>,
}
}
7 changes: 4 additions & 3 deletions contracts/ibc_transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ edition = "2021"


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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -27,6 +27,7 @@ serde = { workspace = true }
serde-json-wasm = { workspace = true }
cw-storage-plus = { workspace = true }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { workspace = true }
2 changes: 1 addition & 1 deletion contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use cosmwasm_std::{
};
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, NeutronMsg},
sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg},
};
use neutron_std::types::neutron::transfer::MsgTransferResponse;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down
7 changes: 4 additions & 3 deletions contracts/neutron_interchain_txs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ authors = ["ratik <sergey.r@p2p.org>"]
edition = "2021"

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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -27,6 +27,7 @@ serde-json-wasm = { workspace = true }
cw-storage-plus = { workspace = true }
cosmos-sdk-proto = { workspace = true }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }

Expand Down
6 changes: 3 additions & 3 deletions contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ use neutron_sdk::bindings::query::{NeutronQuery, QueryInterchainAccountAddressRe
use neutron_sdk::bindings::types::ProtobufAny;
use neutron_sdk::interchain_txs::helpers::{decode_message_response, get_port_id};
use neutron_sdk::interchain_txs::v047::helpers::decode_acknowledgement_response;
use neutron_sdk::proto_types::neutron::interchaintxs::v1::{
MsgRegisterInterchainAccountResponse, MsgSubmitTxResponse,
};
use neutron_sdk::sudo::msg::{RequestPacket, SudoMsg};
use neutron_sdk::NeutronResult;
use neutron_std::types::neutron::interchaintxs::v1::{
MsgRegisterInterchainAccountResponse, MsgSubmitTxResponse,
};

use crate::storage::{
add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload,
Expand Down
7 changes: 4 additions & 3 deletions contracts/neutron_validator_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ authors = ["ratik <sergey.r@p2p.org>"]
edition = "2021"

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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -27,6 +27,7 @@ serde-json-wasm = { workspace = true }
cw-storage-plus = { workspace = true }
cosmos-sdk-proto = { workspace = true }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { workspace = true }
2 changes: 1 addition & 1 deletion contracts/neutron_validator_test/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ use neutron_sdk::interchain_queries::v045::{
};
use neutron_sdk::interchain_txs::helpers::{decode_message_response, get_port_id};
use neutron_sdk::interchain_txs::v047::helpers::decode_acknowledgement_response;
use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse;
use neutron_sdk::sudo::msg::{RequestPacket, SudoMsg};
use neutron_sdk::{NeutronError, NeutronResult};
use neutron_std::types::neutron::interchaintxs::v1::MsgSubmitTxResponse;

use crate::storage::{
read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload,
Expand Down
7 changes: 4 additions & 3 deletions contracts/oracle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ edition = "2021"


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.
"contract.wasm",
"hash.txt",
# 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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down Expand Up @@ -36,6 +36,7 @@ cw2 = { workspace = true }
schemars = { workspace = true }
serde = { version = "1.0.180", default-features = false, features = ["derive"] }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { workspace = true }
26 changes: 10 additions & 16 deletions contracts/oracle/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ pub struct InstantiateMsg {}
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {}

use neutron_sdk::bindings::{
msg::NeutronMsg,
oracle::query::{
GetAllCurrencyPairsResponse, GetPriceResponse, GetPricesResponse, OracleQuery,
},
query::NeutronQuery,
};
use neutron_sdk::bindings::{msg::NeutronMsg, oracle::query::OracleQuery, query::NeutronQuery};

use neutron_std::types::connect::oracle::v2::OracleQuerier;

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -51,18 +47,16 @@ pub fn query(deps: Deps<NeutronQuery>, env: Env, msg: OracleQuery) -> StdResult<
}

fn query_oracle(deps: Deps<NeutronQuery>, _env: Env, msg: OracleQuery) -> StdResult<Binary> {
let oracle_querier = OracleQuerier::new(&deps.querier);
match msg {
OracleQuery::GetPrice { .. } => {
let query_response: GetPriceResponse = deps.querier.query(&msg.into())?;
to_json_binary(&query_response)
}
OracleQuery::GetPrices { .. } => {
let query_response: GetPricesResponse = deps.querier.query(&msg.into())?;
to_json_binary(&query_response)
OracleQuery::GetPrice { currency_pair } => to_json_binary(
&oracle_querier.get_price(format!("{}/{}", currency_pair.base, currency_pair.quote))?,
),
OracleQuery::GetPrices { currency_pair_ids } => {
to_json_binary(&oracle_querier.get_prices(currency_pair_ids)?)
}
OracleQuery::GetAllCurrencyPairs { .. } => {
let query_response: GetAllCurrencyPairsResponse = deps.querier.query(&msg.into())?;
to_json_binary(&query_response)
to_json_binary(&oracle_querier.get_all_currency_pairs()?)
}
}
}
5 changes: 5 additions & 0 deletions contracts/reflect/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -1877,11 +1877,16 @@
"add_schedule": {
"type": "object",
"required": [
"execution_stage",
"msgs",
"name",
"period"
],
"properties": {
"execution_stage": {
"description": "execution stage where schedule will be executed",
"type": "string"
},
"msgs": {
"description": "list of cosmwasm messages to be executed",
"type": "array",
Expand Down
Loading