From 9eb94134965483cd7ce8282d751f3acda1040efe Mon Sep 17 00:00:00 2001 From: CJ Cobb <46455409+cjcobb23@users.noreply.github.com> Date: Fri, 10 Jan 2025 13:46:42 -0500 Subject: [PATCH] refactor(minor-interchain-token-service)!: refactor custom token linking (#738) --- contracts/interchain-token-service/src/abi.rs | 81 +++++---- .../src/contract/execute/interceptors.rs | 7 +- .../src/contract/execute/mod.rs | 40 +++-- .../interchain-token-service/src/events.rs | 86 +-------- .../src/primitives.rs | 17 +- .../interchain-token-service/src/state.rs | 26 +-- ...essage_received_with_all_attributes.golden | 56 +----- ...sage_received_with_empty_attributes.golden | 96 ++-------- .../interchain-token-service/tests/execute.rs | 124 ++++++++++++- .../execute_hub_message_succeeds.golden | 56 +----- ...cimals_when_max_uints_are_different.golden | 80 ++++----- ...ecimals_when_max_uints_are_the_same.golden | 80 ++++----- ...ld_scale_correctly_in_3_chain_cycle.golden | 24 +-- ...orrectly_in_3_chain_cycle_with_dust.golden | 24 +-- ..._tokens_when_decimals_are_different.golden | 170 ++++++++++++++++++ ..._when_source_decimals_are_different.golden | 108 ++++------- 16 files changed, 529 insertions(+), 546 deletions(-) create mode 100644 contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_custom_tokens_when_decimals_are_different.golden diff --git a/contracts/interchain-token-service/src/abi.rs b/contracts/interchain-token-service/src/abi.rs index fe4c5e1c1..dec44bf57 100644 --- a/contracts/interchain-token-service/src/abi.rs +++ b/contracts/interchain-token-service/src/abi.rs @@ -19,8 +19,8 @@ sol! { DeployTokenManager, // note, this case is not supported by the ITS hub SendToHub, ReceiveFromHub, - RegisterToken, - LinkToken + LinkToken, + RegisterTokenMetadata, } struct InterchainTransfer { @@ -55,7 +55,7 @@ sol! { bytes message; } - struct RegisterToken { + struct RegisterTokenMetadata { uint256 messageType; bytes tokenAddress; uint8 decimals; @@ -67,7 +67,6 @@ sol! { uint256 tokenManagerType; bytes sourceToken; bytes destinationToken; - bool autoscaling; bytes params; } } @@ -119,15 +118,6 @@ impl Message { minter: into_vec(minter).into(), } .abi_encode_params(), - Message::RegisterTokenMetadata(primitives::RegisterTokenMetadata { - decimals, - address, - }) => RegisterToken { - messageType: MessageType::RegisterToken.into(), - decimals, - tokenAddress: address.to_vec().into(), - } - .abi_encode_params(), Message::LinkToken(primitives::LinkToken { token_id, token_manager_type, @@ -140,7 +130,6 @@ impl Message { destinationToken: destination_token_address.to_vec().into(), sourceToken: source_token_address.to_vec().into(), tokenManagerType: U256::from_le_bytes(token_manager_type.to_le_bytes()), - autoscaling: false, params: into_vec(params).into(), } .abi_encode_params(), @@ -187,40 +176,26 @@ impl Message { } .into() } - MessageType::RegisterToken => { - let RegisterToken { - tokenAddress, - decimals, - .. - } = RegisterToken::abi_decode_params(payload, true) - .map_err(Error::AbiDecodeFailed)?; - - primitives::RegisterTokenMetadata { - decimals, - address: tokenAddress.to_vec().try_into().map_err(Error::NonEmpty)?, - } - .into() - } MessageType::LinkToken => { - let decoded = - LinkToken::abi_decode_params(payload, true).map_err(Error::AbiDecodeFailed)?; + let LinkToken { + tokenId, + tokenManagerType, + sourceToken, + destinationToken, + params, + .. + } = LinkToken::abi_decode_params(payload, true).map_err(Error::AbiDecodeFailed)?; primitives::LinkToken { - token_id: TokenId::new(decoded.tokenId.into()), - source_token_address: decoded - .sourceToken - .to_vec() + token_id: TokenId::new(tokenId.into()), + source_token_address: Vec::::from(sourceToken) .try_into() .map_err(Error::NonEmpty)?, - token_manager_type: Uint256::from_le_bytes( - decoded.tokenManagerType.to_le_bytes(), - ), - destination_token_address: decoded - .destinationToken - .to_vec() + token_manager_type: Uint256::from_le_bytes(tokenManagerType.to_le_bytes()), + destination_token_address: Vec::::from(destinationToken) .try_into() .map_err(Error::NonEmpty)?, - params: from_vec(decoded.params.into())?, + params: from_vec(params.into())?, } .into() } @@ -254,6 +229,16 @@ impl HubMessage { } .abi_encode_params() .into(), + HubMessage::RegisterTokenMetadata(primitives::RegisterTokenMetadata { + decimals, + token_address, + }) => RegisterTokenMetadata { + messageType: MessageType::RegisterTokenMetadata.into(), + decimals, + tokenAddress: token_address.to_vec().into(), + } + .abi_encode_params() + .into(), } } @@ -284,6 +269,20 @@ impl HubMessage { message: Message::abi_decode(&decoded.message)?, } } + MessageType::RegisterTokenMetadata => { + let RegisterTokenMetadata { + tokenAddress, + decimals, + .. + } = RegisterTokenMetadata::abi_decode_params(payload, true) + .map_err(Error::AbiDecodeFailed)?; + HubMessage::RegisterTokenMetadata(primitives::RegisterTokenMetadata { + decimals, + token_address: Vec::::from(tokenAddress) + .try_into() + .map_err(Error::NonEmpty)?, + }) + } _ => bail!(Error::InvalidMessageType), }; diff --git a/contracts/interchain-token-service/src/contract/execute/interceptors.rs b/contracts/interchain-token-service/src/contract/execute/interceptors.rs index b11c43741..6dc318038 100644 --- a/contracts/interchain-token-service/src/contract/execute/interceptors.rs +++ b/contracts/interchain-token-service/src/contract/execute/interceptors.rs @@ -296,15 +296,16 @@ pub fn register_custom_token( let existing_token = state::may_load_custom_token( storage, source_chain.clone(), - register_token.address.clone(), + register_token.token_address.clone(), ) .change_context(Error::State)?; ensure!( existing_token.is_none(), - Error::TokenAlreadyRegistered(register_token.address) + Error::TokenAlreadyRegistered(register_token.token_address) ); - state::save_custom_token(storage, source_chain, register_token).change_context(Error::State) + state::save_custom_token_metadata(storage, source_chain, register_token) + .change_context(Error::State) } #[cfg(test)] diff --git a/contracts/interchain-token-service/src/contract/execute/mod.rs b/contracts/interchain-token-service/src/contract/execute/mod.rs index 999ee8599..6e12f54d3 100644 --- a/contracts/interchain-token-service/src/contract/execute/mod.rs +++ b/contracts/interchain-token-service/src/contract/execute/mod.rs @@ -107,6 +107,9 @@ pub fn execute_message( destination_chain, message, } => execute_message_on_hub(deps, cc_id, destination_chain, message), + HubMessage::RegisterTokenMetadata(msg) => { + execute_register_token_metadata(deps.storage, cc_id.source_chain, msg) + } _ => bail!(Error::InvalidMessageType), } } @@ -170,10 +173,6 @@ fn apply_to_hub( apply_to_token_deployment(storage, &source_chain, &destination_chain, deploy_token) .map(Message::DeployInterchainToken)? } - Message::RegisterTokenMetadata(register_token) => { - apply_to_register_token(storage, source_chain, register_token) - .map(Message::RegisterTokenMetadata)? - } Message::LinkToken(link_token) => { apply_to_link_token(storage, source_chain, destination_chain, link_token) .map(Message::LinkToken)? @@ -182,13 +181,24 @@ fn apply_to_hub( .then(Result::Ok) } -fn apply_to_register_token( +fn execute_register_token_metadata( storage: &mut dyn Storage, source_chain: ChainNameRaw, - register_token: RegisterTokenMetadata, -) -> Result { - interceptors::register_custom_token(storage, source_chain, register_token.clone())?; - Ok(register_token) + register_token_metadata: RegisterTokenMetadata, +) -> Result { + ensure_chain_not_frozen(storage, &source_chain)?; + + interceptors::register_custom_token( + storage, + source_chain.clone(), + register_token_metadata.clone(), + )?; + + Ok(Response::new().add_event(Event::TokenMetadataRegistered { + token_address: register_token_metadata.token_address, + decimals: register_token_metadata.decimals, + source_chain, + })) } fn apply_to_link_token( @@ -1001,14 +1011,10 @@ mod tests { decimals: u8, token_address: nonempty::HexBinary, ) { - let msg = HubMessage::SendToHub { - destination_chain: "axelar".try_into().unwrap(), - message: RegisterTokenMetadata { - decimals, - address: token_address.clone(), - } - .into(), - }; + let msg = HubMessage::RegisterTokenMetadata(RegisterTokenMetadata { + decimals, + token_address: token_address.clone(), + }); let res = assert_ok!(execute_message( deps.as_mut(), diff --git a/contracts/interchain-token-service/src/events.rs b/contracts/interchain-token-service/src/events.rs index 5516e5bcb..eee41bfa2 100644 --- a/contracts/interchain-token-service/src/events.rs +++ b/contracts/interchain-token-service/src/events.rs @@ -1,15 +1,20 @@ -use axelar_wasm_std::event::EventExt; +use axelar_wasm_std::{nonempty, IntoEvent}; use router_api::{Address, ChainNameRaw, CrossChainId}; use crate::primitives::Message; -use crate::{DeployInterchainToken, InterchainTransfer, LinkToken, RegisterTokenMetadata}; +#[derive(IntoEvent)] pub enum Event { MessageReceived { cc_id: CrossChainId, destination_chain: ChainNameRaw, message: Message, }, + TokenMetadataRegistered { + source_chain: ChainNameRaw, + token_address: nonempty::HexBinary, + decimals: u8, + }, ItsContractRegistered { chain: ChainNameRaw, address: Address, @@ -21,83 +26,6 @@ pub enum Event { ExecutionEnabled, } -impl From for cosmwasm_std::Event { - fn from(event: Event) -> Self { - match event { - Event::MessageReceived { - cc_id, - destination_chain, - message, - } => make_message_event("message_received", cc_id, destination_chain, message), - Event::ItsContractRegistered { chain, address } => { - cosmwasm_std::Event::new("its_contract_registered") - .add_attribute_as_string("chain", chain) - .add_attribute_as_string("address", address) - } - Event::ItsContractDeregistered { chain } => { - cosmwasm_std::Event::new("its_contract_deregistered") - .add_attribute_as_string("chain", chain) - } - Event::ExecutionDisabled => cosmwasm_std::Event::new("execution_disabled"), - Event::ExecutionEnabled => cosmwasm_std::Event::new("execution_enabled"), - } - } -} - -fn make_message_event( - event_name: &str, - cc_id: CrossChainId, - destination_chain: ChainNameRaw, - msg: Message, -) -> cosmwasm_std::Event { - let event = cosmwasm_std::Event::new(event_name) - .add_attribute_as_string("cc_id", cc_id) - .add_attribute_as_string("destination_chain", destination_chain) - .add_attribute_as_string("message_type", msg.as_ref()); - - match msg { - Message::InterchainTransfer(InterchainTransfer { - token_id, - source_address, - destination_address, - amount, - data, - }) => event - .add_attribute_as_string("token_id", token_id) - .add_attribute_as_string("source_address", source_address) - .add_attribute_as_string("destination_address", destination_address) - .add_attribute_as_string("amount", amount) - .add_attribute_if_some("data", data.map(|data| data.to_string())), - Message::DeployInterchainToken(DeployInterchainToken { - token_id, - name, - symbol, - decimals, - minter, - }) => event - .add_attribute_as_string("token_id", token_id) - .add_attribute("name", name) - .add_attribute("symbol", symbol) - .add_attribute_as_string("decimals", decimals) - .add_attribute_if_some("minter", minter.map(|minter| minter.to_string())), - Message::RegisterTokenMetadata(RegisterTokenMetadata { address, decimals }) => event - .add_attribute_as_string("decimals", decimals) - .add_attribute_as_string("address", address), - Message::LinkToken(LinkToken { - token_id, - token_manager_type, - source_token_address, - destination_token_address, - params, - }) => event - .add_attribute_as_string("token_id", token_id) - .add_attribute_as_string("token_manager_type", token_manager_type) - .add_attribute_as_string("source_token_address", source_token_address) - .add_attribute_as_string("destination_token_address", destination_token_address) - .add_attribute_if_some("params", params.map(|params| params.to_string())), - } -} - #[cfg(test)] mod test { use cosmwasm_std::HexBinary; diff --git a/contracts/interchain-token-service/src/primitives.rs b/contracts/interchain-token-service/src/primitives.rs index 658e3799d..b3113f16e 100644 --- a/contracts/interchain-token-service/src/primitives.rs +++ b/contracts/interchain-token-service/src/primitives.rs @@ -31,8 +31,6 @@ pub enum Message { /// Deploy a new interchain token on the destination chain DeployInterchainToken(DeployInterchainToken), - RegisterTokenMetadata(RegisterTokenMetadata), - LinkToken(LinkToken), } @@ -83,13 +81,7 @@ impl From for Message { #[derive(Eq)] pub struct RegisterTokenMetadata { pub decimals: u8, - pub address: nonempty::HexBinary, -} - -impl From for Message { - fn from(value: RegisterTokenMetadata) -> Self { - Message::RegisterTokenMetadata(value) - } + pub token_address: nonempty::HexBinary, } #[cw_serde] @@ -125,6 +117,7 @@ pub enum HubMessage { source_chain: ChainNameRaw, message: Message, }, + RegisterTokenMetadata(RegisterTokenMetadata), } impl HubMessage { @@ -132,6 +125,9 @@ impl HubMessage { match self { HubMessage::SendToHub { message, .. } => message, HubMessage::ReceiveFromHub { message, .. } => message, + HubMessage::RegisterTokenMetadata { .. } => { + panic!("no message associated with this hub message type") + } } } @@ -146,9 +142,6 @@ impl Message { Message::InterchainTransfer(InterchainTransfer { token_id, .. }) | Message::DeployInterchainToken(DeployInterchainToken { token_id, .. }) | Message::LinkToken(LinkToken { token_id, .. }) => *token_id, - Message::RegisterTokenMetadata(_) => { - panic!("no token id associated with this message type") - } } } } diff --git a/contracts/interchain-token-service/src/state.rs b/contracts/interchain-token-service/src/state.rs index 5bb225e9c..64076a0b4 100644 --- a/contracts/interchain-token-service/src/state.rs +++ b/contracts/interchain-token-service/src/state.rs @@ -129,17 +129,18 @@ pub struct TokenConfig { type TokenAddress = nonempty::HexBinary; #[cw_serde] -pub struct CustomToken { +pub struct CustomTokenMetadata { pub chain: ChainNameRaw, pub decimals: u8, - pub address: TokenAddress, + pub token_address: TokenAddress, } const CONFIG: Item = Item::new("config"); const CHAIN_CONFIGS: Map<&ChainNameRaw, ChainConfig> = Map::new("chain_configs"); const TOKEN_INSTANCE: Map<&(ChainNameRaw, TokenId), TokenInstance> = Map::new("token_instance"); const TOKEN_CONFIGS: Map<&TokenId, TokenConfig> = Map::new("token_configs"); -const CUSTOM_TOKENS: Map<&(ChainNameRaw, TokenAddress), CustomToken> = Map::new("custom_tokens"); +const CUSTOM_TOKEN_METADATA: Map<&(ChainNameRaw, TokenAddress), CustomTokenMetadata> = + Map::new("custom_tokens"); pub fn load_config(storage: &dyn Storage) -> Config { CONFIG @@ -291,19 +292,22 @@ pub fn save_token_config( .change_context(Error::Storage) } -pub fn save_custom_token( +pub fn save_custom_token_metadata( storage: &mut dyn Storage, chain: ChainNameRaw, - RegisterTokenMetadata { address, decimals }: RegisterTokenMetadata, + RegisterTokenMetadata { + token_address, + decimals, + }: RegisterTokenMetadata, ) -> Result<(), Error> { - CUSTOM_TOKENS + CUSTOM_TOKEN_METADATA .save( storage, - &(chain.clone(), address.clone()), - &CustomToken { + &(chain.clone(), token_address.clone()), + &CustomTokenMetadata { chain, decimals, - address, + token_address, }, ) .change_context(Error::Storage) @@ -313,8 +317,8 @@ pub fn may_load_custom_token( storage: &mut dyn Storage, source_chain: ChainNameRaw, token_address: TokenAddress, -) -> Result, Error> { - CUSTOM_TOKENS +) -> Result, Error> { + CUSTOM_TOKEN_METADATA .may_load(storage, &(source_chain, token_address)) .change_context(Error::Storage) } diff --git a/contracts/interchain-token-service/src/testdata/message_received_with_all_attributes.golden b/contracts/interchain-token-service/src/testdata/message_received_with_all_attributes.golden index 6ca4f7e4c..f746d753d 100644 --- a/contracts/interchain-token-service/src/testdata/message_received_with_all_attributes.golden +++ b/contracts/interchain-token-service/src/testdata/message_received_with_all_attributes.golden @@ -4,35 +4,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" + "value": "\"destination\"" }, { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "destination_address", - "value": "01020304" - }, - { - "key": "amount", - "value": "1" - }, - { - "key": "data", - "value": "01020304" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_address\":\"01020304\",\"amount\":\"1\",\"data\":\"01020304\"}}" } ] }, @@ -41,35 +21,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" - }, - { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "name", - "value": "Test" - }, - { - "key": "symbol", - "value": "TST" - }, - { - "key": "decimals", - "value": "18" + "value": "\"destination\"" }, { - "key": "minter", - "value": "0101010101010101010101010101010101010101010101010101010101010101" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"Test\",\"symbol\":\"TST\",\"decimals\":18,\"minter\":\"0101010101010101010101010101010101010101010101010101010101010101\"}}" } ] } diff --git a/contracts/interchain-token-service/src/testdata/message_received_with_empty_attributes.golden b/contracts/interchain-token-service/src/testdata/message_received_with_empty_attributes.golden index 9c1879b17..c95c6b096 100644 --- a/contracts/interchain-token-service/src/testdata/message_received_with_empty_attributes.golden +++ b/contracts/interchain-token-service/src/testdata/message_received_with_empty_attributes.golden @@ -4,31 +4,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" + "value": "\"destination\"" }, { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "destination_address", - "value": "01020304" - }, - { - "key": "amount", - "value": "1" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_address\":\"01020304\",\"amount\":\"1\",\"data\":null}}" } ] }, @@ -37,31 +21,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" - }, - { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "00" - }, - { - "key": "destination_address", - "value": "00" + "value": "\"destination\"" }, { - "key": "amount", - "value": "1" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"00\",\"destination_address\":\"00\",\"amount\":\"1\",\"data\":null}}" } ] }, @@ -70,31 +38,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" + "value": "\"destination\"" }, { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "name", - "value": "Test" - }, - { - "key": "symbol", - "value": "TST" - }, - { - "key": "decimals", - "value": "18" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"Test\",\"symbol\":\"TST\",\"decimals\":18,\"minter\":null}}" } ] }, @@ -103,31 +55,15 @@ "attributes": [ { "key": "cc_id", - "value": "source_hash" + "value": "{\"source_chain\":\"source\",\"message_id\":\"hash\"}" }, { "key": "destination_chain", - "value": "destination" - }, - { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "name", - "value": "t" - }, - { - "key": "symbol", - "value": "T" + "value": "\"destination\"" }, { - "key": "decimals", - "value": "0" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"t\",\"symbol\":\"T\",\"decimals\":0,\"minter\":null}}" } ] } diff --git a/contracts/interchain-token-service/tests/execute.rs b/contracts/interchain-token-service/tests/execute.rs index 0fdb212ef..586ebbf30 100644 --- a/contracts/interchain-token-service/tests/execute.rs +++ b/contracts/interchain-token-service/tests/execute.rs @@ -10,7 +10,8 @@ use interchain_token_service::contract::{self, ExecuteError}; use interchain_token_service::events::Event; use interchain_token_service::msg::{self, ExecuteMsg, TruncationConfig}; use interchain_token_service::{ - DeployInterchainToken, HubMessage, InterchainTransfer, TokenId, TokenSupply, + DeployInterchainToken, HubMessage, InterchainTransfer, LinkToken, RegisterTokenMetadata, + TokenId, TokenSupply, }; use router_api::{Address, ChainName, ChainNameRaw, CrossChainId}; use serde_json::json; @@ -228,6 +229,127 @@ fn execute_hub_message_succeeds() { goldie::assert_json!(responses); } +#[test] +fn execute_message_interchain_transfer_should_scale_custom_tokens_when_decimals_are_different() { + let ( + mut deps, + TestMessage { + router_message, + source_its_contract, + source_its_chain, + destination_its_chain, + destination_its_contract, + .. + }, + ) = utils::setup_with_chain_configs( + Uint256::MAX.try_into().unwrap(), + 6, + u64::MAX.try_into().unwrap(), + 6, + ); + let token_id = TokenId::new([1; 32]); + let hub_message = HubMessage::RegisterTokenMetadata(RegisterTokenMetadata { + decimals: 6, + token_address: HexBinary::from([1; 32]).try_into().unwrap(), + }); + let cc_id = CrossChainId { + source_chain: source_its_chain.clone(), + message_id: router_message.cc_id.message_id.clone(), + }; + let source_register_token_response = assert_ok!(utils::execute_hub_message( + deps.as_mut(), + cc_id, + source_its_contract.clone(), + hub_message, + )); + + let hub_message = HubMessage::RegisterTokenMetadata(RegisterTokenMetadata { + decimals: 18, + token_address: HexBinary::from([1; 32]).try_into().unwrap(), + }); + let cc_id = CrossChainId { + source_chain: destination_its_chain.clone(), + message_id: router_message.cc_id.message_id.clone(), + }; + let destination_register_token_response = assert_ok!(utils::execute_hub_message( + deps.as_mut(), + cc_id, + destination_its_contract.clone(), + hub_message, + )); + + let hub_message = HubMessage::SendToHub { + destination_chain: destination_its_chain.clone(), + message: LinkToken { + token_id, + token_manager_type: Uint256::zero(), + source_token_address: HexBinary::from([1; 32]).try_into().unwrap(), + destination_token_address: HexBinary::from([1; 32]).try_into().unwrap(), + params: None, + } + .into(), + }; + + let cc_id = CrossChainId { + source_chain: source_its_chain.clone(), + message_id: router_message.cc_id.message_id.clone(), + }; + let link_token_response = assert_ok!(utils::execute_hub_message( + deps.as_mut(), + cc_id, + source_its_contract.clone(), + hub_message, + )); + + // send from source to destination + let transfer = InterchainTransfer { + token_id, + source_address: HexBinary::from([1; 32]).try_into().unwrap(), + destination_address: HexBinary::from([2; 32]).try_into().unwrap(), + amount: Uint256::from_u128(1_000_000u128).try_into().unwrap(), + data: None, + }; + let hub_message = HubMessage::SendToHub { + destination_chain: destination_its_chain.clone(), + message: transfer.into(), + }; + let response_to_destination = assert_ok!(utils::execute_hub_message( + deps.as_mut(), + router_message.cc_id.clone(), + source_its_contract, + hub_message, + )); + + // send back from destination to source + let transfer = InterchainTransfer { + token_id, + source_address: HexBinary::from([2; 32]).try_into().unwrap(), + destination_address: HexBinary::from([1; 32]).try_into().unwrap(), + amount: Uint256::from_u128(1_000_000_000_000_000_000u128) + .try_into() + .unwrap(), + data: None, + }; + let mut cc_id = router_message.cc_id.clone(); + cc_id.source_chain = destination_its_chain.clone(); + let hub_message = HubMessage::SendToHub { + destination_chain: source_its_chain, + message: transfer.into(), + }; + let response_to_source = assert_ok!(utils::execute_hub_message( + deps.as_mut(), + cc_id, + destination_its_contract, + hub_message, + )); + + goldie::assert_json!(json!({"response_to_destination": response_to_destination, + "response_to_source": response_to_source, + "source_register_token_response": source_register_token_response, + "destination_register_token_response": destination_register_token_response, + "link_token_response" : link_token_response})); +} + #[test] fn execute_message_interchain_transfer_should_scale_the_amount_when_source_decimals_are_different() { diff --git a/contracts/interchain-token-service/tests/testdata/execute_hub_message_succeeds.golden b/contracts/interchain-token-service/tests/testdata/execute_hub_message_succeeds.golden index d17f88c83..10e77f23a 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_hub_message_succeeds.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_hub_message_succeeds.golden @@ -24,35 +24,15 @@ "attributes": [ { "key": "cc_id", - "value": "source-its-chain_message-id" + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "dest-its-chain" + "value": "\"dest-its-chain\"" }, { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "name", - "value": "Test" - }, - { - "key": "symbol", - "value": "TST" - }, - { - "key": "decimals", - "value": "18" - }, - { - "key": "minter", - "value": "0101010101010101010101010101010101010101010101010101010101010101" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"Test\",\"symbol\":\"TST\",\"decimals\":18,\"minter\":\"0101010101010101010101010101010101010101010101010101010101010101\"}}" } ] } @@ -84,35 +64,15 @@ "attributes": [ { "key": "cc_id", - "value": "source-its-chain_message-id" + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "dest-its-chain" - }, - { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "destination_address", - "value": "0202020202020202020202020202020202020202020202020202020202020202" - }, - { - "key": "amount", - "value": "1" + "value": "\"dest-its-chain\"" }, { - "key": "data", - "value": "01020304" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"amount\":\"1\",\"data\":\"01020304\"}}" } ] } diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_different.golden b/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_different.golden index 63a240cc2..49fa78fe4 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_different.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_different.golden @@ -1,68 +1,52 @@ { + "destination_token_instance": { + "decimals": 6, + "supply": { + "tracked": "0" + } + }, "response": { - "messages": [ - { - "id": 0, - "payload": "", - "msg": { - "wasm": { - "execute": { - "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", - "msg": "eyJjYWxsX2NvbnRyYWN0Ijp7ImRlc3RpbmF0aW9uX2NoYWluIjoiZGVzdC1pdHMtY2hhaW4iLCJkZXN0aW5hdGlvbl9hZGRyZXNzIjoiZGVzdC1pdHMtY29udHJhY3QiLCJwYXlsb2FkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNDAwMDAwMDAwMD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AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAzNTQ1MzU0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=", - "funds": [] - } - } - }, - "gas_limit": null, - "reply_on": "never" - } - ], "attributes": [], + "data": null, "events": [ { - "type": "message_received", "attributes": [ { "key": "cc_id", - "value": "source-its-chain_message-id" + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "dest-its-chain" - }, - { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" + "value": "\"dest-its-chain\"" }, { - "key": "name", - "value": "Test" - }, - { - "key": "symbol", - "value": "TST" - }, - { - "key": "decimals", - "value": "6" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"Test\",\"symbol\":\"TST\",\"decimals\":6,\"minter\":null}}" } - ] + ], + "type": "message_received" } ], - "data": null + "messages": [ + { + "gas_limit": null, + "id": 0, + "msg": { + "wasm": { + "execute": { + "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", + "funds": [], + "msg": "eyJjYWxsX2NvbnRyYWN0Ijp7ImRlc3RpbmF0aW9uX2NoYWluIjoiZGVzdC1pdHMtY2hhaW4iLCJkZXN0aW5hdGlvbl9hZGRyZXNzIjoiZGVzdC1pdHMtY29udHJhY3Q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MDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNDU0NjU3Mzc0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAzNTQ1MzU0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=" + } + } + }, + "payload": "", + "reply_on": "never" + } + ] }, "source_token_instance": { - "supply": "untracked", - "decimals": 18 - }, - "destination_token_instance": { - "supply": { - "tracked": "0" - }, - "decimals": 6 + "decimals": 18, + "supply": "untracked" } } \ No newline at end of file diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_the_same.golden b/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_the_same.golden index ad655f7ca..ffd21157c 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_the_same.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_message_deploy_interchain_token_should_translate_decimals_when_max_uints_are_the_same.golden @@ -1,68 +1,52 @@ { + "destination_token_instance": { + "decimals": 18, + "supply": { + "tracked": "0" + } + }, "response": { - "messages": [ - { - "id": 0, - "payload": "", - "msg": { - "wasm": { - "execute": { - "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", - "msg": "eyJ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AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTIwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNDU0NjU3Mzc0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAzNTQ1MzU0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=", - "funds": [] - } - } - }, - "gas_limit": null, - "reply_on": "never" - } - ], "attributes": [], + "data": null, "events": [ { - "type": "message_received", "attributes": [ { "key": "cc_id", - "value": "source-its-chain_message-id" + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "dest-its-chain" - }, - { - "key": "message_type", - "value": "DeployInterchainToken" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" + "value": "\"dest-its-chain\"" }, { - "key": "name", - "value": "Test" - }, - { - "key": "symbol", - "value": "TST" - }, - { - "key": "decimals", - "value": "18" + "key": "message", + "value": "{\"deploy_interchain_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"name\":\"Test\",\"symbol\":\"TST\",\"decimals\":18,\"minter\":null}}" } - ] + ], + "type": "message_received" } ], - "data": null + "messages": [ + { +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wMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTIwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNDU0NjU3Mzc0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAzNTQ1MzU0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=" + } + } + }, + "payload": "", + "reply_on": "never" + } + ] }, "source_token_instance": { - "supply": "untracked", - "decimals": 18 - }, - "destination_token_instance": { - "supply": { - "tracked": "0" - }, - "decimals": 18 + "decimals": 18, + "supply": "untracked" } } \ No newline at end of file diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle.golden b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle.golden index d447fafab..30eb053d0 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle.golden @@ -23,31 +23,15 @@ "attributes": [ { "key": "cc_id", - "value": "sui_message-id" + "value": "{\"source_chain\":\"sui\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "ethereum" + "value": "\"ethereum\"" }, { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0202020202020202020202020202020202020202020202020202020202020202" - }, - { - "key": "destination_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "amount", - "value": "1000000000000000000" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"destination_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"amount\":\"1000000000000000000\",\"data\":null}}" } ] } diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle_with_dust.golden b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle_with_dust.golden index d447fafab..30eb053d0 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle_with_dust.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_correctly_in_3_chain_cycle_with_dust.golden @@ -23,31 +23,15 @@ "attributes": [ { "key": "cc_id", - "value": "sui_message-id" + "value": "{\"source_chain\":\"sui\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "ethereum" + "value": "\"ethereum\"" }, { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0202020202020202020202020202020202020202020202020202020202020202" - }, - { - "key": "destination_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "amount", - "value": "1000000000000000000" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"destination_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"amount\":\"1000000000000000000\",\"data\":null}}" } ] } diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_custom_tokens_when_decimals_are_different.golden b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_custom_tokens_when_decimals_are_different.golden new file mode 100644 index 000000000..24c30349c --- /dev/null +++ b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_custom_tokens_when_decimals_are_different.golden @@ -0,0 +1,170 @@ +{ + "destination_register_token_response": { + "attributes": [], + "data": null, + "events": [ + { + "attributes": [ + { + "key": "source_chain", + "value": "\"dest-its-chain\"" + }, + { + "key": "token_address", + "value": "\"0101010101010101010101010101010101010101010101010101010101010101\"" + }, + { + "key": "decimals", + "value": "18" + } + ], + "type": "token_metadata_registered" + } + ], + "messages": [] + }, + "link_token_response": { + "attributes": [], + "data": null, + "events": [ + { + "attributes": [ + { + "key": "cc_id", + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" + }, + { + "key": "destination_chain", + "value": "\"dest-its-chain\"" + }, + { + "key": "message", + "value": "{\"link_token\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"token_manager_type\":\"0\",\"source_token_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_token_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"params\":null}}" + } + ], + "type": "message_received" + } + ], + "messages": [ + { + "gas_limit": null, + "id": 0, + "msg": { + "wasm": { + "execute": { + "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", + "funds": [], + "msg": "eyJjYWxsX2Nvbn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DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDIwMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=" + } + } + }, + "payload": "", + "reply_on": "never" + } + ] + }, + "response_to_destination": { + "attributes": [], + "data": null, + "events": [ + { + "attributes": [ + { + "key": "cc_id", + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" + }, + { + "key": "destination_chain", + "value": "\"dest-its-chain\"" + }, + { + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"amount\":\"1000000000000000000\",\"data\":null}}" + } + ], + "type": "message_received" + } + ], + "messages": [ + { + "gas_limit": null, + "id": 0, + "msg": { + "wasm": { + "execute": { + "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", + "funds": [], + "msg": "eyJjYWxsX2N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AwMDAwMDAwMDAwMDAwMDAwMDBkZTBiNmIzYTc2NDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDIwMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=" + } + } + }, + "payload": "", + "reply_on": "never" + } + ] + }, + "response_to_source": { + "attributes": [], + "data": null, + "events": [ + { + "attributes": [ + { + "key": "cc_id", + "value": "{\"source_chain\":\"dest-its-chain\",\"message_id\":\"message-id\"}" + }, + { + "key": "destination_chain", + "value": "\"source-its-chain\"" + }, + { + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"destination_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"amount\":\"1000000\",\"data\":null}}" + } + ], + "type": "message_received" + } + ], + "messages": [ + { + "gas_limit": null, + "id": 0, + "msg": { + "wasm": { + "execute": { + "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", + "funds": [], + "msg": "eyJjYWxsX2Nvb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AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGY0MjQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE0MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMjAwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIn19" + } + } + }, + "payload": "", + "reply_on": "never" + } + ] + }, + "source_register_token_response": { + "attributes": [], + "data": null, + "events": [ + { + "attributes": [ + { + "key": "source_chain", + "value": "\"source-its-chain\"" + }, + { + "key": "token_address", + "value": "\"0101010101010101010101010101010101010101010101010101010101010101\"" + }, + { + "key": "decimals", + "value": "6" + } + ], + "type": "token_metadata_registered" + } + ], + "messages": [] + } +} \ No newline at end of file diff --git a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_the_amount_when_source_decimals_are_different.golden b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_the_amount_when_source_decimals_are_different.golden index a290957e7..5d5515636 100644 --- a/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_the_amount_when_source_decimals_are_different.golden +++ b/contracts/interchain-token-service/tests/testdata/execute_message_interchain_transfer_should_scale_the_amount_when_source_decimals_are_different.golden @@ -1,114 +1,82 @@ { "response_to_destination": { - "messages": [ - { - "id": 0, - "payload": "", - "msg": { - "wasm": { - "execute": { - "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", - "msg": "eyJjYWxsX2NvbnRyYWN0Ijp7ImRlc3RpbmF0aW9uX2NoYWluIjoiZGVzdC1pdHMtY2hhaW4iLCJkZXN0aW5hdGlvbl9hZGRyZXNzIjoiZGVzdC1pdHMtY29udHJhY3QiLCJwYXlsb2FkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwNjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDczNmY3NTcyNjM2NTJkNjk3NDczMmQ2MzY4NjE2OTZlMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGMwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwZjQyNDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDIwMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=", - "funds": [] - } - } - }, - "gas_limit": null, - "reply_on": "never" - } - ], "attributes": [], + "data": null, "events": [ { - "type": "message_received", "attributes": [ { "key": "cc_id", - "value": "source-its-chain_message-id" + "value": "{\"source_chain\":\"source-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "dest-its-chain" - }, - { - "key": "message_type", - "value": "InterchainTransfer" - }, - { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" + "value": "\"dest-its-chain\"" }, { - "key": "destination_address", - "value": "0202020202020202020202020202020202020202020202020202020202020202" - }, - { - "key": "amount", - "value": "1000000" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"destination_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"amount\":\"1000000\",\"data\":null}}" } - ] + ], + "type": "message_received" } ], - "data": null - }, - "response_to_source": { "messages": [ { + "gas_limit": null, "id": 0, - "payload": "", "msg": { "wasm": { "execute": { "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", - "msg": "eyJjYWxsX2NvbnRyYWN0Ijp7ImRlc3RpbmF0aW9uX2NoYWluIjoic291cmNlLWl0cy1jaGFpbiIsImRlc3RpbmF0aW9uX2FkZHJlc3MiOiJzb3VyY2UtaXRzLWNvbnRyYWN0IiwicGF5bG9hZCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDBhMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGU2NDY1NzM3NDJkNjk3NDczMmQ2MzY4NjE2OTZlMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE2MDAwMDAwMDAwMDAwMDA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AwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAyMDAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDIwMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifX0=" } } }, - "gas_limit": null, + "payload": "", "reply_on": "never" } - ], + ] + }, + "response_to_source": { "attributes": [], + "data": null, "events": [ { - "type": "message_received", "attributes": [ { "key": "cc_id", - "value": "dest-its-chain_message-id" + "value": "{\"source_chain\":\"dest-its-chain\",\"message_id\":\"message-id\"}" }, { "key": "destination_chain", - "value": "source-its-chain" - }, - { - "key": "message_type", - "value": "InterchainTransfer" + "value": "\"source-its-chain\"" }, { - "key": "token_id", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "source_address", - "value": "0202020202020202020202020202020202020202020202020202020202020202" - }, - { - "key": "destination_address", - "value": "0101010101010101010101010101010101010101010101010101010101010101" - }, - { - "key": "amount", - "value": "1000000000000000000" + "key": "message", + "value": "{\"interchain_transfer\":{\"token_id\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"source_address\":\"0202020202020202020202020202020202020202020202020202020202020202\",\"destination_address\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"amount\":\"1000000000000000000\",\"data\":null}}" } - ] + ], + "type": "message_received" } ], - "data": null + "messages": [ + { + "gas_limit": null, + "id": 0, + "msg": { + "wasm": { + "execute": { + "contract_addr": "cosmwasm1f6j7u6875p2cvyrgjr0d2uecyzah0kgeek38h39czwdhe5em3zys78pcnl", + "funds": [], + "msg": "eyJjYWxsX2NvbnRyYWN0Ijp7ImRlc3RpbmF0aW9uX2NoYWluIjoic291cmNlLWl0cy1jaGFpbiIsImRlc3RpbmF0aW9uX2FkZHJlc3MiOiJzb3VyY2UtaXRzLWNvbnRyYWN0IiwicGF5bG9hZCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDYwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDBhMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMGU2NDY1NzM3NDJkNjk3NDczMmQ2MzY4NjE2OTZlMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDE2MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD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