Skip to content

Commit

Permalink
chore(protocol): correct a documentation error, improve sendEtherAndV…
Browse files Browse the repository at this point in the history
…erify (#16420)
  • Loading branch information
dantaik committed Mar 13, 2024
1 parent 17abc18 commit fc9f19f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
5 changes: 3 additions & 2 deletions packages/protocol/contracts/bridge/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ interface IBridge {
address refundTo;
// value to invoke on the destination chain.
uint256 value;
// Processing fee for the relayer. Zero if owner will process themself.
// Processing fee for the relayer.
uint256 fee;
// gasLimit to invoke on the destination chain.
// gasLimit to invoke on the destination chain. If this value is zero, only destOwner can
// process the message.
uint256 gasLimit;
// callData to invoke on the destination chain.
bytes data;
Expand Down
26 changes: 15 additions & 11 deletions packages/protocol/contracts/bridge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,29 @@ If user wants to bridge ether, he/she will initiate a bridge transaction with `s

```
struct Message {
// Message ID.
uint256 id;
// Message sender address.
// Message ID whose value is automatically assigned.
uint128 id;
// The address, EOA or contract, that interacts with this bridge.
// The value is automatically assigned.
address from;
// Source chain ID.
// Source chain ID whose value is automatically assigned.
uint64 srcChainId;
// Destination chain ID where the `to` address lives.
uint64 destChainId;
// User address of the bridged asset.
address user;
// Destination user address.
// The owner of the message on the source chain.
address srcOwner;
// The owner of the message on the destination chain.
address destOwner;
// The destination address on the destination chain.
address to;
// Alternate address to send any refund. If blank, defaults to user.
address refundAddress;
// Alternate address to send any refund on the destination chain.
// If blank, defaults to destOwner.
address refundTo;
// value to invoke on the destination chain.
uint256 value;
// Processing fee for the relayer. Zero if user will process themselves.
// Processing fee for the relayer.
uint256 fee;
// gasLimit to invoke on the destination chain.
// gasLimit to invoke on the destination chain. If this value is zero, only destOwner can process the message.
uint256 gasLimit;
// callData to invoke on the destination chain.
bytes data;
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/contracts/libs/LibAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ library LibAddress {
/// @param _amount The amount of Ether to send in wei.
/// @param _gasLimit The max amount gas to pay for this transaction.
function sendEtherAndVerify(address _to, uint256 _amount, uint256 _gasLimit) internal {
if (_amount == 0) return;
if (!sendEther(_to, _amount, _gasLimit, "")) {
revert ETH_TRANSFER_FAILED();
}
Expand Down

0 comments on commit fc9f19f

Please sign in to comment.