From ec645b2f5742c0e5eaaf1376ab3f025d8e4cbc29 Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 13 Sep 2024 14:20:27 +0200 Subject: [PATCH] missing natspec --- v2/contracts/evm/GatewayEVM.sol | 6 +++ v2/contracts/evm/interfaces/IGatewayEVM.sol | 11 +++++ v2/contracts/zevm/GatewayZEVM.sol | 14 ++++++ v2/contracts/zevm/interfaces/IGatewayZEVM.sol | 43 +++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/v2/contracts/evm/GatewayEVM.sol b/v2/contracts/evm/GatewayEVM.sol index 417bb50e..221ab6d7 100644 --- a/v2/contracts/evm/GatewayEVM.sol +++ b/v2/contracts/evm/GatewayEVM.sol @@ -138,6 +138,7 @@ contract GatewayEVM is /// @notice Executes a call to a destination address without ERC20 tokens. /// @dev This function can only be called by the TSS address and it is payable. + /// @param messageContext Message context containing sender and arbitrary call flag. /// @param destination Address to call. /// @param data Calldata to pass to the call. /// @return The result of the call. @@ -166,6 +167,11 @@ contract GatewayEVM is return result; } + /// @notice Executes a call to a destination address without ERC20 tokens. + /// @dev This function can only be called by the TSS address and it is payable. + /// @param destination Address to call. + /// @param data Calldata to pass to the call. + /// @return The result of the call. function execute( address destination, bytes calldata data diff --git a/v2/contracts/evm/interfaces/IGatewayEVM.sol b/v2/contracts/evm/interfaces/IGatewayEVM.sol index 4a545410..241e2951 100644 --- a/v2/contracts/evm/interfaces/IGatewayEVM.sol +++ b/v2/contracts/evm/interfaces/IGatewayEVM.sol @@ -81,6 +81,7 @@ interface IGatewayEVMErrors { /// @notice Error when trying to transfer not whitelisted token to custody. error NotWhitelistedInCustody(); + /// @notice Error when trying to call onCall method using arbitrary call. error NotAllowedToCallOnCall(); } @@ -113,6 +114,12 @@ interface IGatewayEVM is IGatewayEVMErrors, IGatewayEVMEvents { /// @return The result of the contract call. function execute(address destination, bytes calldata data) external payable returns (bytes memory); + /// @notice Executes a call to a destination address without ERC20 tokens. + /// @dev This function can only be called by the TSS address and it is payable. + /// @param messageContext Message context containing sender and arbitrary call flag. + /// @param destination Address to call. + /// @param data Calldata to pass to the call. + /// @return The result of the call. function execute( MessageContext calldata messageContext, address destination, @@ -183,11 +190,15 @@ interface IGatewayEVM is IGatewayEVMErrors, IGatewayEVMEvents { function call(address receiver, bytes calldata payload, RevertOptions calldata revertOptions) external; } +/// @notice Message context passed to execute function. +/// @param sender Sender from omnichain contract. +/// @param isArbitraryCall Indicates if call should be arbitrary or authenticated. struct MessageContext { address sender; bool isArbitraryCall; } +/// @notice Interface implemented by contracts receiving authenticated calls. interface Callable { function onCall(address sender, bytes calldata message) external returns (bytes memory); } diff --git a/v2/contracts/zevm/GatewayZEVM.sol b/v2/contracts/zevm/GatewayZEVM.sol index 81e06976..836ed2b8 100644 --- a/v2/contracts/zevm/GatewayZEVM.sol +++ b/v2/contracts/zevm/GatewayZEVM.sol @@ -193,6 +193,13 @@ contract GatewayZEVM is ); } + /// @notice Withdraw ZRC20 tokens and call a smart contract on an external chain. + /// @param receiver The receiver address on the external chain. + /// @param amount The amount of tokens to withdraw. + /// @param zrc20 The address of the ZRC20 token. + /// @param message The calldata to pass to the contract call. + /// @param callOptions Call options including gas limit and arbirtrary call flag. + /// @param revertOptions Revert options. function withdrawAndCall( bytes memory receiver, uint256 amount, @@ -290,6 +297,13 @@ contract GatewayZEVM is ); } + /// @notice Withdraw ZETA tokens and call a smart contract on an external chain. + /// @param receiver The receiver address on the external chain. + /// @param amount The amount of tokens to withdraw. + /// @param chainId Chain id of the external chain. + /// @param message The calldata to pass to the contract call. + /// @param callOptions Call options including gas limit and arbirtrary call flag. + /// @param revertOptions Revert options. function withdrawAndCall( bytes memory receiver, uint256 amount, diff --git a/v2/contracts/zevm/interfaces/IGatewayZEVM.sol b/v2/contracts/zevm/interfaces/IGatewayZEVM.sol index 36e009fa..73108d3b 100644 --- a/v2/contracts/zevm/interfaces/IGatewayZEVM.sol +++ b/v2/contracts/zevm/interfaces/IGatewayZEVM.sol @@ -134,17 +134,51 @@ interface IGatewayZEVM is IGatewayZEVMErrors, IGatewayZEVMEvents { ) external; + /// @notice Withdraw ZRC20 tokens and call a smart contract on an external chain. + /// @param receiver The receiver address on the external chain. + /// @param amount The amount of tokens to withdraw. + /// @param zrc20 The address of the ZRC20 token. + /// @param message The calldata to pass to the contract call. + /// @param callOptions Call options including gas limit and arbirtrary call flag. + /// @param revertOptions Revert options. + function withdrawAndCall( + bytes memory receiver, + uint256 amount, + address zrc20, + bytes calldata message, + CallOptions calldata callOptions, + RevertOptions calldata revertOptions + ) + external; + + /// @notice Withdraw ZETA tokens and call a smart contract on an external chain. + /// @param receiver The receiver address on the external chain. + /// @param amount The amount of tokens to withdraw. + /// @param chainId Chain id of the external chain. + /// @param message The calldata to pass to the contract call. + /// @param revertOptions Revert options. + function withdrawAndCall( + bytes memory receiver, + uint256 amount, + uint256 chainId, + bytes calldata message, + RevertOptions calldata revertOptions + ) + external; + /// @notice Withdraw ZETA tokens and call a smart contract on an external chain. /// @param receiver The receiver address on the external chain. /// @param amount The amount of tokens to withdraw. /// @param chainId Chain id of the external chain. /// @param message The calldata to pass to the contract call. + /// @param callOptions Call options including gas limit and arbirtrary call flag. /// @param revertOptions Revert options. function withdrawAndCall( bytes memory receiver, uint256 amount, uint256 chainId, bytes calldata message, + CallOptions calldata callOptions, RevertOptions calldata revertOptions ) external; @@ -164,6 +198,12 @@ interface IGatewayZEVM is IGatewayZEVMErrors, IGatewayZEVMEvents { ) external; + /// @notice Call a smart contract on an external chain without asset transfer. + /// @param receiver The receiver address on the external chain. + /// @param zrc20 Address of zrc20 to pay fees. + /// @param message The calldata to pass to the contract call. + /// @param gasLimit Gas limit. + /// @param revertOptions Revert options. function call( bytes memory receiver, address zrc20, @@ -241,6 +281,9 @@ interface IGatewayZEVM is IGatewayZEVMErrors, IGatewayZEVMEvents { external; } +/// @notice CallOptions struct passed to call and withdrawAndCall functions. +/// @param gasLimit Gas limit. +/// @param isArbitraryCall Indicates if call should be arbitrary or authenticated. struct CallOptions { uint256 gasLimit; bool isArbitraryCall;