Liquid Crowdloan
Cross-chain transact from Kusama to Bifrost (Contributors have to cross their KSM to Bifrost for using SALP)
api.tx.polkadotXcm.execute
Example
1
const theAmount = new BigNumber(amount).multipliedBy(new BigNumber(1000000000000)).toFixed();
2
const paras = [
3
{
4
X1: { Parachain: getEnvs().PARACHAIN_ID },
5
},
6
{
7
X1: {
8
AccountId32: {
9
network: {
10
Any: null,
11
},
12
id: sender,
13
},
14
},
15
},
16
[
17
{
18
ConcreteFungible: {
19
id: {
20
Null: null,
21
},
22
amount: theAmount,
23
},
24
},
25
],
26
3000000,
27
];
28
const transferHandle = await api.tx.xcmPallet.reserveTransferAssets(...paras);
29
const info = await api.tx.xcmPallet.reserveTransferAssets(...paras).paymentInfo(sender);
Cross-chain transact from Bifrost to Kusama (for users who want to transfer KSM back to the relay-chain)
api.tx.polkadotXcm.execute
Example
1
const theAmount = new BigNumber(amount).multipliedBy(new BigNumber(1000000000000)).toString();
2
const paras = [
3
{
4
WithdrawAsset: {
5
assets: [
6
{
7
ConcreteFungible: {
8
id: {
9
X1: {
10
Parent: null,
11
},
12
},
13
amount: theAmount,
14
},
15
},
16
],
17
effects: [
18
{
19
BuyExecution: {
20
fees: {
21
All: null,
22
},
23
weight: 0,
24
debt: 3000000000,
25
haltOnError: false,
26
xcm: [],
27
},
28
},
29
{
30
InitiateReserveWithdraw: {
31
assets: [
32
{
33
All: null,
34
},
35
],
36
reserve: {
37
X1: {
38
Parent: null,
39
},
40
},
41
effects: [
42
{
43
BuyExecution: {
44
fees: {
45
All: null,
46
},
47
weight: 0,
48
debt: 3000000000,
49
haltOnError: false,
50
xcm: [],
51
},
52
},
53
{
54
DepositAsset: {
55
assets: [
56
{
57
All: null,
58
},
59
],
60
dest: {
61
X1: {
62
AccountId32: {
63
network: {
64
Any: null,
65
},
66
id: receiver,
67
},
68
},
69
},
70
},
71
},
72
],
73
},
74
},
75
],
76
},
77
},
78
3000000000,
79
];
80
const transferHandle = await api.tx.polkadotXcm.execute(...paras);
81
const info = await api.tx.polkadotXcm.execute(...paras).paymentInfo(sender);
Bifrost call Contribute
api.tx.salp.contribute
- Authentication: User’s signature address
- Parameter:
index: ParaId; //Contribute to a paraid
value: Balance; //The amount of contribution
- Description: The user calls this function to contribute to a
fund
(ongoing).
Example
1
const keyring = new Keyring({type: 'sr25519'});
2
3
const provider = new WsProvider(BIFROST_END_POINT);
4
const api = await ApiPromise.create(options({provider: provider}));
5
6
const sudo = keyring.addFromUri(BIFROST_SUDO_PHRASE);
7
8
const extrinsic = api.tx.salp.contribute(PARA_ID, BALANCE);
9
const ext_hash = await extrinsic.signAndSend(sudo);
Parachain auciton fail, call refund function manually
api.tx.salp.refund
- Authentication: User’s signature address
- Parameter:
index: ParaId; //The paraId needs to refund
- Description: When the
fund
fails and the funds have been withdrawable, the user can redeem the contributed funds with the lockedvsToken/vsBond
.

Example
Call the redeem function when parachain fund retired.
api.tx.salp.redeem
- Authentication: User’s signature address
- Parameter:
index: ParaId; //vsbond Parameter: paraId
value: Balance; //redeem amount
- Description: When the user holds the
vsbond
that reaches the redemption period, the combination ofvsbond
+vsToken
can be used to redeem the underlaying KSM, which will be sent to the user’s address on relay chain.

Example
Query for Bifrost Assets
api.query.tokens.accounts
- Parameter:
0: AccountId; //query the address
1: CurrencyId; //type of assets
- Description: Query an address’s assets amount.
Query vsKSM,vsBond total issuance
api.query.tokens.totalIssuance
- Parameter:
0: CurrencyId; //type of assets
- Description: Query assets amount of a paraId.
Query a specific fund info
api.query.salp.funds
- Parameter:
0: ParaId; //Parachain ID
- Description: Query the fund info of a paraId.
Query the contribution info of a user
curl http://localhost:29999 -H "Content-Type:application/json;charset=utf-8" -d '{"jsonrpc":"2.0","id":1,"method":"salp_getContribution","params": [2001, "Hsjp321vR7quo4ETVyuUFbrJMddW7K7qPndtxCZHzY1CCHA"]}'
- aParameter:
0: ParaId; //Parachain ID
1: AccountId; //ss58 account address
- Description: Query the contribution info of an user.
salp_contributed
- Graphql API
- Parameter:
account; //ss58 bifrost account address
para_id; //ParaId
- Description:Query the contribution details of a certain ParaId/or the contribution details of a certain user address. (Deleting
account
means to query all the contribution details of a ParaId.)
Example
1
query {
2
salp_contributed(
3
account:"ftEXBzn7nKfUsoDRtw39AUMGdwQY37SMPuC6HEXkPmN1cvf",
4
para_id:"2088"
5
){
6
para_id
7
balance
8
account
9
block_timestamp
10
block_height
11
}
12
}
Last modified 2mo ago