Skip to content

Commit

Permalink
missing natspec
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Sep 13, 2024
1 parent d05288d commit ec645b2
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions v2/contracts/evm/GatewayEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions v2/contracts/evm/interfaces/IGatewayEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
14 changes: 14 additions & 0 deletions v2/contracts/zevm/GatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
43 changes: 43 additions & 0 deletions v2/contracts/zevm/interfaces/IGatewayZEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ec645b2

Please sign in to comment.