From af73ec70e8c70649067812bda22bd1335248df68 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Wed, 23 Oct 2024 10:52:27 +0530 Subject: [PATCH] Add command to check balance of ERC20 tokens --- ops/deployments-from-scratch.md | 12 ++++++--- testnet-nitro-node.md | 45 ++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/ops/deployments-from-scratch.md b/ops/deployments-from-scratch.md index 3219c33..a55ba90 100644 --- a/ops/deployments-from-scratch.md +++ b/ops/deployments-from-scratch.md @@ -191,10 +191,12 @@ initial_token_supply: "129600" ``` -* Update the target dir in `setup-vars.yml`: +* Edit the `setup-vars.yml` to update the target directory: ```bash - sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' setup-vars.yml + ... + nitro_directory: /srv/bridge + ... # Will create deployment at /srv/bridge/nitro-contracts-deployment ``` @@ -343,10 +345,12 @@ ca_address: "" ``` -* Update the target dir in `setup-vars.yml`: +* Edit the `setup-vars.yml` to update the target directory: ```bash - sed -i 's|^nitro_directory:.*|nitro_directory: /srv/bridge|' setup-vars.yml + ... + nitro_directory: /srv/bridge + ... # Will create deployment at /srv/bridge/nitro-contracts-deployment and /srv/bridge/bridge-deployment ``` diff --git a/testnet-nitro-node.md b/testnet-nitro-node.md index bcfb688..2db33b5 100644 --- a/testnet-nitro-node.md +++ b/testnet-nitro-node.md @@ -38,7 +38,44 @@ * Ask testnet operator to send L1 tokens to your chain address - * [Reference doc for operators](./ops/nitro-token-ops.md) + * [README for transferring tokens](./ops/nitro-token-ops.md) + +* Check balance of your tokens once they are transferred: + + ```bash + export GETH_CHAIN_ID="1212" + export GETH_CHAIN_URL="https://fixturenet-eth.laconic.com" + + export ACCOUNT_ADDRESS= #account address should be without "0x" + export ASSET_ADDRESS_1=$(jq -r --arg chainId "$GETH_CHAIN_ID" '.[$chainId][0].contracts.TestToken.address' assets.json) + export ASSET_ADDRESS_2=$(jq -r --arg chainId "$GETH_CHAIN_ID" '.[$chainId][0].contracts.TestToken2.address' assets.json) + + # Check balance of first asset address + curl -X POST $GETH_CHAIN_URL \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc":"2.0", + "method":"eth_call", + "params":[{ + "to": "'"$ASSET_ADDRESS_1"'", + "data": "0x70a08231000000000000000000000000'"$ACCOUNT_ADDRESS"'" + }, "latest"], + "id":1 + }' + + # Check balance of second asset address + curl -X POST $GETH_CHAIN_URL \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc":"2.0", + "method":"eth_call", + "params":[{ + "to": "'"$ASSET_ADDRESS_2"'", + "data": "0x70a08231000000000000000000000000'"$ACCOUNT_ADDRESS"'" + }, "latest"], + "id":1 + }' + ``` * Edit `nitro-vars.yml` and add the following variables: @@ -182,9 +219,11 @@ Create a ledger channel with the bridge on L1 which is mirrored on L2 export BRIDGE_NITRO_ADDRESS=$(yq eval '.bridge_nitro_address' nitro-node-config.yml) + export GETH_CHAIN_ID="1212" + # Get asset addresses from assets.json file - export ASSET_ADDRESS_1=$(jq -r --arg chainId "$CHAIN_ID" '.[$chainId][0].contracts.TestToken.address' assets.json) - export ASSET_ADDRESS_2=$(jq -r --arg chainId "$CHAIN_ID" '.[$chainId][0].contracts.TestToken2.address' assets.json) + export ASSET_ADDRESS_1=$(jq -r --arg chainId "$GETH_CHAIN_ID" '.[$chainId][0].contracts.TestToken.address' assets.json) + export ASSET_ADDRESS_2=$(jq -r --arg chainId "$GETH_CHAIN_ID" '.[$chainId][0].contracts.TestToken2.address' assets.json) ``` * Check that you have no existing channels on L1 or L2: