Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Batch rename token command
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Aug 30, 2024
1 parent 39a84b9 commit 5ae8b0b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/outbound-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ pub mod pallet {
Tokens::<T>::insert(token_id, asset_loc.clone());
LocationToToken::<T>::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(),
Expand Down
26 changes: 13 additions & 13 deletions bridges/snowbridge/primitives/core/src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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,
}
}

Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/primitives/router/src/outbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))
}
Expand Down Expand Up @@ -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,
))
}
Expand Down
10 changes: 5 additions & 5 deletions bridges/snowbridge/primitives/router/src/outbound/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ fn xcm_converter_convert_success() {
.into();
let mut converter =
XcmConverter::<MockTokenIdConvert, ()>::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(),
Expand Down Expand Up @@ -459,7 +459,7 @@ fn xcm_converter_convert_without_buy_execution_yields_success() {
.into();
let mut converter =
XcmConverter::<MockTokenIdConvert, ()>::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(),
Expand Down Expand Up @@ -496,7 +496,7 @@ fn xcm_converter_convert_with_wildcard_all_asset_filter_succeeds() {
.into();
let mut converter =
XcmConverter::<MockTokenIdConvert, ()>::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(),
Expand Down Expand Up @@ -533,7 +533,7 @@ fn xcm_converter_convert_with_fees_less_than_reserve_yields_success() {
.into();
let mut converter =
XcmConverter::<MockTokenIdConvert, ()>::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(),
Expand Down Expand Up @@ -1120,7 +1120,7 @@ fn xcm_converter_transfer_native_token_success() {
.into();
let mut converter =
XcmConverter::<MockTokenIdConvert, ()>::new(&message, network, Default::default());
let expected_payload = Command::TransferNativeToken {
let expected_payload = Command::MintForeignToken {
agent_id: Default::default(),
recipient: beneficiary_address.into(),
amount,
Expand Down

0 comments on commit 5ae8b0b

Please sign in to comment.