Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Latest commit

 

History

History
117 lines (83 loc) · 7.85 KB

mew.md

File metadata and controls

117 lines (83 loc) · 7.85 KB

Interacting with the contracts

Sometimes, you don't want the Vega Console to do everything for you. Here's how to request tokens from the contracts directly.

Step 1: Get Ropsten ETH

In order to run smart contract functions on Ethereum, you must have Ether to pay gas. On the Ropsten testnet there are a number of Ether faucets to get Ether to test with.

Easy

Enter your address in to one of the following:

You can track the progress of your transaction on Etherscan for Ropsten.

Medium

NOTE: Make sure that the quotes are all correct, the copy/paste might give you some wrong quote that will make the command fail.

Run the following command line:

curl -s -H "Content-Type: application/json" -d '{"toWhom":"YOUR_ETHEREUM_ADDRESS_GOES_HERE"}' -X POST https://ropsten.faucet.b9lab.com/tap

The system should respond with:

{
  "txHash" : "TX_HASH"
}

Hardcore

If you want to go "hardcore decentralized mode", there exists an IPFS-deployed faucet: https://blog.b9lab.com/when-we-first-built-our-faucet-we-deployed-it-on-the-morden-testnet-70bfbf4e317e

Step 2: Token Faucet

NOTE: These instructions will work for any of the test tokens

To deposit test tokens into Vega via the ERC20 bridge, you must first have the tokens.

Luckily, there's a faucet for that!

If you want to follow a quick how-to to add a test token to your wallet:

  1. Go to: https://www.myetherwallet.com/ (make sure this is the .com, any other is a scam/phishing website that would corrupt your wallet and steal everything!!!)
  2. Click on "Access my Wallet"
  3. Select "MEW CX" and allow the access to your wallet
  4. Click on "Contract" -> "Interact with Contract"
  5. In the new page, copy the desired Test Token address.
  6. In the ABI/JSON interface, copy and paste the content of the JSON file available here https://raw.githubusercontent.com/vegaprotocol/Public_Test_Bridge_Tools/master/token/Base_Faucet_Token_ABI.json
  7. Click "Continue"
  8. Click "Select an Item" and in the dropdown list select "Faucet"

Dropdown list

  1. Leave ETH field with 0 and just click "Write"
  2. A window from MetaMask will popup and you just need to select "Continue" (see image below)

MetaMask popup

  1. Wait some time until you get the notification that the transaction has been completed, and if you click on the MetaMask plugin, and select "Assets" you should be able to see the token asset like in the image below

MetaMask Assets

Step 3: Depositing test tokens into ERC20 Bridge

MyEtherWallet.com (MEW) + MetaMask

First of all you need to obtain tokens from the test token faucet using the instructions above.

Approve ERC20 Bridge to move your test tokens (You need MetaMask installed - see above)

  1. Go to: https://www.myetherwallet.com/ (make sure is the .com, any other is a scam/phishing website that would corrupt your wallet and steal everything!!!)
  2. Click on "Access my Wallet"
  3. Select "MEW CX" and allow the access to your wallet
  4. Click on "Contract" -> "Interact with Contract"
  5. In the new page, under "Contract Address" copy the Test Token address
  6. In the ABI/JSON interface, copy and paste the content of the JSON file available here https://raw.githubusercontent.com/vegaprotocol/Public_Test_Bridge_Tools/master/token/Base_Faucet_Token_ABI.json
  7. Click "Continue"
  8. Click "Select an Item" and in the dropdown list select "Approve"

Dropdown list

  1. In the "Spender (address)" field copy/paste the Target ERC20 BRIDGE address.
  2. In the "Value (uint256)" field write in the number of tokens you would like to deposit followed by 5 zeros (00000) (example: if you want to limit to 1000 tokens you need to write: 100000000)
  3. leave the ETH at 0 (DON'T TOUCH IT) and click "Write"
  4. MetaMask will request to confirm that you allow MEW to spend your tokens, click "Confirm" (see image below)

Here select CONFIRM

  1. Wait for the transaction to be completed. You can track the progress of your transaction on Etherscan for Ropsten.

Run deposit_asset function on ERC20 Bridge - Deposit assets on Vega PubKey

  1. If you are already on https://www.myetherwallet.com/ with an address selected, click "Clear all" at the bottom and move to step 6, otherwise continue to the next step
  2. Go to: https://www.myetherwallet.com/ (make sure is the .com, any other is a scam/phishing website that would corrupt your wallet and steal everything!!!)
  3. Click on "Access my Wallet"
  4. Select "MEW CX" and allow the access to your wallet
  5. Click on "Contract" -> "Interact with Contract"
  6. In the new page, under "Contract Address" copy the Vega ERC20 BRIDGE (Ropsten) address
  7. In the ABI/JSON interface, copy and paste the content of the JSON file available here https://raw.githubusercontent.com/vegaprotocol/Public_Test_Bridge_Tools/master/bridge/IERC20_Bridge_Logic_ABI.json
  8. Click "Continue"
  9. Click "Select an Item" and in the dropdown list select "deposit_asset"

Dropdown list

  1. In the "Asset_source (address)" field paste the Test Token address
  2. In the "Asset_id (uint256)" field leave zero (0)
  3. In the "Amount (uint256)" field write the amount of tokens you would like to deposit followed by 5 zeros (00000) (example: if you want to deposit 1 token you need to write: 100000) NOTE: It cannot be above the previously selected limit
  4. In the "Vega_public_key (bytes32)" copy/paste the Vega PubKey (prepend the PubKey with 0x) for the Vega Account you would like the tokens to be credited for this deposit. You can find it in Console by clicking on "Hosted Wallet" (top right), then below "Select Key for Trading" click on "view" next to the relevant key, and then click "copy" (see images below)

Click on Hosted Wallet Click on View Click copy

  1. Leave the ETH field with 0 (Don't touch it!) and click "Write"
  2. MetaMask will request to confirm that you allow MEW to spend your test tokens, click "Confirm" (see image below)

Here select CONFIRM

  1. Wait for the transaction to be completed. Track the progress of your transaction on Etherscan for Ropsten.
  2. Your tokens have been deposited into Vega and will be credited to the provided Vega Public Key.

👈 Back to index