You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(l2): add quick handsOn on bridging assets between L1 and L2 (#2589)
**Motivation**
This PR tries to show some basic walkthrough on moving assets between
the two chains in the docs
**Description**
* Add an example of how to deposit and how to withdraw funds in L2 and
L1.
* Explain the deposit functions from the CommonBridge contract in the L1
Closes#2524
---------
Co-authored-by: Ivan Litteri <[email protected]>
Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
- The address of the deployed CommonBridge L2 contract (note here that we are calling the L2 contract instead of the L1 as in the deposit case). You can use:
- An Ethereum utility tool like [Rex](https://github.com/lambdaclass/rex).
80
+
81
+
2. Make the Withdraw:
82
+
83
+
Using Rex we simply use the `rex l2 withdraw` command (it uses the default CommonBridge address).
84
+
```Shell
85
+
# Format: rex l2 withdraw <AMOUNT> <PRIVATE_KEY> [RPC_URL]
86
+
rex l2 withdraw 5000 0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
87
+
```
88
+
89
+
If the withdraw is successful, the hash will be printed in the format:
90
+
91
+
```
92
+
Withdrawal sent: <L2_WITHDRAWAL_TX_HASH>
93
+
...
94
+
```
95
+
96
+
3. Claim the Withdraw:
97
+
98
+
After making the withdraw it has to be claimed in the L1. This is done with the L1 CommonBridge contract. We can use the Rex command`rex l2 claim-withdraw`. Here we have to use the tx hash obtained in the previous step. Also, it is necessary to waitfor the block that includes the withdraw to be verified.
99
+
100
+
```Shell
101
+
# Format: rex l2 claim-withdraw <L2_WITHDRAWAL_TX_HASH> <PRIVATE_KEY> <BRIDGE_ADDRESS>
102
+
rex l2 claim-withdraw <L2_WITHDRAWAL_TX_HASH> 0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 0x65dd6dc5df74b7e08e92c910122f91d7b2d5184f
103
+
```
104
+
105
+
4. Verification:
106
+
107
+
Once the withdrawal is made you can verify the balance has decrease with:
108
+
```Shell
109
+
rex l2 balance 0x8943545177806ed17b9f23f0a21ee5948ecaa776
110
+
```
111
+
112
+
And also increased in the L1:
113
+
```Shell
114
+
rex balance 0x8943545177806ed17b9f23f0a21ee5948ecaa776
115
+
```
116
+
40
117
## Configuration
41
118
42
119
Configuration consists of two steps, the parsing of a `.toml` config file and the creation and modification of a `.env` file, then each component reads the `.env` to load the environment variables. A detailed list is available in each part documentation.
0 commit comments