Add command to check balance of ERC20 tokens

This commit is contained in:
Shreerang Kale 2024-10-23 10:52:27 +05:30
parent 8f614ed374
commit af73ec70e8
2 changed files with 50 additions and 7 deletions

View File

@ -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
```

View File

@ -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> #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: