Skip to content

Commit

Permalink
fix(contracts): remove payable from relayCalls
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickGT committed Dec 13, 2022
1 parent 5647bd8 commit 97e1a9b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To use ERC-5164 to send messages your contract code will need to:
- On the sending chain, send a batch of calls to the CrossChainRelayer `relayCalls` function
- Listen for calls from the corresponding CrossChainExecutor(s) on the receiving chain.

*The listener will need to be able to unpack the original sender address (it's appended to calldata). We recommend inheriting from the included [`ExecutorAware.sol`](./src/abstract/ExecutorAware.sol) contract.*
_The listener will need to be able to unpack the original sender address (it's appended to calldata). We recommend inheriting from the included [`ExecutorAware.sol`](./src/abstract/ExecutorAware.sol) contract._

**Note**

Expand Down
1 change: 0 additions & 1 deletion src/ethereum-arbitrum/EthereumToArbitrumRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ contract CrossChainRelayerArbitrum is ICrossChainRelayer {
/// @inheritdoc ICrossChainRelayer
function relayCalls(CallLib.Call[] calldata _calls, uint256 _gasLimit)
external
payable
returns (uint256)
{
uint256 _maxGasLimit = maxGasLimit;
Expand Down
1 change: 0 additions & 1 deletion src/ethereum-optimism/EthereumToOptimismRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ contract CrossChainRelayerOptimism is ICrossChainRelayer {
/// @inheritdoc ICrossChainRelayer
function relayCalls(CallLib.Call[] calldata _calls, uint256 _gasLimit)
external
payable
returns (uint256)
{
uint256 _maxGasLimit = maxGasLimit;
Expand Down
1 change: 0 additions & 1 deletion src/ethereum-polygon/EthereumToPolygonRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ contract CrossChainRelayerPolygon is ICrossChainRelayer, FxBaseRootTunnel {
/// @inheritdoc ICrossChainRelayer
function relayCalls(CallLib.Call[] calldata _calls, uint256 _gasLimit)
external
payable
returns (uint256)
{
uint256 _maxGasLimit = maxGasLimit;
Expand Down
7 changes: 2 additions & 5 deletions src/interfaces/ICrossChainRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "../libraries/CallLib.sol";
/**
* @title CrossChainRelayer interface
* @notice CrossChainRelayer interface of the ERC-5164 standard as defined in the EIP.
* @dev Use `ICrossChainRelayerPayable` if the bridge you want to integrate requires a payment in the native currency.
*/
interface ICrossChainRelayer {
/**
Expand Down Expand Up @@ -35,13 +36,9 @@ interface ICrossChainRelayer {
* @notice Relay the calls to the receiving chain.
* @dev Must increment a `nonce` so that the batch of calls can be uniquely identified.
* @dev Must emit the `RelayedCalls` event when successfully called.
* @dev May require payment. Some bridges may require payment in the native currency, so the function is payable.
* @param calls Array of calls being relayed
* @param gasLimit Maximum amount of gas required for the `calls` to be executed
* @return uint256 Nonce to uniquely idenfity the batch of calls
*/
function relayCalls(CallLib.Call[] calldata calls, uint256 gasLimit)
external
payable
returns (uint256);
function relayCalls(CallLib.Call[] calldata calls, uint256 gasLimit) external returns (uint256);
}
47 changes: 47 additions & 0 deletions src/interfaces/ICrossChainRelayerPayable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.16;

import "../libraries/CallLib.sol";

/**
* @title CrossChainRelayer interface
* @notice CrossChainRelayer interface of the ERC-5164 standard as defined in the EIP.
*/
interface ICrossChainRelayerPayable {
/**
* @notice Custom error emitted if the `gasLimit` passed to `relayCalls`
* is greater than the one provided for free on the receiving chain.
* @param gasLimit Gas limit passed to `relayCalls`
* @param maxGasLimit Gas limit provided for free on the receiving chain
*/
error GasLimitTooHigh(uint256 gasLimit, uint256 maxGasLimit);

/**
* @notice Emitted when calls have successfully been relayed to the executor chain.
* @param nonce Nonce to uniquely idenfity the batch of calls
* @param sender Address of the sender
* @param calls Array of calls being relayed
* @param gasLimit Maximum amount of gas required for the `calls` to be executed
*/
event RelayedCalls(
uint256 indexed nonce,
address indexed sender,
CallLib.Call[] calls,
uint256 gasLimit
);

/**
* @notice Relay the calls to the receiving chain.
* @dev Must increment a `nonce` so that the batch of calls can be uniquely identified.
* @dev Must emit the `RelayedCalls` event when successfully called.
* @dev May require payment. Some bridges requires payment in the native currency, so the function is payable.
* @param calls Array of calls being relayed
* @param gasLimit Maximum amount of gas required for the `calls` to be executed
* @return uint256 Nonce to uniquely idenfity the batch of calls
*/
function relayCalls(CallLib.Call[] calldata calls, uint256 gasLimit)
external
payable
returns (uint256);
}

0 comments on commit 97e1a9b

Please sign in to comment.