feat(cgt): bridge spec#48
Conversation
| - [Overview](#overview) | ||
| - [Custom Gas Token Bridges](#custom-gas-token-bridges) | ||
| - [Token Flow](#token-flow) | ||
| - [L1CGTBridge](#l1cgtbridge) |
There was a problem hiding this comment.
In the other documents the bridges are named like StandardBridge and L2StandardBridge, I propose to name it like :
L1StandardCGTBridge and L2StandardCGTBridge
There was a problem hiding this comment.
I think they won't be standard anymore :(
|
|
||
| ## Custom Gas Token Bridges | ||
|
|
||
| The Custom Gas Token (CGT) bridges enable bidirectional transfers between L1 ERC20 tokens and L2 native assets on chains using Custom Gas Token mode. Unlike standard bridges that handle ETH and generic ERC20 tokens, CGT bridges are specifically designed to convert between a designated L1 ERC20 token and the L2's native gas-paying asset. |
There was a problem hiding this comment.
The Custom Gas Token (CGT) bridges enable bidirectional transfers between a specific L1 ERC20 token, designated for CGT mode, and the L2’s native gas-paying asset. Standard bridges typically handle ETH and generic ERC20 tokens, but CGT bridges are purpose-built to support the conversion between the chosen L1 token and the L2 native asset
I suggest to made it clear the ERC20 is the one picked for CGT mode, not arbitrary. Also, “unlike” sounds like a drawback, instead of a feature.
|
|
||
| **L1 → L2 Flow (ERC20 to Native Asset):** | ||
|
|
||
| 1. User calls `bridgeCGTTo()` on L1CGTBridge with ERC20 tokens |
|
|
||
| **L1 → L2 Flow (ERC20 to Native Asset):** | ||
|
|
||
| 1. User calls `bridgeCGTTo()` on L1CGTBridge with ERC20 tokens |
There was a problem hiding this comment.
suggestion
User calls bridgeCGT() on L1CGTBridge to transfer the specified amount of the designated ERC20 for bridging.
L1CGTBridge locks ERC20 tokens and sends a cross-domain message to L2CGTBridge via L1CrossDomainMessenger
|
|
||
| **L2 → L1 Flow (Native Asset to ERC20):** | ||
|
|
||
| 1. User calls `bridgeCGTTo()` on L2CGTBridge with native assets (msg.value) |
| - MUST revert if `_amount` is zero | ||
| - MUST revert if caller has insufficient token balance or allowance | ||
|
|
||
| #### `bridgeCGTTo` |
There was a problem hiding this comment.
Change to bridgeCGT
Bridges the specified amount of the designated ERC20 from L1 to L2 to a specified recipient.
| - MUST transfer `_amount` of CGT ERC20 tokens from `msg.sender` to the bridge contract | ||
| - MUST send a message to L2CGTBridge via CrossDomainMessenger to mint equivalent native assets to `_to` | ||
| - MUST emit `CGTBridgeInitiated` event | ||
| - MUST revert if `_to` is zero address |
There was a problem hiding this comment.
delete it, if zero address msg.sender is the destination address
|
|
||
| The L2CGTBridge is a predeploy contract that handles the L2 side of CGT bridging operations. See the [L2CGTBridge predeploy specification](predeploys.md#l2cgtbridge) for complete interface and function definitions. | ||
|
|
||
| Address: `0x420000000000000000000000000000000000002B` |
| 2. Verifying the `xDomainMessageSender()` matches the expected counterpart bridge address | ||
| 3. Only processing messages that originate from the trusted counterpart bridge | ||
|
|
||
| ## Security Considerations |
There was a problem hiding this comment.
We should add here the precompute address for L1 and L2 bridges
| | -------------------- | ------------------------------------------ | ---------- | ---------- | ------- | | ||
| | NativeAssetLiquidity | 0x4200000000000000000000000000000000000029 | Jovian | No | Yes | | ||
| | LiquidityController | 0x420000000000000000000000000000000000002A | Jovian | No | Yes | | ||
| | L2CGTBridge | 0x420000000000000000000000000000000000002B | Jovian | No | Yes | |
Closes OPT-1011