Skip to content

Commit a698759

Browse files
committed
fix: correctly extract address from padded ABI-encoded log topic
1 parent 9b45a64 commit a698759

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docs/dev/bridge-erc20.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ Parse the `localToken` field from the receipt to get your L2 token address.
7575

7676
```bash
7777
# Extract the L2 token address from the event logs
78-
# topic[0] is keccak256("OptimismMintableERC20Created(address,address,address)")
78+
# topics[0] is keccak256("OptimismMintableERC20Created(address,address,address)")
79+
# topics[1] is the L2 token address ABI-encoded as a 32-byte padded value; [26:] strips the leading zeros
7980
cast receipt $TX_HASH --rpc-url $L2_RPC --json \
80-
| jq '.logs[] | select(.topics[0] == "0x52fe89dd5930f343d25650b62fd367bae47088bcddffd2a88350a6ecdd620cdb") | .topics[1]'
81+
| jq -r '.logs[] | select(.topics[0] == "0x52fe89dd5930f343d25650b62fd367bae47088bcddffd2a88350a6ecdd620cdb") | "0x" + .topics[1][26:]'
8182
```
8283

8384
{% endstep %}

0 commit comments

Comments
 (0)