Use stack nitro-rpc-client command
This commit is contained in:
parent
de8f52b1c2
commit
a2390146a5
@ -497,7 +497,7 @@ Clone the stack repo:
|
||||
# 100000000000000000
|
||||
```
|
||||
|
||||
- Create a deployment for the bridge:
|
||||
- Run the bridge:
|
||||
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config 'CERC_NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546,CERC_NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,CERC_NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,CERC_NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,CERC_GETH_URL=http://host.docker.internal:8545,CERC_OPTIMISM_URL=http://host.docker.internal:9545,CERC_GETH_DEPLOYER_PK=$ACCOUNT_PK,CERC_OPTIMISM_DEPLOYER_PK=$ACCOUNT_PK,CERC_TOKEN_NAME=LaconicNetworkToken,CERC_TOKEN_SYMBOL=LNT,CERC_INITIAL_TOKEN_SUPPLY=129600'
|
||||
@ -524,6 +524,7 @@ Clone the stack repo:
|
||||
|
||||
```bash
|
||||
export L1_ASSET_ADDRESS="$(laconic-so deployment --dir bridge-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
|
||||
|
||||
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
||||
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
||||
```
|
||||
@ -624,20 +625,12 @@ Clone the stack repo:
|
||||
```bash
|
||||
# Contract address of NitroAdjudicator
|
||||
export NA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
|
||||
```
|
||||
|
||||
```bash
|
||||
# Contract address of VirtualPaymentApp
|
||||
export CA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
|
||||
```
|
||||
|
||||
```bash
|
||||
# Contract address of ConsensusApp
|
||||
export VPA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
|
||||
```
|
||||
|
||||
```bash
|
||||
# Contract address of Bridge
|
||||
# Contract address of bridge
|
||||
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
|
||||
```
|
||||
|
||||
@ -769,21 +762,22 @@ Clone the stack repo:
|
||||
- Open new terminal, check that no channels exist on L2
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-all-l2-channels -p 4006
|
||||
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
|
||||
```
|
||||
|
||||
- Set address of bridge and address of custom token on L1 in the current terminal
|
||||
|
||||
<!-- TODO: Get token address from go-nitro deployments env -->
|
||||
```bash
|
||||
export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
export L1_ASSET_ADDRESS="<Token Address on L1>"
|
||||
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
|
||||
|
||||
export L1_ASSET_ADDRESS="$(laconic-so deployment --dir bridge-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
|
||||
```
|
||||
|
||||
- Create ledger channel between A and Bridge with custom token
|
||||
|
||||
```bash
|
||||
nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4007
|
||||
laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4007 -h nitro-node"
|
||||
```
|
||||
|
||||
- Once direct-fund objective is complete, bridge will create mirrored channel on L2
|
||||
@ -791,7 +785,7 @@ Clone the stack repo:
|
||||
- Check status of L1 ledger channel between A and Bridge
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4007
|
||||
laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4007 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
@ -811,7 +805,7 @@ Clone the stack repo:
|
||||
- Create ledger channel between C and Bridge with custom token
|
||||
|
||||
```bash
|
||||
nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4009
|
||||
laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4009 -h nitro-node"
|
||||
```
|
||||
|
||||
- Once direct fund objective is complete, bridge will create mirrored channel on L2
|
||||
@ -819,7 +813,7 @@ Clone the stack repo:
|
||||
- Check status of L1 ledger channel between C and Bridge
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4009
|
||||
laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4009 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
@ -839,7 +833,7 @@ Clone the stack repo:
|
||||
- Check status of all L2 mirrored ledger channels
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-all-l2-channels -p 4006
|
||||
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
|
||||
|
||||
# Expected output:
|
||||
# {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"}
|
||||
@ -958,18 +952,19 @@ Clone the stack repo:
|
||||
- Create virtual channel on L2 from A' to C' via Bridge' as intermediary
|
||||
|
||||
```bash
|
||||
export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
|
||||
|
||||
export A_ADDRESS=<Alice Nitro address>
|
||||
export C_ADDRESS=<Charlie Nitro address>
|
||||
|
||||
# Starts virtual fund objective on L2 to create virtual channel from A' to C'
|
||||
nitro-rpc-client virtual-fund $C_ADDRESS $BRIDGE_ADDRESS --amount 1000 -p 4008
|
||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-fund $C_ADDRESS $BRIDGE_ADDRESS --amount 1000 -p 4008 -h nitro-node"
|
||||
```
|
||||
|
||||
- Check payment channel between A' and C'
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-payment-channel <payment channel ID> -p 4008
|
||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-payment-channel <payment channel ID> -p 4008 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
@ -988,7 +983,7 @@ Clone the stack repo:
|
||||
- After virtual fund objective is complete, make payments
|
||||
|
||||
```bash
|
||||
nitro-rpc-client pay <payment channel ID> 200 -p 4008
|
||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client pay <payment channel ID> 200 -p 4008 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
@ -1002,7 +997,7 @@ Clone the stack repo:
|
||||
- Close payment channel after payments
|
||||
|
||||
```bash
|
||||
nitro-rpc-client virtual-defund <payment channel ID> -p 4008
|
||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-defund <payment channel ID> -p 4008 -h nitro-node"
|
||||
```
|
||||
|
||||
- Check L2 mirrored channels status after virtual-defund is complete:
|
||||
@ -1010,7 +1005,7 @@ Clone the stack repo:
|
||||
- Note balance change in A' node:
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-all-ledger-channels -p 4008
|
||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4008 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"}
|
||||
@ -1018,8 +1013,8 @@ Clone the stack repo:
|
||||
|
||||
- Note balance change in C' node:
|
||||
|
||||
```bash
|
||||
nitro-rpc-client get-all-ledger-channels -p 4010
|
||||
```bash
|
||||
laconic-so deployment --dir l2charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4010 -h nitro-node"
|
||||
|
||||
# Expected output:
|
||||
# {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":1000200,"TheirBalance":999800},"ChannelMode":"Open"}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user