Update readme

This commit is contained in:
Roy Crihfield 2024-08-30 19:00:38 +08:00
parent b545868a97
commit 4b01f3de72

View File

@ -145,7 +145,7 @@ docker logs -f <CONTAINER_ID>
Send some ETH from the desired account to the `L1StandardBridgeProxy` contract on L1 to test bridging to L2. Send some ETH from the desired account to the `L1StandardBridgeProxy` contract on L1 to test bridging to L2.
We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` which is pre-funded and unlocked, and the `cerc/foundry:local` container to make use of the `cast` cli. We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` which is pre-funded and unlocked, and the `cerc/optimism-contracts:local` container to make use of the `cast` cli.
1. Note the docker network the stack is running on: 1. Note the docker network the stack is running on:
@ -164,16 +164,22 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
ACCOUNT=0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F ACCOUNT=0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F
``` ```
You can create an alias for running `cast` on the network:
```bash
alias op-cast="docker run --rm --network $NETWORK --entrypoint cast cerc/optimism-contracts:local"
```
If you need to check the L1 chain-id, you can use: If you need to check the L1 chain-id, you can use:
```bash ```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast chain-id --rpc-url $L1_RPC" op-cast chain-id --rpc-url $L1_RPC
``` ```
3. Check the account starting balance on L2 (it should be 0): 3. Check the account starting balance on L2 (it should be 0):
```bash ```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC" op-cast balance $ACCOUNT --rpc-url $L2_RPC
# 0 # 0
``` ```
@ -182,8 +188,8 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
```bash ```bash
# get the container id for op-node # get the container id for op-node
NODE_CONTAINER=$(docker ps --filter "name=op-node" -q) NODE_CONTAINER=$(docker ps --filter "name=op-node" -q)
# get the bridge contract address
BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .L1StandardBridgeProxy) BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .L1StandardBridgeProxy)
# get the funded account's pk # get the funded account's pk
ACCOUNT_PK=$(docker exec $NODE_CONTAINER jq -r '.AdminKey' /l2-accounts/accounts.json) ACCOUNT_PK=$(docker exec $NODE_CONTAINER jq -r '.AdminKey' /l2-accounts/accounts.json)
``` ```
@ -191,15 +197,15 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
5. Use cast to send some ETH to the bridge contract: 5. Use cast to send some ETH to the bridge contract:
```bash ```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK" op-cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK
``` ```
6. Allow a couple minutes for the bridge to complete 6. Allow a couple minutes for the bridge to complete.
7. Check the L2 balance again (it should show the bridged funds): 7. Check the L2 balance again (it should show the bridged funds):
```bash ```bash
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC" op-cast balance $ACCOUNT --rpc-url $L2_RPC
# 1000000000000000000 # 1000000000000000000
``` ```