diff --git a/bridges/snowbridge/pallets/outbound-queue/src/mock.rs b/bridges/snowbridge/pallets/outbound-queue/src/mock.rs index a19e67d3fd6d..0b34893333e4 100644 --- a/bridges/snowbridge/pallets/outbound-queue/src/mock.rs +++ b/bridges/snowbridge/pallets/outbound-queue/src/mock.rs @@ -164,7 +164,7 @@ pub fn mock_message(sibling_para_id: u32) -> Message { Message { id: None, channel_id: ParaId::from(sibling_para_id).into(), - command: Command::TransferToken { + command: Command::TransferNativeToken { agent_id: Default::default(), token: Default::default(), recipient: Default::default(), diff --git a/bridges/snowbridge/pallets/system/src/lib.rs b/bridges/snowbridge/pallets/system/src/lib.rs index 8b7fc8301de1..ecfa47b5e811 100644 --- a/bridges/snowbridge/pallets/system/src/lib.rs +++ b/bridges/snowbridge/pallets/system/src/lib.rs @@ -716,7 +716,7 @@ pub mod pallet { Tokens::::insert(token_id, asset_loc.clone()); LocationToToken::::insert(asset_loc.clone(), token_id); - let command = Command::RegisterNativeToken { + let command = Command::RegisterForeignToken { token_id, name: metadata.name.into_inner(), symbol: metadata.symbol.into_inner(), diff --git a/bridges/snowbridge/primitives/core/src/outbound.rs b/bridges/snowbridge/primitives/core/src/outbound.rs index b689ae537365..201c083d57c6 100644 --- a/bridges/snowbridge/primitives/core/src/outbound.rs +++ b/bridges/snowbridge/primitives/core/src/outbound.rs @@ -140,7 +140,7 @@ mod v1 { multiplier: UD60x18, }, /// Transfer ERC20 tokens - TransferToken { + TransferNativeToken { /// ID of the agent agent_id: H256, /// Address of the ERC20 token @@ -150,8 +150,8 @@ mod v1 { /// The amount of tokens to transfer amount: u128, }, - /// Register token from Polkadot - RegisterNativeToken { + /// Register foreign token from Polkadot + RegisterForeignToken { /// ID for the token token_id: H256, /// Name of the token @@ -161,8 +161,8 @@ mod v1 { /// Number of decimal places decimals: u8, }, - /// Transfer token from Polkadot - TransferNativeToken { + /// Mint foreign token from Polkadot + MintForeignToken { /// ID of the agent agent_id: H256, /// ID for the token @@ -187,9 +187,9 @@ mod v1 { Command::TransferNativeFromAgent { .. } => 6, Command::SetTokenTransferFees { .. } => 7, Command::SetPricingParameters { .. } => 8, - Command::TransferToken { .. } => 9, - Command::RegisterNativeToken { .. } => 10, - Command::TransferNativeToken { .. } => 11, + Command::TransferNativeToken { .. } => 9, + Command::RegisterForeignToken { .. } => 10, + Command::MintForeignToken { .. } => 11, } } @@ -247,21 +247,21 @@ mod v1 { Token::Uint(U256::from(*delivery_cost)), Token::Uint(multiplier.clone().into_inner()), ])]), - Command::TransferToken { agent_id, token, recipient, amount } => + Command::TransferNativeToken { agent_id, token, recipient, amount } => ethabi::encode(&[Token::Tuple(vec![ Token::FixedBytes(agent_id.as_bytes().to_owned()), Token::Address(*token), Token::Address(*recipient), Token::Uint(U256::from(*amount)), ])]), - Command::RegisterNativeToken { token_id, name, symbol, decimals } => + Command::RegisterForeignToken { token_id, name, symbol, decimals } => ethabi::encode(&[Token::Tuple(vec![ Token::FixedBytes(token_id.as_bytes().to_owned()), Token::String(name.to_owned()), Token::String(symbol.to_owned()), Token::Uint(U256::from(*decimals)), ])]), - Command::TransferNativeToken { agent_id, token_id, recipient, amount } => + Command::MintForeignToken { agent_id, token_id, recipient, amount } => ethabi::encode(&[Token::Tuple(vec![ Token::FixedBytes(agent_id.as_bytes().to_owned()), Token::FixedBytes(token_id.as_bytes().to_owned()), @@ -460,9 +460,9 @@ impl GasMeter for ConstantGasMeter { }, Command::SetTokenTransferFees { .. } => 60_000, Command::SetPricingParameters { .. } => 60_000, - Command::TransferToken { .. } => 100_000, - Command::RegisterNativeToken { .. } => 1_200_000, Command::TransferNativeToken { .. } => 100_000, + Command::RegisterForeignToken { .. } => 1_200_000, + Command::MintForeignToken { .. } => 100_000, } } } diff --git a/bridges/snowbridge/primitives/router/src/outbound/mod.rs b/bridges/snowbridge/primitives/router/src/outbound/mod.rs index 0334163b05b5..80e51c5970a0 100644 --- a/bridges/snowbridge/primitives/router/src/outbound/mod.rs +++ b/bridges/snowbridge/primitives/router/src/outbound/mod.rs @@ -295,7 +295,7 @@ where let topic_id = match_expression!(self.next()?, SetTopic(id), id).ok_or(SetTopicExpected)?; Ok(( - Command::TransferToken { agent_id: self.agent_id, token, recipient, amount }, + Command::TransferNativeToken { agent_id: self.agent_id, token, recipient, amount }, *topic_id, )) } @@ -393,7 +393,7 @@ where let topic_id = match_expression!(self.next()?, SetTopic(id), id).ok_or(SetTopicExpected)?; Ok(( - Command::TransferNativeToken { agent_id: self.agent_id, token_id, recipient, amount }, + Command::MintForeignToken { agent_id: self.agent_id, token_id, recipient, amount }, *topic_id, )) } diff --git a/bridges/snowbridge/primitives/router/src/outbound/tests.rs b/bridges/snowbridge/primitives/router/src/outbound/tests.rs index 88c913b9a33f..8814f465c477 100644 --- a/bridges/snowbridge/primitives/router/src/outbound/tests.rs +++ b/bridges/snowbridge/primitives/router/src/outbound/tests.rs @@ -424,7 +424,7 @@ fn xcm_converter_convert_success() { .into(); let mut converter = XcmConverter::::new(&message, network, Default::default()); - let expected_payload = Command::TransferToken { + let expected_payload = Command::TransferNativeToken { agent_id: Default::default(), token: token_address.into(), recipient: beneficiary_address.into(), @@ -459,7 +459,7 @@ fn xcm_converter_convert_without_buy_execution_yields_success() { .into(); let mut converter = XcmConverter::::new(&message, network, Default::default()); - let expected_payload = Command::TransferToken { + let expected_payload = Command::TransferNativeToken { agent_id: Default::default(), token: token_address.into(), recipient: beneficiary_address.into(), @@ -496,7 +496,7 @@ fn xcm_converter_convert_with_wildcard_all_asset_filter_succeeds() { .into(); let mut converter = XcmConverter::::new(&message, network, Default::default()); - let expected_payload = Command::TransferToken { + let expected_payload = Command::TransferNativeToken { agent_id: Default::default(), token: token_address.into(), recipient: beneficiary_address.into(), @@ -533,7 +533,7 @@ fn xcm_converter_convert_with_fees_less_than_reserve_yields_success() { .into(); let mut converter = XcmConverter::::new(&message, network, Default::default()); - let expected_payload = Command::TransferToken { + let expected_payload = Command::TransferNativeToken { agent_id: Default::default(), token: token_address.into(), recipient: beneficiary_address.into(), @@ -1120,7 +1120,7 @@ fn xcm_converter_transfer_native_token_success() { .into(); let mut converter = XcmConverter::::new(&message, network, Default::default()); - let expected_payload = Command::TransferNativeToken { + let expected_payload = Command::MintForeignToken { agent_id: Default::default(), recipient: beneficiary_address.into(), amount,