EOSIO Side Setup

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 16, IPFS can be picky with other versions
​Unbox binancetokenpeg box
1
mkdir binancetokenpeg
2
cd binancetokenpeg
3
zeus box create
4
zeus unbox binancetokenpeg
Copied!
Compile contracts
1
zeus compile
Copied!
Create 3 Kylin and 3 Binance Smart Chain Testnet accounts using these guides:
  • Kylin Testnet: link​
  • Binance Smart Chain Testnet: link​
Kylin Accounts:
  • Kylin token contract account (token being bridged eosio.token.cpp)
  • Kylin bridge contract account (binancetokenpeg.cpp)
  • Kylin test Account no contract
BSC Testnet Accounts
  • BSCTestnet token contract account (token on BSCTestnet to mint/burn tokens BEP20TokenImplementation.sol)
  • BSCTestnet bridge contract Account (binancetokenpeg.sol)
  • BSCTestnet test Account no contract
1
export KYLIN_BRIDGE_ACCOUNT=bsctestbridg
2
export KYLIN_TOKEN_ACCOUNT=bsctesttoken
3
export KYLIN_TEST_ACCOUNT=natdeveloper
4
export KYLIN_ENDPOINT=https://kylin.eosn.io
Copied!
Import our keys into zeus to deploy contracts to Kylin, or can use cleos as well
Zeus
cleos
1
zeus key import $KYLIN_BRIDGE_ACCOUNT --network kylin --active-private-key 5JB... --owner-private-key 5JB...
2
zeus key import $KYLIN_TOKEN_ACCOUNT --network kylin --active-private-key 5JB... --owner-private-key 5JB...
Copied!
1
# import owner private key
2
cleos wallet import --private-key 5JB...
3
# import active private key
4
cleos wallet import --private-key 5JB...
Copied!
Create contract deployment files to migrate contracts to Kylin, located in ./zeus_boxes/contract-migrations-extensions/models/contract-deployments/
1
zeus create contract-deployment binancetokenpeg $KYLIN_BRIDGE_ACCOUNT kylin
2
zeus create contract-deployment eosio.token $KYLIN_TOKEN_ACCOUNT kylin
Copied!
Migrate contracts to Kylin/Jungle
Zeus Migrate
cleos set contract
1
zeus migrate binancetokenpeg --network=kylin --creator $KYLIN_BRIDGE_ACCOUNT --no-reset --no-compile-all --creator-key=""
2
zeus migrate eosio.token --network=kylin --creator $KYLIN_TOKEN_ACCOUNT --no-reset --no-compile-all --creator-key=""
Copied!
1
# if migration fails
2
cd contracts/eos
3
cleos -u $KYLIN_ENDPOINT set contract $KYLIN_BRIDGE_ACCOUNT binancetokenpeg
4
cleos -u $KYLIN_ENDPOINT set contract $KYLIN_TOKEN_ACCOUNT eosio.token
Copied!
If you use cleos to set the contract, be sure to set the eosio.code permission level, see here​

Initialize Kylin token contract

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 another chain.
Kylin
1
export MAX_SUPPLY="1000000.0000 TKN"
2
export ISSUER=$KYLIN_TOKEN_ACCOUNT # token contract itself
3
cleos -u $KYLIN_ENDPOINT push action $KYLIN_TOKEN_ACCOUNT create "[\"$ISSUER\",\"$MAX_SUPPLY\"]" -p $KYLIN_TOKEN_ACCOUNT@active
Copied!
If you get errors such as Transaction exceeded the current network usage limit imposed on the transaction, see the Kylin account setup guide to get more tokens and to stake for more resources.
Issue test tokens
We will issue some test tokens to our test account.
1
export TO=$KYLIN_TOKEN_ACCOUNT
2
export QUANTITY="10.0000 TKN"
3
export MEMO="issuing tokens"
4
cleos -u $KYLIN_ENDPOINT push action $KYLIN_TOKEN_ACCOUNT issue "[\"$TO\",\"$QUANTITY\",\"$MEMO\"]" -p $KYLIN_TOKEN_ACCOUNT@active
Copied!
Transfer test tokens
Now we will transfer the issued tokens to the test account so that it may be sent to the bridge.
1
export FROM=$KYLIN_TOKEN_ACCOUNT
2
export TO=$KYLIN_TEST_ACCOUNT
3
export QUANTITY="10.0000 TKN"
4
export MEMO="don't spend it all in one place!"
5
cleos -u $KYLIN_ENDPOINT push action $KYLIN_TOKEN_ACCOUNT transfer "[\"$FROM\",\"$TO\",\"$QUANTITY\",\"$MEMO\"]" -p $KYLIN_TOKEN_ACCOUNT@active
Copied!
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 binancetokenpeg contract set to it.
Stake to required services vRAM, LiquidHarmony Oracles, LiquidScheduler, LiquidLink
Using the DSP Portal we can see these packages, stake 10 DAPP to each (Amount to Stake):
Below we'll select each package then stake for it.
vRAM
LiquidHarmony
LiquidScheduler
LiquidLink
1
export PROVIDER=uuddlrlrbass
2
export PACKAGE=ipfs2
3
export SERVICE=ipfsservice1
4
export QUANTITY="10.0000 DAPP"
5
cleos -u $KYLIN_ENDPOINT push action dappservices selectpkg "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$PACKAGE\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
6
cleos -u $KYLIN_ENDPOINT push action dappservices stake "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$QUANTITY\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
Copied!
1
export PROVIDER=uuddlrlrbass
2
export PACKAGE=oracleservi2
3
export SERVICE=oracleservic
4
export QUANTITY="10.0000 DAPP"
5
cleos -u $KYLIN_ENDPOINT push action dappservices selectpkg "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$PACKAGE\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
6
cleos -u $KYLIN_ENDPOINT push action dappservices stake "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$QUANTITY\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
Copied!
1
export PROVIDER=uuddlrlrbass
2
export PACKAGE=cronservice2
3
export SERVICE=cronservices
4
export QUANTITY="10.0000 DAPP"
5
cleos -u $KYLIN_ENDPOINT push action dappservices selectpkg "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$PACKAGE\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
6
cleos -u $KYLIN_ENDPOINT push action dappservices stake "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$QUANTITY\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
Copied!
1
export PROVIDER=uuddlrlrbass
2
export PACKAGE=sign
3
export SERVICE=signfndspsvc
4
export QUANTITY="10.0000 DAPP"
5
cleos -u $KYLIN_ENDPOINT push action dappservices selectpkg "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$PACKAGE\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
6
cleos -u $KYLIN_ENDPOINT push action dappservices stake "[\"$KYLIN_BRIDGE_ACCOUNT\",\"$PROVIDER\",\"$SERVICE\",\"$QUANTITY\"]" -p $KYLIN_BRIDGE_ACCOUNT@active
Copied!
Use the command line login option, top right, this will auto-create the cleos commands for you!
Now let's head over to the EVM side.