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

added register_fee field for register interchain account msg #112

Merged
merged 1 commit into from
Sep 19, 2023
Merged
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
32 changes: 30 additions & 2 deletions contracts/neutron_interchain_txs/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
"type": "object",
"required": [
"connection_id",
"interchain_account_id"
"interchain_account_id",
"register_fee"
],
"properties": {
"connection_id": {
"type": "string"
},
"interchain_account_id": {
"type": "string"
},
"register_fee": {
"type": "array",
"items": {
"$ref": "#/definitions/Coin"
}
}
}
}
Expand Down Expand Up @@ -110,5 +117,26 @@
},
"additionalProperties": false
}
]
],
"definitions": {
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
}
}
}
21 changes: 16 additions & 5 deletions contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
to_binary, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response,
StdError, StdResult, SubMsg,
to_binary, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo,
Reply, Response, StdError, StdResult, SubMsg,
};
use cw2::set_contract_version;
use prost::Message;
Expand Down Expand Up @@ -78,7 +78,14 @@ pub fn execute(
ExecuteMsg::Register {
connection_id,
interchain_account_id,
} => execute_register_ica(deps, env, connection_id, interchain_account_id),
register_fee,
} => execute_register_ica(
deps,
env,
connection_id,
interchain_account_id,
register_fee,
),
ExecuteMsg::Delegate {
validator,
interchain_account_id,
Expand Down Expand Up @@ -188,9 +195,13 @@ fn execute_register_ica(
env: Env,
connection_id: String,
interchain_account_id: String,
register_fee: Vec<CoinSDK>,
) -> NeutronResult<Response<NeutronMsg>> {
let register =
NeutronMsg::register_interchain_account(connection_id, interchain_account_id.clone());
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);
// we are saving empty data here because we handle response of registering ICA in sudo_open_ack method
INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?;
Expand Down
2 changes: 2 additions & 0 deletions contracts/neutron_interchain_txs/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use cosmwasm_std::Coin;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -34,6 +35,7 @@ pub enum ExecuteMsg {
Register {
connection_id: String,
interchain_account_id: String,
register_fee: Vec<Coin>,
},
Delegate {
interchain_account_id: String,
Expand Down
Loading
Loading