Skip to content

Commit

Permalink
Merge pull request #8 from hadronlabs-org/feat/sdk-47
Browse files Browse the repository at this point in the history
feat: sdk-47
  • Loading branch information
ratik authored Dec 7, 2023
2 parents bd5a258 + a97d020 commit c7e374f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 17 deletions.
42 changes: 35 additions & 7 deletions Cargo.lock

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

7 changes: 5 additions & 2 deletions contracts/interchain-interceptor-authz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[package]
authors = ["Sergey Ratiashvili <[email protected]>", "Albert Andrejev <[email protected]>"]
authors = [
"Sergey Ratiashvili <[email protected]>",
"Albert Andrejev <[email protected]>",
]
description = "Contract to facilitate base interchain features with authz module usage"
edition = "2021"
name = "lido-interchain-interceptor-authz"
Expand All @@ -25,7 +28,7 @@ library = []
[dependencies]
base64 = "0.21.2"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
neutron-sdk = { package = "neutron-sdk", version = "0.7.0" }
neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk", branch = "sdk/47" }
prost = "0.12.1"
prost-types = "0.12.1"
protobuf = "3.2.0"
Expand Down
3 changes: 3 additions & 0 deletions contracts/interchain-interceptor-authz/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum ExecuteMsg {
recv_fee: Uint128,
ack_fee: Uint128,
timeout_fee: Uint128,
register_fee: Uint128,
},
Delegate {
validator: String,
Expand Down Expand Up @@ -56,10 +57,12 @@ impl ExecuteMsg {
recv_fee,
ack_fee,
timeout_fee,
register_fee,
} => BaseExecuteMsg::SetFees {
recv_fee: *recv_fee,
ack_fee: *ack_fee,
timeout_fee: *timeout_fee,
register_fee: *register_fee,
},
_ => unimplemented!(),
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/interchain-interceptor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library = []
[dependencies]
base64 = "0.21.2"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
neutron-sdk = { package = "neutron-sdk", version = "0.7.0" }
neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk", branch = "sdk/47" }
prost = "0.12.1"
prost-types = "0.12.1"
protobuf = "3.2.0"
Expand All @@ -44,4 +44,4 @@ lido-interchain-interceptor-base = { path = "../../packages/interchain-intercept

[dev-dependencies]
cosmwasm-storage = { version = "1.0" }
cw-multi-test = "0.17.0"
cw-multi-test = "0.19.0"
3 changes: 3 additions & 0 deletions contracts/interchain-interceptor/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum ExecuteMsg {
recv_fee: Uint128,
ack_fee: Uint128,
timeout_fee: Uint128,
register_fee: Uint128,
},
Delegate {
validator: String,
Expand Down Expand Up @@ -62,10 +63,12 @@ impl ExecuteMsg {
recv_fee,
ack_fee,
timeout_fee,
register_fee,
} => BaseExecuteMsg::SetFees {
recv_fee: *recv_fee,
ack_fee: *ack_fee,
timeout_fee: *timeout_fee,
register_fee: *register_fee,
},
_ => unimplemented!(),
}
Expand Down
4 changes: 2 additions & 2 deletions packages/interchain-interceptor-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library = []
[dependencies]
base64 = "0.21.2"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
neutron-sdk = { package = "neutron-sdk", version = "0.7.0" }
neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk", branch = "sdk/47" }
prost = "0.12.1"
prost-types = "0.12.1"
protobuf = "3.2.0"
Expand All @@ -35,7 +35,7 @@ thiserror = { workspace = true }
cosmwasm-schema = { version = "1.3.1" }
cosmwasm-std = { version = "1.2.1" }
cw-storage-plus = { version = "1.0.1" }
cw-ownable = { workspace = true }
cw-ownable = { workspace = true }
cw2 = { version = "1.0.1" }
cw20 = { version = "1.0.1" }
schemars = "0.8"
Expand Down
19 changes: 16 additions & 3 deletions packages/interchain-interceptor-base/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ where
recv_fee,
ack_fee,
timeout_fee,
} => self.execute_set_fees(deps, recv_fee, ack_fee, timeout_fee),
register_fee,
} => self.execute_set_fees(deps, recv_fee, ack_fee, timeout_fee, register_fee),
}
}

Expand All @@ -61,8 +62,12 @@ where
} else if state.ica_state == IcaState::Registered {
Err(ContractError::IcaAlreadyRegistered {})
} else {
let register =
NeutronMsg::register_interchain_account(config.connection_id(), ICA_ID.to_string());
let register_fee = self.register_fee.load(deps.storage)?;
let register = NeutronMsg::register_interchain_account(
config.connection_id(),
ICA_ID.to_string(),
Some(vec![register_fee]),
);
let _key = get_port_id(env.contract.address.as_str(), ICA_ID);

self.state.save(
Expand All @@ -84,6 +89,7 @@ where
recv_fee: Uint128,
ack_fee: Uint128,
timeout_fee: Uint128,
register_fee: Uint128,
) -> ContractResult<Response<NeutronMsg>> {
// TODO: Change LOCAL_DENOM to configurable value
let fees = IbcFee {
Expand All @@ -101,6 +107,13 @@ where
}],
};
self.ibc_fee.save(deps.storage, &fees)?;
self.register_fee.save(
deps.storage,
&CosmosCoin {
amount: register_fee,
denom: LOCAL_DENOM.to_string(),
},
)?;
Ok(Response::default())
}

Expand Down
1 change: 1 addition & 0 deletions packages/interchain-interceptor-base/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub enum ExecuteMsg {
recv_fee: Uint128,
ack_fee: Uint128,
timeout_fee: Uint128,
register_fee: Uint128,
},
}

Expand Down
4 changes: 3 additions & 1 deletion packages/interchain-interceptor-base/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Delegation;
use cosmwasm_std::{Coin, Delegation};
use cw_storage_plus::{Item, Map};
use neutron_sdk::bindings::msg::IbcFee;
use serde::{de::DeserializeOwned, Serialize};
Expand All @@ -19,6 +19,7 @@ where
pub sudo_payload: Map<'a, (String, u64), SudoPayload<C>>,
pub reply_id_storage: Item<'a, Vec<u8>>,
pub ibc_fee: Item<'a, IbcFee>,
pub register_fee: Item<'a, Coin>,
}

impl<T, C> Default for InterchainIntercaptorBase<'static, T, C>
Expand Down Expand Up @@ -46,6 +47,7 @@ where
sudo_payload: Map::new("sudo_payload"),
reply_id_storage: Item::new("reply_queue_id"),
ibc_fee: Item::new("ibc_fee"),
register_fee: Item::new("register_fee"),
}
}
}
Expand Down

0 comments on commit c7e374f

Please sign in to comment.