Overview
Background
The properties of vToken, such as homogeneity, liquidity, and yield bearing, determine that it can satisfy a variety of DeFi usage scenarios. Therefore, vTokenβs cross-chain DeFi interaction scenarios will be the core of expanding XCM use cases. SLPx needs to achieve the following goals:
Support users to mint/redeem vToken on the target chain;
Expand the application of vToken liquidity on the Bifrost chain, support cross-chain Swap and liquidation.
SLPx Pallet will be launched in two versions:
Technical Realization
SLPx mainly consists of two parts, one is the pallet module deployed on Bifrost, and the other is the Solidity contract deployed on the EVM-compatible parachain, which currently supports Astar/Moonbeam/Moonriver.
Logical operation, take Moonbeam vDOT minting as an example:
For cross-chain asset transfer, DOT is sent to the account on the Bifrost chain. This account is used as an asset transfer and logical processing address. Each EVM address corresponds to a Substrate account one by one. For specific conversion logic, refer to Frontier Account Mapping Rules.
Remotely execute the Bifrost SLPx pallet. Here, the address of
msg.sender
, which is the EVM user, will be hard-coded into the calldata of the remote execution of the Bifrost SLPx pallet. At the same time, the address will be obtained when the pallet is executed, so that the Bifrost chain will know Which EVM user is calling,After the Bifrost SLPx pallet logic is processed, the minted vDOT will be sent to the EVM contract caller on Moonbeam
It can be found that there is no mention of who is paying the transaction fee for the remote execution of the Bifrost SLPx pallet. In fact, it has been paid by the derivative address of the SLPx solidity contract in Bifrost. This is mainly for user experience. As long as the user address has DOT and Moonbeam's native Token as the gas fee, vDOT can be minted. In Bifrost, a little DOT will be deducted to make up for the transaction fee of remote execution. As for what Token is charged as the transaction fee depends on what Token is sent.
a. SLPx pallet
The pallet mainly uses token-minting, zenlink swap pallet module interface to complete VToken minting, redemption, swap and other functions on Bifrost.
b. SLPx solidity contract
The contract mainly uses the precompiled contract of the parachain to transfer assets to Bifrost and remotely call the SLPx pallet
SLPx solidity interface: https://github.com/bifrost-finance/slpx-contracts/blob/main/contracts/interfaces/ISlpx.sol
mintVNativeAsset()
payable external: Mint the native Token on the parachain into VTokenmintVAsset(address assetAddress,uint256 amount)
external: Mint the non-native Token on the parachain into VToken, such as DOT->vDOT that exists on MoonbeamredeemAsset(address vAssetAddress, uint256 amount)
external: Redeem your own VToken into Token. The redemption period varies according to the Token. For example, vDOT redemption is 0-28 daysswapAssetsForExactAssets(address assetInAddress, address assetOutAddress,uint256 assetInAmount, uint128 assetOutMin)
external: swap one kind of Token into another kind of Token, for example, swap BNC into DOTswapAssetsForExactNativeAssets(address assetInAddress, uint256 assetInAmount, uint128 assetOutMin)
external: Swap a Token into a parachainβs native Token, such as BNC Swap into GLMRswapNativeAssetsForExactAssets(address assetOutAddress, uint128 assetOutMin)
payable external: Swap the native Token of the parachain into other Tokens, such as GLMR Swap into BNC
SLPx solidity contract Integration
Network | SLPx Address |
---|---|
Manta Pacific | 0x174aEfe55aaC3894696984A2d6a029e668219593 |
Astar zkEVM | 0x2fD8bbF5dc8b342C09ABF34f211b3488e2d9d691 |
Astar | 0xc6bf0C5C78686f1D0E2E54b97D6de6e2cEFAe9fD |
Moonbeam | 0xF1d4797E51a4640a76769A50b57abE7479ADd3d8 |
Moonriver | 0x6b0A44c64190279f7034b77c13a566E914FE5Ec4 |
Astar Rococo | 0x82745827D0B8972eC0583B3100eCb30b81Db0072 |
Moonbase Alpha | 0xA3C7AE227B41CcDF34f38D408Fb7fFD37395553A |
If you want to integrate SLPx in your contract, please see a sample code.
Among them are calls to the mintVNativeAsset and mintVAsset methods
Because of the use of XCM technology, the result of the call is not real-time, you'd better put the SLPx call at the end of your contract logic.
Last updated