The Cost of Parachain Auctions
Polkadot and Kusama’s parachain slot auctions require parachains to “spend” a large amount of DOT or KSM in order to get a slot. This DOT or KSM will eventually be returned after the length of the lease, so the real cost of the auction comes in 2 forms:
- the opportunity cost
- the liquidity of the bonded DOT/KSM.
Given the large amount of DOT/KSM that’s needed to secure a slot, parachains often need to garner community support in order to win a lease on the relay chain for up to 96 weeks. This means that community members must bind their DOT/KSM to the chain that they are supporting in order to support these parachains. In exchange for the loss of the opportunity cost of their DOT/KSM, community members often receive the native token from the parachains they support. However, while this crowdloan reward from parachains compensates the community members for the opportunity cost, it does not fix the liquidity problem for community members.
Enter: Bifrost SALP
In an attempt to fix this liquidity problem, Bifrost (BNC), a parachain on the DOT/KSM network, has built a liquidity protocol called SALP (Slot Auction Liquidity Protocol). SALP fixes this liquidity problem because it returns 2 tokens back to the user in exchange for the DOT/KSM, which it contributes to the relay chain on the user’s behalf. These two tokens are called vsToken and vsBond. In order to get the contributed DOT/KSM back, the user must have both tokens to get back the original relay chain token that was contributed for the crowdloan.
vsToken
The vsToken is a fungible token, minted 1-to-1 for each DOT/KSM contributed. This is the liquidity token, which can be traded and transferred anytime, just like normal tokens.
This can be checked via a query of the chain state. The above photo shows an example of how to query for the number of vsTokens in your wallet.
Similarly, this can be done via code.
async function getvsToken(KSMaddress: string) {
const wsProvider = new WsProvider(
`wss://bifrost-rpc.devnet.liebi.com/ws`
);
const polkadotApi = await ApiPromise.create(
{ provider: wsProvider }
);
const currencyId = { vsToken: 'ksm' }
await polkadotApi.query.tokens.accounts(
KSMaddress,
currencyId,
(balance) => {
console.log("balance.free: ", balance.free.toString())
}
);
}
vsBond
The vsBond is a semi-fungible token, also minted 1-to-1 for each DOT/KSM contributed. vsBonds represent the different lease periods of different parachains.
This can be checked via a query of the chain state. The above photo shows an example of how to query for the number of vsBonds in your wallet. Please note that since vsBonds represent the different lease periods of different parachains, after the coin name, you must enter the parachain ID, first slot of auction and last slot of auction, respectively, in the 3 fields. In this example, it would be parachain ID 2090 that was contributed to during a crowdloan that for one of the slots between 15 and 22.
Similarly, this can be achieved through code as well.
async function getvsBonds(KSMaddress: string) {
const wsProvider = new WsProvider(
`wss://bifrost-rpc.devnet.liebi.com/ws`
);
const polkadotApi = await ApiPromise.create(
{ provider: wsProvider }
);
const currencyId = { vsBond: ['ksm', 2090, 15, 22] }
await polkadotApi.query.tokens.accounts(
KSMaddress,
currencyId,
(balance) => {
console.log("balance.free: ", balance.free.toString())
}
);
}
SALP Steps
SALP works through XCM (Cross Consensus Message Format), where relay chain tokens are sent cross chain to different chains on the Polkadot/Kusama multichain. These steps are only compatible with SALP-KSM. This is not yet available for DOT. There are roughly 3 steps in this process:
- Send KSM from the relaychain to the Bifrost chain. The relay chain currency is NOT converted to Bifrost tokens. The relay chain currency is directly sent to the chain. This is accomplished by DMP. This can be accomplished as an extrinsic on the relay chain, whether via Polkadot JS or through code.
xcmPallet.reserverTransferAssets call parameters part 1
xcmPallet.reserverTransferAssets call parameters part 2
async sendKSMtoBifrost(
parachainID: number,
amount: number,
address: string,
): Promise<`0x${string}`> {
const paras = [
{
V1: {
parents: 0,
interior: {
X1: {
Parachain: parachainID,
},
},
},
},
{
V1: {
parents: 0,
interior: {
X1: {
AccountId32: {
network: 'Any',
id: u8aToHex(decodeAddress(address)),
},
},
},
},
},
{
V1: [{
id: {
Concrete: {
parents: 0,
interior: 'Here',
},
},
fun: {
Fungible: amount,
},
}],
},
0,
];
const injector = await web3FromAddress(address);
const polkadotApi = await this.getAPIClient()
const extrinsic =
polkadotApi.tx.xcmPallet.reserveTransferAssets(...paras);
const signedExtrinsic = await extrinsic.signAsync(
address,
{ signer: injector.signer }
);
return signedExtrinsic.send()
}
2. Send KSM from Bifrost back to the relay chain, but send it back as a SALP contribution, which has been coded by Bifrost on the Bifrost chain as a pallet. This will be an extrinsic. This is accomplished by UMP.
async bifrostContribute(address: string) {
const injector = await web3FromAddress(address);
const polkadotApi = await this.getAPIClient();
const extrinsic =
polkadotApi.tx.salp.contribute(2090, 1000000000000);
const signedExtrinsic = await extrinsic.signAsync(
address,
{ signer: injector.signer }
);
return signedExtrinsic.send()
}
3. Bifrost’s blockchain sends the SALP contribution over to the relay chain as a crowdloan contribution. There is no work here, as Bifrost will handle this interaction. However, since the contribution will be coming from Bifrost, the parachain using Bifrost will need to keep track of the reward statuses of the users, since the users’ accounts will not be reflected on the crowdloan status on the relay chain. Furthermore, once SALP contribution finalizes, vsTokens and vsBonds will then be deposited in user address on the Bifrost chain. The user will be able to check via a chain state call, as shown earlier in the article, or alternatively through the Bifrost app.
Setup
In order for SALP to work, you must work with Bifrost and submit a proposal for the use of SALP during a crowdloan. The recommendation is to leave at least 9 days prior to crowdloan to get the proposal through the crowdloan. You can find more detailed instructions on Bifrost’s documentation.
About Ava Protocol
Ava Protocol is an intent-based Eigenlayer AVS that seamlessly enables private autonomous transactions for numerous use cases, such as DeFi, NFTs, and games. We're enhancing decentralized applications with scheduled and recurring payments, stop-loss orders, streaming rewards, and more. Ava Protocol’s event-driven execution model triggers cross-chain transactions based on signals such as time, price changes, and smart contract updates. Developers can easily schedule and automate functions across different blockchains, including Ethereum, ensuring efficient and reliable execution without compromising privacy.
About Ava Protocol
Ava Protocol is an intent-based infrastructure that empowers private autonomous transactions for Ethereum and beyond.