Transfer Moons between Rinkeby and xDai Chain using the MOON bridge extension
Instructions on relaying MOON tokens through the MOON AMB bridge extension
The instructions below use MyEtherWallet to transfer tokens. This method is not very intuitive. We expect a DApp (e.g. Burner Wallet 2) will adopt these instructions to provide a better user experience.
We use MyEtherWallet (MEW) to transfer MOON tokens through the bridge extension. MEW may be used for both types of operations: to deposit tokens to the xDai chain and to withdraw tokens from the xDai chain.
You will need a small amount of Rinkeby Testnet ether for gas fees and an amount of Moons to transfer for this tutorial.
- 1.Activate and open a web3 wallet (like MetaMask or Nifty Wallet) and select the Rinkeby Testnet. Go to MyEtherWallet (MEW) and select the option to login with MewCX (MetaMask or other web3 wallet). Use a wallet that contains some amount of Moon tokens. Next:
- 2.1) Select the Interact with Contract item from the sidebar menu
- 3.2) Initialize the MOON token contract interface by entering the Moon token contract address in the Contract Address field:
- 4.3) Add the following JSON in the
- 4) Click Continue.
Interact with a contract using MEW
- 1.Approve the mediator contract to perform operations with tokens:
- 2.1) Select
approvefrom the Select an Item dropdown
- 3.2) Enter the Spender address
0xFEaB457D95D9990b7eb6c943c839258245541754. This is the mediator contract serving the bridge extension on the Rinkeby Testnet.
- 4.3) Enter the Value - the amount of tokens (in Wei) you approve to transfer from this address. Leave Value in ETH field blank.
- 5.4) Press Write to initiate the approval.
Note that minimum and maximum transaction amounts for deposit are embedded into the extension.
- Min per transaction: 1 MOON (the MOON's decimals is 0, 1 Moon = 1,000,000,000,000,000,000)
- Max per transaction: 100,000,000,000,000,000,000,000 (100,000 MOON)
- Transaction limit max per day: 6,000,000,000,000,000,000,000,000 (6M MOON)
- 1.Check that the Gas price - 1 Gwei is enough, then Submit the transaction using your web3 wallet (like MetaMask or Nifty wallet). Wait to proceed until it is included in the chain.
- 2.Press the Back button. You will now initialize the mediator contract interface from the Interact with Contract interface:
- 3.1) Enter the mediator contract address:
- 4.2) Enter the following JSON in the
- 3) Press Continue.
5) Choose an appropriate
relayTokensmethod. There are two possible methods:
relayTokens(address _receiver, uint256 _amount)- Used to transfer MOON tokens to a recipient in the xDai chain.
relayTokens(address _from, address _receiver, uint256 _amount)- Used in scenarios when the MOON tokens deposit is performed by another contract on behalf of a user account (e.g. a wallet contract).
- 3.1) Select the first relayTokens method.
_receiver- Enter the account that will receive the MOON tokens on the xDai chain. Typically we assume the same account that deposits the token also receives the token, so enter the address (from your web3wallet & shown in MEW) you are initiating the transfer from. However, you can enter another address if you prefer.
_amount-- the amount of tokens (in Wei) to transfer; it must be less or equal to the amount of tokens approved for the bridge operations in step 2.3.
- 6.4) Press Write.
- 7.Check the gas price, then Submit the transaction your web3 wallet and wait until it is included in the chain.
- 8.It will require the AMB bridge a short (20-40 seconds) amount of time to relay the deposit request to the xDai chain. After some time the balance of the account specified as
relayTokensmethod call will increase. The result of the relay operation can be monitored in Blockscout.
No special operations are required to transfer MOON tokens back to the Rinkeby Testnet. Just send MOON tokens in the xDai chain to the mediator
0x1E0507046130c31DEb20EC2f870ad070Ff266079. They will be sent to the same wallet address. You will need a very small amount of xDai to process.
If you want to specify an alternative receiver of the tokens (a different address) in the Rinkeby Testnet, the
relayTokensmethod from the mediator contract can be used.
You will need to add the Moon contract addresses to your wallet to view, and be sure you are connected to the correct chain. For instructions on adding custom tokens, see the sUSD tutorial. Add 18 decimals of precision to view accurate balance.