The following file is for the destination chain's information.
# remove existing JSON file to not confuse the compilerrm-rf./zeus_boxes/liquidx/models/eosio-chains/mkdir./zeus_boxes/liquidx/models/eosio-chains/touch./zeus_boxes/liquidx/models/eosio-chains/liquidxxtwax.jsonvim./zeus_boxes/liquidx/models/eosio-chains/liquidxxtwax.json
Examine ./contracts/eos/dappservices/dappservices.config.hpp and you will see the mapping field populate into c++ definitions, if you see TEST1, you need to delete the existing mapping files
For Kylin we'll setup the collection and schema then mint an asset to the test contract. If you have a pre existing NFT, you can send it to the Kylin test account.
On WAX Test we'll also setup the collection/schema, but we'll make the bridge contract a authorized account on the collection so it can mint new NFTs.
If you get errors such as Transaction exceeded the current network usage limit imposed on the transaction, see the Kylin / Wax Testnet account setup guides to get more tokens and to stake for more resources.
Mint test tokens
We will mint some test NFT tokens to our test account.
Be sure to update the account name, the new asset owner, the collection name and the actor signing the transaction.
export AUTHORIZED_MINTER=$KYLIN_TEST_ACCOUNTexport COLLECTION_NAME=$COLLECTION_NAMEexport SCHEMA_NAME=$SCHEMA_NAMEexport TEMPLATE_ID=-1export NEW_ASSET_OWNER=$KYLIN_TEST_ACCOUNTexport IMMUTABLE_DATA=[ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ]
export MUTABLE_DATA=[]export TOKENS_TO_BACK=[]cleos-u $KYLIN_ENDPOINT pushtransaction'{ "delay_sec": 0, "max_cpu_usage_ms": 0, "actions": [ { "account": "bridgeassets", "name": "mintasset", "data": { "authorized_minter": "natdeveloper", "collection_name": "nftauthcolll", "schema_name": "nftauthschem", "template_id": -1, "new_asset_owner": "natdeveloper", "immutable_data": [ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ],
"mutable_data": [], "tokens_to_back": [] }, "authorization": [ { "actor": "natdeveloper", "permission": "active" } ] } ]}'
Register mapping
The collection author for an NFT must register that NFT with the bridge before users can transfer.
cleos-u $KYLIN_ENDPOINT pushtransaction'{ "delay_sec": 0, "max_cpu_usage_ms": 0, "actions": [ { "account": "atomicbridg1", "name": "regmapping", "data": { "template_id": -1, "schema_name": "nftauthschem", "collection_name": "nftauthcolll", "immutable_data": [ { "key": "name", "value": [ "string", "The New Silk Road" ] }, { "key": "img", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1.png" ] }, { "key": "backimg", "value": [ "string", "QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s/main/genesis/1_back.jpg" ] }, { "key": "series", "value": [ "string", "Through the Looking Glass" ] }, { "key": "moment", "value": [ "string", "6 - The Silk Road" ] }, { "key": "rarity", "value": [ "string", "genesis" ] }, { "key": "description", "value": [ "string", "Named after an ancient Chinese trade route, the digital silk road is a virtual pathway for the delivery of merchandise." ] } ],
}, "authorization": [ { "actor": "natdeveloper", "permission": "active" } ] } ]}'
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 atomictokenpegeosio contract set to it ($KYLIN_BRIDGE_ACCOUNT).
Stake to required services vRAM, LiquidHarmony Oracles, and LiquidScheduler
Below we'll select each package then stake for it.
Here we will initialize both bridges with their settings. On Kylin we will not allow issuance because the token already exists. On WAX Testnet we allow the bridge contract to mint/burn. We set the minimum transfer to 1 TKN.
Now we will test with a transfer from the Kylin example user to the Kylin bridge contract, let's see how it goes!!
export FROM=$KYLIN_TEST_ACCOUNTexport TO=$KYLIN_BRIDGE_ACCOUNTexport ASSET_ID=1099511627776# destionation_account,destination_chain# this is required as the memo type, it tells the bridge which chain the funds go to and who gets themexport MEMO="$WAX_TEST_TEST_ACCOUNT,$CHAIN_NAME"cleos-u $KYLIN_ENDPOINT pushaction $KYLIN_TOKEN_ACCOUNT transfer"[\"$FROM\",\"$TO\",[\"$ASSET_ID\"],\"$MEMO\"]"-p $KYLIN_TEST_ACCOUNT@active
Confirm
If all goes well you will see the tokens arrive at your WAX Testnet destination account, you can send them back to the bridge contract now to send them back!
export FROM=$WAX_TEST_TEST_ACCOUNTexport TO=$WAX_TEST_BRIDGE_ACCOUNTexport ASSET_ID=1099511627776# destionation_account,destination_chain# this is required as the memo type, it tells the bridge which chain the funds go to and who gets themexport MEMO="$KYLIN_TEST_ACCOUNT,kylin"cleos-u $WAX_TEST_ENDPOINT pushaction $WAX_TEST_TOKEN_ACCOUNT transfer"[\"$FROM\",\"$TO\",[\"$ASSET_ID\"],\"$MEMO\"]"-p $WAX_TEST_TEST_ACCOUNT@active
Note that the memo destination chain is now kylin and no longer liquidxxtwax because we are sending the tokens to kylin.
If the transfers are not going through, ensure that the DSP you are using has enough CPU/NET staked for it