From 43f17eda058e7e2da576c0c8302d36b76701e405 Mon Sep 17 00:00:00 2001
From: skeletor-spaceman Transfer It SHOULD burn Token Bridging<
Functions
sendERC20
_amount
amount of tokens to address _to
in chain _chainId
._amount
tokens and initialize a message to the L2ToL2CrossChainMessenger
to mint the _amount
-in the target address _to
at _chainId
and emit the SendERC20
event including the msg.sender
as parameter._to
at _chainId
and emit the SentERC20
event including the msg.sender
as parameter.
sendERC20(address _to, uint256 _amount, uint256 _chainId)
relayERC20
relayERC20
relayERC20(address _from, address _to, uint256 _amount)
SendERC20
SentERC20
MUST trigger when a cross-chain transfer is initiated using sendERC20
.
event SendERC20(address indexed from, address indexed to, uint256 amount, uint256 destination)
+event SentERC20(address indexed from, address indexed to, uint256 amount, uint256 destination)
-RelayERC20
+RelayedERC20
MUST trigger when a cross-chain transfer is finalized using relayERC20
.
-event RelayERC20(address indexed from, address indexed to, uint256 amount, uint256 source);
+event RelayedERC20(address indexed from, address indexed to, uint256 amount, uint256 source);
Diagram
The following diagram depicts a cross-chain transfer.
@@ -261,11 +261,11 @@ Diagram
from->>SuperERC20_A: sendERC20To(to, amount, chainID)
SuperERC20_A->>SuperERC20_A: burn(from, amount)
SuperERC20_A->>Messenger_A: sendMessage(chainId, message)
- SuperERC20_A-->SuperERC20_A: emit SendERC20(from, to, amount, destination)
+ SuperERC20_A-->SuperERC20_A: emit SentERC20(from, to, amount, destination)
Inbox->>Messenger_B: relayMessage()
Messenger_B->>SuperERC20_B: relayERC20(from, to, amount)
SuperERC20_B->>SuperERC20_B: mint(to, amount)
- SuperERC20_B-->SuperERC20_B: emit RelayERC20(from, to, amount, source)
+ SuperERC20_B-->SuperERC20_B: emit RelayedERC20(from, to, amount, source)
Implementation
An example implementation that depends on deterministic deployments across chains
@@ -276,7 +276,7 @@
Implementation<
_burn(msg.sender, _amount);
bytes memory _message = abi.encodeCall(this.relayERC20, (msg.sender, _to, _amount));
L2ToL2CrossDomainMessenger.sendMessage(_chainId, address(this), _message);
- emit SendERC20(msg.sender, _to, _amount, _chainId);
+ emit SentERC20(msg.sender, _to, _amount, _chainId);
}
function relayERC20(address _from, address _to, uint256 _amount) external {
@@ -286,7 +286,7 @@ Implementation<
_mint(_to, _amount);
- emit RelayERC20(_from, _to, _amount, _source);
+ emit RelayedERC20(_from, _to, _amount, _source);
}
sendERC20()
should emit a SendERC20
event. `relayERC20()
should emit a RelayERC20
event.sendERC20()
should emit a SentERC20
event. `relayERC20()
should emit a RelayedERC20
event.sendERC20
Transfer _amount
amount of tokens to address _to
in chain _chainId
.
It SHOULD burn _amount
tokens and initialize a message to the L2ToL2CrossChainMessenger
to mint the _amount
-in the target address _to
at _chainId
and emit the SendERC20
event including the msg.sender
as parameter.
_to
at _chainId
and emit the SentERC20
event including the msg.sender
as parameter.
sendERC20(address _to, uint256 _amount, uint256 _chainId)
relayERC20
relayERC20
relayERC20(address _from, address _to, uint256 _amount)
SendERC20
SentERC20
MUST trigger when a cross-chain transfer is initiated using sendERC20
.
event SendERC20(address indexed from, address indexed to, uint256 amount, uint256 destination)
+event SentERC20(address indexed from, address indexed to, uint256 amount, uint256 destination)
-RelayERC20
+RelayedERC20
MUST trigger when a cross-chain transfer is finalized using relayERC20
.
-event RelayERC20(address indexed from, address indexed to, uint256 amount, uint256 source);
+event RelayedERC20(address indexed from, address indexed to, uint256 amount, uint256 source);
Diagram
The following diagram depicts a cross-chain transfer.
@@ -9658,11 +9658,11 @@ Diagram
from->>SuperERC20_A: sendERC20To(to, amount, chainID)
SuperERC20_A->>SuperERC20_A: burn(from, amount)
SuperERC20_A->>Messenger_A: sendMessage(chainId, message)
- SuperERC20_A-->SuperERC20_A: emit SendERC20(from, to, amount, destination)
+ SuperERC20_A-->SuperERC20_A: emit SentERC20(from, to, amount, destination)
Inbox->>Messenger_B: relayMessage()
Messenger_B->>SuperERC20_B: relayERC20(from, to, amount)
SuperERC20_B->>SuperERC20_B: mint(to, amount)
- SuperERC20_B-->SuperERC20_B: emit RelayERC20(from, to, amount, source)
+ SuperERC20_B-->SuperERC20_B: emit RelayedERC20(from, to, amount, source)
Implementation
An example implementation that depends on deterministic deployments across chains
@@ -9673,7 +9673,7 @@
Implementation<
_burn(msg.sender, _amount);
bytes memory _message = abi.encodeCall(this.relayERC20, (msg.sender, _to, _amount));
L2ToL2CrossDomainMessenger.sendMessage(_chainId, address(this), _message);
- emit SendERC20(msg.sender, _to, _amount, _chainId);
+ emit SentERC20(msg.sender, _to, _amount, _chainId);
}
function relayERC20(address _from, address _to, uint256 _amount) external {
@@ -9683,7 +9683,7 @@ Implementation<
_mint(_to, _amount);
- emit RelayERC20(_from, _to, _amount, _source);
+ emit RelayedERC20(_from, _to, _amount, _source);
}
sendERC20()
should emit a SendERC20
event. `relayERC20()
should emit a RelayERC20
event.sendERC20()
should emit a SentERC20
event. `relayERC20()
should emit a RelayedERC20
event.withdraw
sendERC20
sendERC20
sendERC20ToAll invariants of sendERC20
.
- Message sent to
SuperchainWETH
on recipient chain includes to
address as recipient.
relayERC20
relayERC20
L2ToL2CrossDomainMessenger
.crossDomainMessageSender
is not the SuperchainWETH
contract.