> For the complete documentation index, see [llms.txt](https://docs.aozo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aozo.io/stake/developers-and-ecosystem/builder-resources/slpx-integration-reference/deployable-networks/moonbeam.md).

# Moonbeam

## **Introduction**

This guide will show how to integrate SLPx in your contact logic. It is based on the SLPx [vTokenminting code example](https://github.com/bifrost-io/slpx-contracts?tab=readme-ov-file#examples). To run this example, check out the guide below.

{% hint style="info" %}
To get started with local development on Moonbeam, check out [local development guide](https://docs.moonbeam.network/builders/get-started/networks/moonbeam-dev/).
{% endhint %}

In this example we will integrate **vDOT** 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 vDOT minting in your contract
3. Constructing vDOT redemption in your contract

## **Network**

SLPx contract address under Moonbeam network:

| Network  | Slpx Address                               |
| -------- | ------------------------------------------ |
| Moonbeam | 0xF1d4797E51a4640a76769A50b57abE7479ADd3d8 |

## **Contract info**

```jsx
/**
    * @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 c`reate_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 [here](https://docs.bifrost.io/for-partners/reward-share-program-rsp) to learn more.

## Examples

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

* Mint 1 DOT into VDOT and send it to Moonbeam.
* Redeem 1 VDOT into DOT and send it to Moonbeam.

```jsx
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.10;

import "./ISlpx.sol";
import "./IERC20.sol";

contract Example { 
    ISlpx public slpx = ISlpx(0xF1d4797E51a4640a76769A50b57abE7479ADd3d8);
    address dot = 0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080;
    address vdot = 0xFFFfffFf15e1b7E3dF971DD813Bc394deB899aBf;
    // Moonbeam parachain id
    uint64 moonbeam_chain_id = 1284;
    // EVM account public key
    bytes20 receiver = 0xa05d045646ecff8760f9bc3ae4266e910a307f0c11250c3f6fe3ae611dbf8f24;
    uint128 amount = 10_000_000_000; 
    string remark = "Hello Slpx";
    uint32 channel_id = 0;
    
    function mint_vdot() public payable {
        IERC20(dot).transferFrom(msg.sender, address(this), amount);
        IERC20(dot).approve(address(slpx), amount);
        slpx.create_order(
            dot,
            amount,
            moonbeam_chain_id,
            abi.encodePacked(receiver),
            remark,
            channel_id
        );

        //Your contract logic: 

     }

    // Redeem DOT for 0-28 days, once redeemed, it will be sent to the receiver of dest chain
     function redeem_dot() public payable {
        IERC20(vdot).transferFrom(msg.sender, address(this), amount);
        IERC20(vdot).approve(address(slpx), amount);
        slpx.create_order(
            vdot,
            amount,
            moonbeam_chain_id,
            abi.encodePacked(receiver),
            remark,
            channel_id
        );

        //Your contract logic: 

     }
}
```

## **Currency id & Destination Chain id**

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

**Moonbeam**

| **Chains** | **Dest\_Chain\_Id** | **Receiver Type**         |
| ---------- | ------------------- | ------------------------- |
| Moonbeam   | 1284                | Ethereum Address(Byets20) |

| **Token**                        | **Address**                                | **CurrencyId** | **operationalMin**              |
| -------------------------------- | ------------------------------------------ | -------------- | ------------------------------- |
| BNC                              | 0xFFffffFf7cC06abdF7201b350A1265c62C8601d2 | 0x0001         | 1\_000\_000\_000\_000           |
| xcDOT                            | 0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080 | 0x0800         | 10\_000\_000\_000               |
| GLMR                             | 0x0000000000000000000000000000000000000802 | 0x0801         | 5\_000\_000\_000\_000\_000\_000 |
| ASTR                             | 0xFfFFFfffA893AD19e540E172C10d78D4d479B5Cf | 0x0803         | 5\_000\_000\_000\_000\_000\_000 |
| Bifrost\_Filecoin\_Native\_Token | 0xfFFfFFFF6C57e17D210DF507c82807149fFd70B2 | 0x0804         | 1\_000\_000\_000\_000\_000\_000 |
| Bifrost\_Voucher\_DOT            | 0xFFFfffFf15e1b7E3dF971DD813Bc394deB899aBf | 0x0900         | 8\_000\_000\_000                |
| Bifrost\_Voucher\_GLMR           | 0xFfFfFFff99dABE1a8De0EA22bAa6FD48fdE96F6c | 0x0901         | 4\_000\_000\_000\_000\_000\_000 |
| Bifrost\_Voucher\_ASTR           | 0xFffFffff55C732C47639231a4C4373245763d26E | 0x0903         | 4\_000\_000\_000\_000\_000\_000 |
| Bifrost\_Voucher\_FIL            | 0xFffffFffCd0aD0EA6576B7b285295c85E94cf4c1 | 0x0904         | 800\_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 [here](https://docs.bifrost.io/for-builders/liquid-staking-x-slpx/xcm-oracle).

| Network  | XcmOracle Address                          | Support Asset    |
| -------- | ------------------------------------------ | ---------------- |
| Moonbeam | 0xEF81930Aa8ed07C17948B2E26b7bfAF20144eF2a | DOT / GLMR / FIL |

**Contract info**

```jsx
// _assetAddress: Asset address, e.g. DOT, KSM
// _assetAmount: Input asset amount, get vAsset amount
// _vAssetAmount: Input vAsset amount, get asset amount
function getVTokenByToken(address _assetAddress, uint256 _assetAmount) public view returns (uint256);
function getTokenByVToken(address _assetAddress, uint256 _vAssetAmount) public view returns (uint256);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aozo.io/stake/developers-and-ecosystem/builder-resources/slpx-integration-reference/deployable-networks/moonbeam.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
