Skip to content

Commit

Permalink
Merge pull request #27 from neutron-org/feat/ica-register-fee
Browse files Browse the repository at this point in the history
updated ica contract to pay register fee
  • Loading branch information
pr0n00gler authored Sep 19, 2023
2 parents 685e8b0 + bdc732b commit 81c7152
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 25 deletions.
22 changes: 21 additions & 1 deletion Cargo.lock

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

20 changes: 7 additions & 13 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
3a4c512a4ca6a26f80e8d351b101103248d6ddb51caf8eb1c96db3613feedf5f client_updater-aarch64.wasm
c0190cf28da64b4058da71a9083c187d45f84ee7b9db11a0830025ecb0a687dc client_updater.wasm
ee36fe3b2c7b73bdaf00f92019adbbb7e0459cabf00b797336df16ca3cfd908d echo-aarch64.wasm
4ee0b1e8a1c39e7a440f236778e76935f29506f354b6a59712d267181da77678 echo.wasm
d72e2f3bd0e3cc7e38fe716144220e699023fd8013e52360dac2d3a01b2edad6 ibc_transfer-aarch64.wasm
ce5e308994094fbf5b339fd4ae761d9ff38db7dfa7fe17c10c86f942ec050509 ibc_transfer-x86_64.wasm
cf4b2b555032cffa472b98122dee6d6c8f53d07be31c2565d651b4941584f4f1 ibc_transfer.wasm
72274baaf57f04f86ae5af938ac30d824953a28b1f9e8956910ed50f85335641 msg_receiver-aarch64.wasm
af52c56fb25355afa04d86c7d9e867f9db9295a455fb8a89f9cfdbd6374dd1ff msg_receiver.wasm
15a5c15af41227b8861e92a89830d9c76fba368c2be252709bd9868ce5f9a171 neutron_interchain_queries-aarch64.wasm
5e10902809cdff421e1fa33aa390f085f7f378fd767c929fb30db581c6a6a4ef neutron_interchain_queries-x86_64.wasm
05e49fb2d0295c9a9e27a0077da856126f8285c2e949cb1f927f08fa8a867c8e neutron_interchain_queries.wasm
955075ca5b473e1a987d5384cd4e3d6aa730f412edc3049b6527239549319fec neutron_interchain_txs-aarch64.wasm
696362a84c5f8ef42eec10ea9ece3e77251b6de971e05aaa338ae1a1bb21f157 neutron_interchain_txs.wasm
08e912518f6f87119833a863b7562f52d043d80d78e0539c3f3cd50b1cfd4ac5 neutron_price_feed_mock-aarch64.wasm
867c5235f0dc7fa15b1e175173ffeab24776cfe2c79ff0a62962ef17b10669c8 neutron_interchain_txs-x86_64.wasm
e80d5b9b68d9a1a7d00fd8f13cf52157c8fb50989b6e28e3ea5c69211b384b06 neutron_interchain_txs.wasm
344ec19c522cc5e6135a77a181345f02a0f65ef19ad919d5236dc16f53d33e76 neutron_price_feed_mock.wasm
6e1a337b1f905cd6b4b5414beb64f67a16de525ad9618ebc5d917246dac4c131 neutron_validators_test-aarch64.wasm
2dac4d3a4bf9239291205a2d4840aac3664a24faecd143d66ad9ef690beffbd7 neutron_validators_test-x86_64.wasm
4678704ef3ffd9f1240b719991dc629623929fa75499fd6ed9f76eda4c8a556a neutron_validators_test.wasm
c68ec42808159b006580e6868a7e8de0abfaa52a9a6ebaf90c25ffbf711aee33 reflect-aarch64.wasm
68ab8e8f880300ec82912a1b686e0e0535ad06f8d5c3050bf2f815eb5fe8d4d3 reflect-x86_64.wasm
c24970beb5a08bfc73dc422e63207342343802a329f28d527b4accaaf66209f8 reflect.wasm
d18b852f6c0c57b51e577825f454e82f233b26f86d441d264654c7a58f42f5dc stargate_querier-aarch64.wasm
d2ee71886a22631993bbe9f5add6878601897e2f11a31eb7a83296c6eb57eafa stargate_querier.wasm
9bc16491e14afe7f8b0aded8aaa01bbfa0d7b05394e14b0b10ac5e361bc4fa07 tokenfactory-aarch64.wasm
d4f2b08d01566df34a150e7a48b7b143efaa2787de2a1245d7c1cb9276662fb7 stargate_querier.wasm
a9ee139212dca756adbde1e86723154b1fd79dc96cbc7e4885a851d8c978e946 tokenfactory.wasm
6 changes: 3 additions & 3 deletions artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
b388b89207c69e9e243f5acf64b761e1cf1116adcc2d79e4eb59bf8cb6c9b99a target/wasm32-unknown-unknown/release/ibc_transfer.wasm
d89ba235e130977d1f79ac4d7f9252f6f6bed3002dfc1d08227ba138acec70b1 target/wasm32-unknown-unknown/release/client_updater.wasm
a67c60c5853497b890d67dd2bfed1caf0984a03af01ec67c877e63688970814e target/wasm32-unknown-unknown/release/echo.wasm
b388b89207c69e9e243f5acf64b761e1cf1116adcc2d79e4eb59bf8cb6c9b99a target/wasm32-unknown-unknown/release/ibc_transfer.wasm
f1ec0aa2f9c84a8b0d63d877fb6dcaf2d25c30023740f3ef53072496124c7dce target/wasm32-unknown-unknown/release/msg_receiver.wasm
b09e4f513e19e78b5ea08e10d26dc4d61056a4c6f534e783039f32494c39021b target/wasm32-unknown-unknown/release/neutron_interchain_queries.wasm
78b1e6a83b5adc768345716f9eac1bbcc1c4676046d18efaa27d8a8d6c470cb7 target/wasm32-unknown-unknown/release/neutron_interchain_txs.wasm
87924a496ac48e2581587f17a234e409f266b5deacc063a506bdeb43766e621e target/wasm32-unknown-unknown/release/neutron_interchain_txs.wasm
e947d71ddeb4f6e61d756b48981bedae6973e0b25a9d873c3bba5e9878079d8b target/wasm32-unknown-unknown/release/neutron_price_feed_mock.wasm
8893279611c69a5ca55628f0476e943ca60b8900cb0ae17fefc2f38c4e472215 target/wasm32-unknown-unknown/release/neutron_validators_test.wasm
b260fdda36208b9017f0f142821fa3bb47f3d3dea86901d687cf3d3da00946e0 target/wasm32-unknown-unknown/release/reflect.wasm
46d5d18cf293f37cca582c669de1364635e9c69eaed629f9d5dfe4b6db1b352e target/wasm32-unknown-unknown/release/stargate_querier.wasm
8b02c1c4e8536bb8a5be00b45993dd45ac9f9f996df2b66f0ca72e71d9598e69 target/wasm32-unknown-unknown/release/stargate_querier.wasm
fc80abbf059bafa21b25162af22ddb963a1ea1c6ab4dd671855adb3e1f8a8a84 target/wasm32-unknown-unknown/release/tokenfactory.wasm
Binary file modified artifacts/neutron_interchain_txs.wasm
Binary file not shown.
4 changes: 3 additions & 1 deletion contracts/neutron_interchain_txs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ serde = { version = "1.0.180", default-features = false, features = ["derive"] }
serde-json-wasm = { version = "0.5.1" }
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
cosmos-sdk-proto = { version = "0.16.0", default-features = false }
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", rev = "bb2188561a30d0a7fb293ff05f73907724eb2020" }
# neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", rev = "bb2188561a30d0a7fb293ff05f73907724eb2020" }
neutron-sdk = { package = "neutron-sdk",git = "https://github.com/neutron-org/neutron-sdk.git", rev = "8f8865870b91cb4c072c42934a621572c2634712" }

