EOSIO.token <> EOSIO.token Fungible Tokens
This guide will essentially map the tokenpeg.spec.js unit test.
Resources:
DSP Portals
Steps:
Install Zeus if not installed, zeus is used to unbox or install all the necessary dependencies to compile and deploy the necessary contracts.
Ensure you're using node version 12, IPFS can be picky with other versions
Unbox
tokenpegbox
mkdir tokenpeg; cd tokenpeg
zeus box create
zeus unbox tokenpegAdd LiquidX mapping file
/zeus_boxes/liquidx/models/eosio-chains/liquidjungl3.json
The following file is for the destination's chain information.
/zeus_boxes/liquidx/models/liquidx-mappings/sidechain_name.dappservices.json
This file allows for the compiler to insert relevant chain information into the contract header.
Compile contracts
Create 3 Kylin and 3 Jungle Accounts
Kylin token contract Account (token being bridged
eosio.token.cpp)Kylin bridge contract Account (
tokenpeg.cpp)Kylin test Account no contract
Jungle token contract Account (token on Jungle to mint/burn tokens
eosio.token.cpp)Jungle bridge contract Account (
tokenpegx.cpp)Jungle test Account no contract
Setup
tokenpegon the Kylin token contract Account andtokenpegxon the Jungle token contract Account usingzeus migrate.Import private keys
Create contract deployment files located in
./zeus_boxes/contract-migrations-extensions/models/contract-deployments/
Migrate contracts to Kylin/Jungle
Initialize token contracts
Create
Create tokens
For Kylin, we'll set the issuer to the token contract, this is to simulate a pre-existing token that is being bridged to Jungle3.
Only Jungle3 we will set the issuer to the bridge contract so that it can issue tokens when they come across the bridge. We will also issue those tokens to the
Issue test tokens
We will issue some test tokens to our test account.
Transfer test tokens
Now we will transfer the issued tokens to the test account.
Stake for services
Now that we've prepared that part let's move onto staking DAPP for services. First stop is the faucet for some DAPP tokens here. Use the account that has the tokenpeg contract set to it.
Stake to required services vRAM, LiquidHarmony Oracles, and LiquidScheduler
Below we'll select each package then stake for it.
LiquidX stake
In order to stake for services on Jungle3, a LiquidX mapping must be created, for more detail see here.
Initialize
Here we will initialize both bridges with their settings. On Kylin we will not allow issuance because the token already exists. On Jungle we allow the bridge contract to issue tokens to mint/burn. We set the minimum transfer to 1 TKN.
Transfer
Now we will test with a transfer from the Kylin example user to the Kylin bridge contract, let's see how it goes!!
Confirm
If all goes well you will see the tokens arrive at your Jungle destination account, you can send them back to the bridge contract now to send them back!
If the transfers are not going through, ensure that the DSP you are using has enough CPU/NET staked for it
Last updated
Was this helpful?