Moonriver

Introduction

This guide will show how to integrate SLPx in your contact logic. It is based on the SLPx vTokenminting code examplearrow-up-right. To run this example, check out the guide below.

circle-info

To get started with local development on Moonriver, check out local development guidearrow-up-right.

In this example we will integrate vKSM minting & redemption in our contract logic. The tokens, amount of input token, destination chain id, and channel id can be configured as inputs.

The guide will cover:

  1. Clarifying the contract info

  2. Constructing vKSM minting in your contract

  3. Constructing vKSM redemption in your contract

Network

SLPx contract address under Moonriver network:

Network
Slpx Address

Moonriver

0x6b0A44c64190279f7034b77c13a566E914FE5Ec4

Contract info

/**
    * @dev Create order to mint vAsset or redeem vAsset on bifrost chain
    * @param assetAddress The address of the asset to mint or redeem
    * @param amount The amount of the asset to mint or redeem
    * @param dest_chain_id When order is executed on Bifrost, Asset/vAsset will be transferred to this chain
    * @param receiver The receiver address on the destination chain, 20 bytes for EVM, 32 bytes for Substrate
    * @param remark The remark of the order, less than 32 bytes. For example, "OmniLS"
    * @param channel_id The channel id of the order, you can set it. Bifrost chain will use it to share reward.
    **/
    function create_order(
        address assetAddress,
        uint128 amount,
        uint64 dest_chain_id,
        bytes memory receiver,
        string memory remark,
        uint32 channel_id
    ) external payable;

Before starting, let's talk about the values we fetched here and what they represent:

  • Create order calls the SLPx contract to mint or redeem vAsset on the Bifrost chain.

  • assetAddress is the address of the asset you want to mint or redeem.

  • amount is the amount of the asset you want to mint or redeem.

  • dest_chain_id represents the chain that your contract is deploying on, once that order in Create order is executed on Bifrost, Asset/vAsset will be transferred to this chain.

  • receiver is the asset receiver address on the destination chain, 20 bytes for EVM, 32 bytes for Substrate.

  • remark is the remark of the order, less than 32 bytes. For example, "OmniLS"

  • channel_id is a unique identifier for the order. It's used to join Bifrost Protocol Revenue Sharing Program (RSP). You can set it if you have one. Check herearrow-up-right to learn more.

Examples

We assume you're trying to integrate vKSM minting and redemption into your contract. To do this, follow the examples below and adjust your inputs accordingly.

  • Mint 1 KSM into vKSM and send it to Moonriver.

  • Redeem 1 vKSM into KSM and send it to Moonriver.

Currency id & Destination Chain id

Configure your currency id and chain id inputs by checking the params below:

Moonriver

Chains

Dest_Chain_Id

Receiver Type

Moonriver

1284

Ethereum Address(Byets20)

Token
Address
CurrencyId
operationalMin

xcBNC

0xFFfFFfFFF075423be54811EcB478e911F22dDe7D

0x0001

1_000_000_000_000

xcKSM

0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080

0x0204

500_000_000_000

MOVR

0x0000000000000000000000000000000000000802

0x020a

500_000_000_000_000_000

Bifrost_Voucher_BNC

0xFFffffff3646A00f78caDf8883c5A2791BfCDdc4

0x0101

800_000_000_000

Bifrost_Voucher_KSM

0xFFffffFFC6DEec7Fc8B11A2C8ddE9a59F8c62EFe

0x0104

400_000_000_000

Bifrost_Voucher_MOVR

0xfFfffFfF98e37bF6a393504b5aDC5B53B4D0ba11

0x010a

400_000_000_000_000_000

XcmOracle

XCM Oracle is a an oracle tool to query Vasset storage from Bifrost chain, you can learn more via herearrow-up-right.

Network
XcmOracle Address
Support Asset

Moonriver

0x682D05cD8D96b9904eC2b1B97BD1eb640B10fC2d

KSM / MOVR / BNC

Contract info

Last updated

Was this helpful?