base64 = "0.21.2"
protobuf = { version = "3.2.0", features = ["with-bytes"] }
prost = "0.11"
Expand Down
17 changes: 11 additions & 6 deletions contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, Coin as CosmosCoin, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo,
Reply, ReplyOn, Response, StdError, StdResult, SubMsg, Uint128,
coins, to_binary, Binary, Coin as CosmosCoin, CosmosMsg, CustomQuery, Deps, DepsMut, Env,
MessageInfo, Reply, ReplyOn, Response, StdError, StdResult, SubMsg, Uint128,
};
use cw2::set_contract_version;
use prost::Message;
Expand Down Expand Up @@ -48,8 +48,8 @@ use crate::storage::{
save_reply_payload, save_sudo_payload, AcknowledgementResult, DoubleDelegateInfo,
IntegrationTestsSudoFailureMock, IntegrationTestsSudoSubmsgFailureMock, SudoPayload,
ACKNOWLEDGEMENT_RESULTS, IBC_FEE, INTEGRATION_TESTS_SUDO_FAILURE_MOCK,
INTEGRATION_TESTS_SUDO_SUBMSG_FAILURE_MOCK, INTERCHAIN_ACCOUNTS, SUDO_FAILING_SUBMSG_REPLY_ID,
SUDO_PAYLOAD_REPLY_ID, TEST_COUNTER_ITEM,
INTEGRATION_TESTS_SUDO_SUBMSG_FAILURE_MOCK, INTERCHAIN_ACCOUNTS, REGISTER_FEE,
SUDO_FAILING_SUBMSG_REPLY_ID, SUDO_PAYLOAD_REPLY_ID, TEST_COUNTER_ITEM,
};

