Skip to content

Commit b8c15d8

Browse files
WIP more info about ABIs and events
1 parent 4174179 commit b8c15d8

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

docs/bridging/bridging-fa-how.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The process of bridging FA-compatible tokens from layer 1 to Etherlink (also kno
3232
For information about token access control, see [Token standards](https://docs.tezos.com/architecture/tokens#token-standards) on docs.tezos.com.
3333

3434
1. The user calls the helper contract's `deposit` entrypoint.
35-
The request includes the amount of tokens to bridge, the address of the Etherlink Smart Rollup, and the user's Etherlink wallet address, but not the tokens themselves.
35+
The request includes the address of the Etherlink Smart Rollup, the user's Etherlink account address, and the amount of tokens to bridge, but not the tokens themselves.
3636

3737
1. The token bridge helper contract stores the address of the Etherlink Smart Rollup and the user's Etherlink address temporarily.
3838

@@ -55,6 +55,12 @@ The request includes the amount of tokens to bridge, the address of the Etherlin
5555
1. Any user can call the FA bridging precompiled contract's `claim` function, which causes the contract to call the ERC-20 proxy contract.
5656
For tokens supported by the bridge, an automated program calls the `claim` function for you.
5757

58+
You can call the `claim` function yourself with this ABI, using the `depositId` field from the event:
59+
60+
```
61+
claim(uint256 depositId)
62+
```
63+
5864
1. The ERC-20 proxy contract mints the equivalent tokens and sends them to the user's Etherlink account.
5965

6066
This diagram is an overview of the process of bridging tokens from layer 1 to Etherlink:
@@ -104,11 +110,11 @@ When a deposit is ready to be claimed, the FA bridging precompiled contract (`0x
104110

105111
Field | Type | Description
106112
--- | --- | ---
107-
`ticket_owner` | address | ???
108-
`receiver` | address | The Etherlink account that will receive the claimed tokens
113+
`depositId` | uint265 | The ID of the bridging transaction that users need to claim the pending deposit
114+
`recipient` | address | The Etherlink account that will receive the claimed tokens
109115
`amount` | uint256 | The amount of tokens
110-
`inbox_level` | unit256 | ???
111-
`inbox_msg_id` | unit256 | The ID of the bridging transaction that users need to claim the pending deposit
116+
`timelock` | uint256 | ???
117+
`depositCount` | uint256 | ???
112118

113119
### `Deposit` event
114120

@@ -128,7 +134,6 @@ TODO ^ This info from `etherlink/kernel_latest/evm_execution/src/fa_bridge/depos
128134

129135
When an account initiates a withdrawal, the FA bridging precompiled contract (`0xff0...0002`) emits a `Withdrawal` event that includes the following information:
130136

131-
132137
Field | Type | Description
133138
--- | --- | ---
134139
`amount` | unit256 | The amount of tokens
@@ -138,7 +143,7 @@ Field | Type | Description
138143

139144
### TODO other events
140145

141-
TODO other withdrawal events from `etherlink/kernel_latest/evm_execution/src/fa_bridge/withdrawal.rs`:
146+
TODO other withdrawal events from `etherlink/kernel_latest/evm_execution/src/fa_bridge/withdrawal.rs` but I'm not sure if these fields translate directly to the fields in the event because they seemed to be different for the deposit events:
142147

143148
```rust
144149
alloy_sol_types::sol! {

docs/bridging/bridging-fa-transactions.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ Follow these steps to deposit FA-compliant tokens from layer 1 to Etherlink:
5252
--burn-cap 0.1
5353
```
5454
55+
For reference, this is the Micheline type for the parameter for this transaction:
56+
57+
```michelson
58+
(pair %deposit (address %rollup) (pair (bytes %receiver) (nat %amount)))
59+
```
60+
5561
The token bridge helper contract sends the tokens to the ticketer contract, which issues a ticket that represents the tokens.
5662
The token bridge helper contract sends that ticket to Etherlink.
5763
64+
When Etherlink receives that deposit, the FA bridging precompiled contract (`0xff0...0002`) emits a `QueuedDeposit` event that includes the `depositId` for the deposit, which is needed to claim the deposit; see [Event reference](/bridging/bridging-fa-how#event-reference).
65+
5866
1. When the deposit is in an Etherlink block, call the FA bridging precompiled contract contract's `claim` function to cause the ERC-20 proxy contract to mint the tokens.
5967

60-
The address of the precompiled contract is `0xff00000000000000000000000000000000000002` and to call the function you can use the ABI `claim(uint256 depositId)`, where `depositId` matches the `depositId` that was emitted in a previous event for this transfer by the precompile (`QueuedDeposit(uint256 depositId, address recipient, uint256 amount, uint256 timelock, uint256 depositCount)`).
68+
The address of the precompiled contract is `0xff00000000000000000000000000000000000002` and to call the function you can use the ABI `claim(uint256 depositId)`, where `depositId` matches the `depositId` that was emitted in a previous event.
6169

6270
As a reference, here is an [example of the sequencer injecting a deposit](https://explorer.etherlink.com/tx/0x5a06fe64e880d6d1f53c243477cd5656204712f1543b607340996ad246158669) and here is an [example of the corresponding claim transaction](https://explorer.etherlink.com/tx/0xe017665cd7bfdef375a863114ac9f7ed2538da4d8584b0f1e0aa71ce96342aee).
6371

@@ -69,6 +77,8 @@ Follow these steps to deposit FA-compliant tokens from layer 1 to Etherlink:
6977

7078
:::
7179

80+
When the deposit has been claimed, the FA bridging precompiled contract (`0xff0...0002`) emits a `Deposit` event; see [Event reference](/bridging/bridging-fa-how#event-reference).
81+
7282
To see the tokens in your Etherlink wallet, look up the ERC-20 proxy contract in a block explorer or use its address to manually add the tokens to your wallet.
7383
Because the Etherlink tokens are compatible with the ERC-20 standard, EVM-compatible wallets should be able to display them.
7484

0 commit comments

Comments
 (0)