Update readme

This commit is contained in:
Roy Crihfield 2024-08-30 19:00:38 +08:00
parent 14642b1174
commit defe41869f

View File

@ -154,7 +154,7 @@ docker logs -f <CONTAINER_ID>
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:
@ -173,16 +173,22 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
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:
```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):
```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
```
@ -191,8 +197,8 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
```bash
# get the container id for op-node
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)
# get the funded account's pk
ACCOUNT_PK=$(docker exec $NODE_CONTAINER jq -r '.AdminKey' /l2-accounts/accounts.json)
```
@ -200,15 +206,15 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
5. Use cast to send some ETH to the bridge contract:
```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):
```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
```