diff --git a/pallets/fee-share/src/mock.rs b/pallets/fee-share/src/mock.rs index 2b623e837..db657f8cb 100644 --- a/pallets/fee-share/src/mock.rs +++ b/pallets/fee-share/src/mock.rs @@ -360,6 +360,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/leverage-staking/src/mock.rs b/pallets/leverage-staking/src/mock.rs index 10cf66967..8f0e1f569 100644 --- a/pallets/leverage-staking/src/mock.rs +++ b/pallets/leverage-staking/src/mock.rs @@ -335,6 +335,7 @@ impl bifrost_vtoken_minting::Config for Test { type MoonbeamParachainId = ConstU32<2023>; type BifrostSlpx = SlpxInterface; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/salp/src/mock.rs b/pallets/salp/src/mock.rs index 4ed23f355..700441f8f 100644 --- a/pallets/salp/src/mock.rs +++ b/pallets/salp/src/mock.rs @@ -450,6 +450,7 @@ impl bifrost_vtoken_minting::Config for Test { type MoonbeamParachainId = ConstU32<2023>; type BifrostSlpx = SlpxInterface; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/slp/src/lib.rs b/pallets/slp/src/lib.rs index ff605918d..999c3688c 100644 --- a/pallets/slp/src/lib.rs +++ b/pallets/slp/src/lib.rs @@ -1253,6 +1253,7 @@ pub mod pallet { RedeemType::Astar(_) | RedeemType::Moonbeam(_) | RedeemType::Hydradx(_) | + RedeemType::Manta(_) | RedeemType::Interlay(_) => break, }; deduct_amount = exit_account_balance; @@ -1324,6 +1325,25 @@ pub mod pallet { Unlimited, )?; }, + RedeemType::Manta(receiver) => { + let dest = MultiLocation { + parents: 1, + interior: X2( + Parachain(T::VtokenMinting::get_manta_parachain_id()), + AccountId32 { + network: None, + id: receiver.encode().try_into().unwrap(), + }, + ), + }; + T::XcmTransfer::transfer( + user_account.clone(), + currency_id, + deduct_amount, + dest, + Unlimited, + )?; + }, RedeemType::Moonbeam(receiver) => { let dest = MultiLocation { parents: 1, diff --git a/pallets/slp/src/mocks/mock.rs b/pallets/slp/src/mocks/mock.rs index d6bb9763d..3519cd97b 100644 --- a/pallets/slp/src/mocks/mock.rs +++ b/pallets/slp/src/mocks/mock.rs @@ -227,6 +227,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/slp/src/mocks/mock_kusama.rs b/pallets/slp/src/mocks/mock_kusama.rs index 14e91fdf0..13d477254 100644 --- a/pallets/slp/src/mocks/mock_kusama.rs +++ b/pallets/slp/src/mocks/mock_kusama.rs @@ -249,6 +249,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/slpx/src/lib.rs b/pallets/slpx/src/lib.rs index d341f8059..821599c3f 100644 --- a/pallets/slpx/src/lib.rs +++ b/pallets/slpx/src/lib.rs @@ -508,6 +508,7 @@ pub mod pallet { TargetChain::Moonbeam(receiver) => RedeemType::Moonbeam(receiver), TargetChain::Hydradx(receiver) => RedeemType::Hydradx(receiver), TargetChain::Interlay(receiver) => RedeemType::Interlay(receiver), + TargetChain::Manta(receiver) => RedeemType::Manta(receiver), }; if vtoken_id == VFIL { @@ -889,10 +890,15 @@ impl Pallet { evm_caller_account_id = evm_contract_account_id.clone(); SupportChain::Interlay }, + TargetChain::Manta(_) => { + evm_caller_account_id = evm_contract_account_id.clone(); + SupportChain::Manta + }, }; match target_chain { TargetChain::Hydradx(_) => {}, + TargetChain::Manta(_) => {}, _ => { let whitelist_account_ids = WhitelistAccountId::::get(&support_chain); ensure!( @@ -967,6 +973,17 @@ impl Pallet { T::XcmTransfer::transfer(caller, currency_id, amount, dest, Unlimited)?; }, + TargetChain::Manta(receiver) => { + let dest = MultiLocation { + parents: 1, + interior: X2( + Parachain(T::VtokenMintingInterface::get_manta_parachain_id()), + AccountId32 { network: None, id: receiver.encode().try_into().unwrap() }, + ), + }; + + T::XcmTransfer::transfer(caller, currency_id, amount, dest, Unlimited)?; + }, TargetChain::Moonbeam(receiver) => { let dest = MultiLocation { parents: 1, diff --git a/pallets/slpx/src/mock.rs b/pallets/slpx/src/mock.rs index 359dc6270..399d1de6b 100644 --- a/pallets/slpx/src/mock.rs +++ b/pallets/slpx/src/mock.rs @@ -226,6 +226,7 @@ impl bifrost_vtoken_minting::Config for Test { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/slpx/src/types.rs b/pallets/slpx/src/types.rs index da49d71b9..d3f59f5fc 100644 --- a/pallets/slpx/src/types.rs +++ b/pallets/slpx/src/types.rs @@ -48,6 +48,7 @@ pub enum SupportChain { Moonbeam, Hydradx, Interlay, + Manta, } #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)] @@ -56,6 +57,7 @@ pub enum TargetChain { Moonbeam(H160), Hydradx(AccountId), Interlay(AccountId), + Manta(AccountId), } #[derive(Clone, Debug, Eq, PartialEq, Encode, Decode, TypeInfo, MaxEncodedLen)] diff --git a/pallets/stable-pool/src/mock.rs b/pallets/stable-pool/src/mock.rs index 3a94ae690..133775d15 100644 --- a/pallets/stable-pool/src/mock.rs +++ b/pallets/stable-pool/src/mock.rs @@ -315,6 +315,7 @@ impl bifrost_vtoken_minting::Config for Test { type MoonbeamParachainId = ConstU32<2023>; type BifrostSlpx = SlpxInterface; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/system-maker/src/mock.rs b/pallets/system-maker/src/mock.rs index 5478489be..f9bcf9662 100644 --- a/pallets/system-maker/src/mock.rs +++ b/pallets/system-maker/src/mock.rs @@ -367,6 +367,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/system-staking/src/mock.rs b/pallets/system-staking/src/mock.rs index b7d36d752..07d0dcea9 100644 --- a/pallets/system-staking/src/mock.rs +++ b/pallets/system-staking/src/mock.rs @@ -217,6 +217,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/ve-minting/src/mock.rs b/pallets/ve-minting/src/mock.rs index f26ddf6b6..c0bb5b044 100644 --- a/pallets/ve-minting/src/mock.rs +++ b/pallets/ve-minting/src/mock.rs @@ -240,6 +240,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/pallets/vtoken-minting/src/lib.rs b/pallets/vtoken-minting/src/lib.rs index dccd5eb0a..b90c16fa3 100644 --- a/pallets/vtoken-minting/src/lib.rs +++ b/pallets/vtoken-minting/src/lib.rs @@ -129,6 +129,9 @@ pub mod pallet { #[pallet::constant] type InterlayParachainId: Get; + #[pallet::constant] + type MantaParachainId: Get; + type BifrostSlp: SlpOperator; type BifrostSlpx: SlpxOperator>; @@ -1034,6 +1037,25 @@ pub mod pallet { Unlimited, )?; }, + RedeemType::Manta(receiver) => { + let dest = MultiLocation { + parents: 1, + interior: X2( + Parachain(T::MantaParachainId::get()), + AccountId32 { + network: None, + id: receiver.encode().try_into().unwrap(), + }, + ), + }; + T::XcmTransfer::transfer( + account.clone(), + token_id, + unlock_amount, + dest, + Unlimited, + )?; + }, RedeemType::Moonbeam(receiver) => { let dest = MultiLocation { parents: 1, @@ -1071,6 +1093,7 @@ pub mod pallet { RedeemType::Astar(_) | RedeemType::Moonbeam(_) | RedeemType::Hydradx(_) | + RedeemType::Manta(_) | RedeemType::Interlay(_) => { return Ok(()); }, @@ -1648,6 +1671,9 @@ impl VtokenMintingOperator, AccountIdOf, fn get_interlay_parachain_id() -> u32 { T::InterlayParachainId::get() } + fn get_manta_parachain_id() -> u32 { + T::MantaParachainId::get() + } } impl VtokenMintingInterface, CurrencyIdOf, BalanceOf> @@ -1724,6 +1750,9 @@ impl VtokenMintingInterface, CurrencyIdOf, BalanceO fn get_interlay_parachain_id() -> u32 { T::InterlayParachainId::get() } + fn get_manta_parachain_id() -> u32 { + T::MantaParachainId::get() + } } impl VTokenSupplyProvider, BalanceOf> for Pallet { diff --git a/pallets/vtoken-minting/src/mock.rs b/pallets/vtoken-minting/src/mock.rs index 47ef313a9..fab99b559 100644 --- a/pallets/vtoken-minting/src/mock.rs +++ b/pallets/vtoken-minting/src/mock.rs @@ -245,6 +245,7 @@ impl vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = (); } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 2fe618d20..dcf7710f2 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -240,6 +240,8 @@ pub enum RedeemType { Hydradx(AccountId), /// Interlay chain. Interlay(AccountId), + /// Manta chain. + Manta(AccountId), } impl Default for RedeemType { diff --git a/primitives/src/traits.rs b/primitives/src/traits.rs index c5a2f9c46..222d35955 100644 --- a/primitives/src/traits.rs +++ b/primitives/src/traits.rs @@ -149,6 +149,7 @@ pub trait VtokenMintingOperator { fn get_moonbeam_parachain_id() -> u32; fn get_hydradx_parachain_id() -> u32; fn get_interlay_parachain_id() -> u32; + fn get_manta_parachain_id() -> u32; } /// Trait for Vtoken-Minting module to check whether accept redeeming or not. @@ -348,6 +349,7 @@ pub trait VtokenMintingInterface { fn get_moonbeam_parachain_id() -> u32; fn get_hydradx_parachain_id() -> u32; fn get_interlay_parachain_id() -> u32; + fn get_manta_parachain_id() -> u32; } impl VtokenMintingInterface @@ -424,6 +426,9 @@ impl VtokenMintingInterface u32 { 0 } + fn get_manta_parachain_id() -> u32 { + 0 + } } pub trait TryConvertFrom { diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index c67d3890d..3d773665b 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1662,6 +1662,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2007>; type MoonbeamParachainId = ConstU32<2023>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2092>; type ChannelCommission = ChannelCommission; } diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 8a4cf1212..f1b2721cc 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -1496,6 +1496,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type AstarParachainId = ConstU32<2006>; type MoonbeamParachainId = ConstU32<2004>; type HydradxParachainId = ConstU32<2034>; + type MantaParachainId = ConstU32<2104>; type InterlayParachainId = ConstU32<2032>; type ChannelCommission = ChannelCommission; }