// Default timeout for SubmitTX is two weeks
Expand Down Expand Up @@ -89,6 +89,7 @@ pub fn instantiate(
) -> NeutronResult<Response<NeutronMsg>> {
deps.api.debug("WASMDEBUG: instantiate");
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
REGISTER_FEE.save(deps.storage, &coins(1000, "untrn"))?;
Ok(Response::default())
}

Expand Down Expand Up @@ -301,8 +302,12 @@ fn execute_register_ica(
connection_id: String,
interchain_account_id: String,
) -> StdResult<Response<NeutronMsg>> {
let register =
NeutronMsg::register_interchain_account(connection_id, interchain_account_id.clone());
let register_fee = REGISTER_FEE.load(deps.storage)?;
let register = NeutronMsg::register_interchain_account(
connection_id,
interchain_account_id.clone(),
register_fee,
);
let key = get_port_id(env.contract.address.as_str(), &interchain_account_id);
INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?;
Ok(Response::new().add_message(register))
Expand Down
3 changes: 2 additions & 1 deletion contracts/neutron_interchain_txs/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{from_binary, to_vec, Binary, Order, StdResult, Storage};
use cosmwasm_std::{from_binary, to_vec, Binary, Coin, Order, StdResult, Storage};
use cw_storage_plus::{Item, Map};
use neutron_sdk::bindings::msg::IbcFee;
use schemars::JsonSchema;
Expand All @@ -25,6 +25,7 @@ pub const SUDO_PAYLOAD_REPLY_ID: u64 = 1;
pub const SUDO_FAILING_SUBMSG_REPLY_ID: u64 = 2;

pub const IBC_FEE: Item<IbcFee> = Item::new("ibc_fee");
pub const REGISTER_FEE: Item<Vec<Coin>> = Item::new("register_fee");
pub const REPLY_ID_STORAGE: Item<Vec<u8>> = Item::new("reply_queue_id");
pub const SUDO_PAYLOAD: Map<(String, u64), Vec<u8>> = Map::new("sudo_payload");
pub const INTERCHAIN_ACCOUNTS: Map<String, Option<(String, String)>> =
Expand Down

0 comments on commit 81c7152

Please sign in to comment.