Searchโ€ฆ
SALP Contribution & Confirmation

SALP Contribution & Confirmation Workflow

Step 1: Users use XMP-DMP cross-in their KSM to Bifrost Parachian.
Step 2: Users call the SALP-contribute to a Crowdloan, the contribution will be executed by XCM-UMP transact.
Step 3: Subql Multisig nodes comfrim the contributed events on Kusama Relay chain, and send the result back to Bifrost parachain.
Step 4: Bifrost SALP receive the result, issue/or not issue derivatives vsKSM & vsBond for users.

Contribute-UMP Transact

Crowdloan contribution is proxy called by Bifrost Parachain account with UMP Transact

Encode Call

1
#[derive(Encode, Decode)]
2
pub enum CrowdloanContributeCall<BalanceOf> {
3
#[codec(index = 73)]
4
CrowdloanContribute(ContributeCall<BalanceOf>),
5
}
6
โ€‹
7
#[derive(Encode, Decode)]
8
pub enum ContributeCall<BalanceOf> {
9
#[codec(index = 1)]
10
Contribute(Contribution<BalanceOf>),
11
}
12
โ€‹
13
#[derive(Debug, PartialEq, Encode, Decode)]
14
pub struct Contribution<BalanceOf> {
15
#[codec(compact)]
16
pub index: ParaId,
17
#[codec(compact)]
18
pub value: BalanceOf,
19
pub signature: Option<MultiSignature>,
20
}
Copied!
1
let call = CrowdloanContributeCall::CrowdloanContribute(
2
ContributeCall::Contribute(Contribution { index, value, signature: None }),
3
)
4
.encode()
5
.into();
Copied!

Construct Transact

1
let message = Xcm::WithdrawAsset {
2
assets: vec![MultiAsset::ConcreteFungible {
3
id: MultiLocation::Null,
4
amount: WeightToFee::calc(transact_weight+transact_debt)),
5
}],
6
effects: vec![Order::BuyExecution {
7
fees: MultiAsset::All,
8
weight: transact_weight,
9
debt: transact_debt,
10
halt_on_error: true,
11
xcm: vec![Xcm::Transact {
12
origin_type: OriginKind::SovereignAccount,
13
require_weight_at_most: Unlimited,
14
call:call,
15
}],
16
}],
17
};
Copied!

Weight Calculation

Fee Calculation&Compensation

    use weightToFee from relaychain
    extend pallet_transaction_payment with OnChargeTransaction
1
impl pallet_transaction_payment::Config for Runtime {
2
type OnChargeTransaction = FlexibleFee;
3
...
4
}
5
โ€‹
6
T::MiscFeeHandler::deduct_fee(who, &T::TreasuryAccount::get(), call).map_err(
7
|_| TransactionValidityError::Invalid(InvalidTransaction::Custom(77u8)),
8
)?;
9
Copied!

XCM Confirmation

XCM essentially is asynchronous&asymetric and in current XCM version you can not tell if the remote call is successful or not in relaychain. To achieve it we deply salp-confirm-service to confirm the contribution with multisig mechanism
    generate xcm messageId

Challenges&Issues

TODO

    Migrate to V2 and remove confirm-service with fully decentralized Xcm notify&query
โ€‹
Last modified 7d ago