Skip to content

Commit

Permalink
fix manta (#1115)
Browse files Browse the repository at this point in the history
* fix manta

* remove println
  • Loading branch information
herryho authored Dec 25, 2023
1 parent 0245e5e commit 1eab81e
Show file tree
Hide file tree
Showing 6 changed files with 1,965 additions and 6 deletions.
1 change: 1 addition & 0 deletions pallets/slp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ std = [
"bifrost-vtoken-minting/std",
"bifrost-asset-registry/std",
"bifrost-parachain-staking/std",
"orml-xtokens/std",
]

runtime-benchmarks = [
Expand Down
2 changes: 1 addition & 1 deletion pallets/slp/src/agents/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<T: Config> Pallet<T> {

// call_as_subaccount = Utility(Box::new(AsDerivative(sub_account_index, Box::new(call))));
let utility_call: u8 = match currency_id {
MANTA => 10,
MANTA => 40,
MOVR | GLMR => 30,
ASTR => 11,
PHA => 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,27 @@ pub enum MantaUtilityCall<MantaCall> {
#[derive(Encode, Decode, RuntimeDebug, Clone)]
pub enum MantaParachainStakingCall<T: Config> {
#[codec(index = 18)]
Delegate(T::AccountId, BalanceOf<T>, u32, u32),
Delegate(
T::AccountId,
#[codec(compact)] BalanceOf<T>,
#[codec(compact)] u32,
#[codec(compact)] u32,
),
// schedule_revoke_delegation
#[codec(index = 19)]
ScheduleLeaveDelegators,
// execute_delegation_request
#[codec(index = 20)]
ExecuteLeaveDelegators(T::AccountId, u32),
ExecuteLeaveDelegators(T::AccountId, #[codec(compact)] u32),
// cancel_delegation_request
#[codec(index = 21)]
CancelLeaveDelegators,
#[codec(index = 22)]
ScheduleRevokeDelegation(T::AccountId),
#[codec(index = 23)]
DelegatorBondMore(T::AccountId, BalanceOf<T>),
DelegatorBondMore(T::AccountId, #[codec(compact)] BalanceOf<T>),
#[codec(index = 24)]
ScheduleDelegatorBondLess(T::AccountId, BalanceOf<T>),
ScheduleDelegatorBondLess(T::AccountId, #[codec(compact)] BalanceOf<T>),
#[codec(index = 25)]
ExecuteDelegationRequest(T::AccountId, T::AccountId),
#[codec(index = 26)]
Expand Down
31 changes: 30 additions & 1 deletion pallets/slp/src/mocks/mock_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate as bifrost_slp;
use crate::{Config, DispatchResult, QueryResponseManager};
use bifrost_asset_registry::AssetIdMaps;
use bifrost_primitives::{
currency::{BNC, KSM, VKSM},
currency::{BNC, KSM, MANTA, VKSM},
Amount, Balance, CurrencyId, DoNothingExecuteXcm, DoNothingRouter, SlpxOperator, TokenSymbol,
XcmDestWeightAndFeeHandler, XcmOperationType,
};
Expand Down Expand Up @@ -369,6 +369,34 @@ impl Convert<(u16, CurrencyId), MultiLocation> for SubAccountIndexMultiLocationC
.into(),
}),
),
MANTA => {
// get parachain id
if let Some(location) = BifrostCurrencyIdConvert::convert(currency_id) {
if let Some(Parachain(para_id)) = location.interior().first() {
MultiLocation::new(
1,
X2(
Parachain(*para_id),
Junction::AccountId32 {
network: None,
id: Self::derivative_account_id(
polkadot_parachain_primitives::primitives::Sibling::from(
2030u32,
)
.into_account_truncating(),
sub_account_index,
)
.into(),
},
),
)
} else {
MultiLocation::default()
}
} else {
MultiLocation::default()
}
},
// Other sibling chains use the Bifrost para account with "sibl"
_ => {
// get parachain id
Expand Down Expand Up @@ -438,6 +466,7 @@ impl Convert<CurrencyId, Option<MultiLocation>> for BifrostCurrencyIdConvert {
X1(Junction::from(BoundedVec::try_from("0x0001".encode()).unwrap())),
)),
Token(PHA) => Some(MultiLocation::new(1, X1(Parachain(2004)))),
MANTA => Some(MultiLocation::new(1, X1(Parachain(2104)))),
_ => None,
}
}
Expand Down
Loading

0 comments on commit 1eab81e

Please sign in to comment.