diff --git a/src/pages/developers/architecture/protocol/SUMMARY.md b/src/pages/developers/architecture/protocol/SUMMARY.md index 694bd285..74c38e3a 100644 --- a/src/pages/developers/architecture/protocol/SUMMARY.md +++ b/src/pages/developers/architecture/protocol/SUMMARY.md @@ -32,12 +32,14 @@ - [CoinType](contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md) - [zContext](contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md) - [zContract](contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md) + - [MessageContext](contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md) - [UniversalContract](contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md) - [GatewayZEVM](contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md) - [SystemContractErrors](contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md) - [SystemContract](contracts/zevm/SystemContract.sol/contract.SystemContract.md) - [ZRC20Errors](contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md) - [ZRC20](contracts/zevm/ZRC20.sol/contract.ZRC20.md) + - [INotSupportedMethods](contracts/Errors.sol/interface.INotSupportedMethods.md) - [RevertOptions](contracts/Revert.sol/struct.RevertOptions.md) - [RevertContext](contracts/Revert.sol/struct.RevertContext.md) - [Revertable](contracts/Revert.sol/interface.Revertable.md) diff --git a/src/pages/developers/architecture/protocol/contracts/Errors.sol/interface.INotSupportedMethods.md b/src/pages/developers/architecture/protocol/contracts/Errors.sol/interface.INotSupportedMethods.md new file mode 100644 index 00000000..937b574b --- /dev/null +++ b/src/pages/developers/architecture/protocol/contracts/Errors.sol/interface.INotSupportedMethods.md @@ -0,0 +1,13 @@ +# INotSupportedMethods +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/Errors.sol) + +Interface for contracts that with non supported methods. + + +## Errors +### ZETANotSupported + +```solidity +error ZETANotSupported(); +``` + diff --git a/src/pages/developers/architecture/protocol/contracts/README.md b/src/pages/developers/architecture/protocol/contracts/README.md index aea1f3f5..68e98a10 100644 --- a/src/pages/developers/architecture/protocol/contracts/README.md +++ b/src/pages/developers/architecture/protocol/contracts/README.md @@ -3,6 +3,7 @@ # Contents - [evm](/contracts/evm) - [zevm](/contracts/zevm) +- [INotSupportedMethods](Errors.sol/interface.INotSupportedMethods.md) - [RevertOptions](Revert.sol/struct.RevertOptions.md) - [RevertContext](Revert.sol/struct.RevertContext.md) - [Revertable](Revert.sol/interface.Revertable.md) diff --git a/src/pages/developers/architecture/protocol/contracts/Revert.sol/interface.Revertable.md b/src/pages/developers/architecture/protocol/contracts/Revert.sol/interface.Revertable.md index 0e44e885..828992d4 100644 --- a/src/pages/developers/architecture/protocol/contracts/Revert.sol/interface.Revertable.md +++ b/src/pages/developers/architecture/protocol/contracts/Revert.sol/interface.Revertable.md @@ -1,5 +1,5 @@ # Revertable -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/Revert.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/Revert.sol) Interface for contracts that support revertable calls. diff --git a/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertContext.md b/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertContext.md index ab1ac4d2..fa2adc5a 100644 --- a/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertContext.md +++ b/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertContext.md @@ -1,5 +1,5 @@ # RevertContext -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/Revert.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/Revert.sol) Struct containing revert context passed to onRevert. @@ -8,7 +8,7 @@ Struct containing revert context passed to onRevert. struct RevertContext { address sender; address asset; - uint64 amount; + uint256 amount; bytes revertMessage; } ``` @@ -19,6 +19,6 @@ struct RevertContext { |----|----|-----------| |`sender`|`address`|Address of account that initiated smart contract call.| |`asset`|`address`|Address of asset, empty if it's gas token.| -|`amount`|`uint64`|Amount specified with the transaction.| +|`amount`|`uint256`|Amount specified with the transaction.| |`revertMessage`|`bytes`|Arbitrary data sent back in onRevert.| diff --git a/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertOptions.md b/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertOptions.md index 366e2410..55acffa1 100644 --- a/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertOptions.md +++ b/src/pages/developers/architecture/protocol/contracts/Revert.sol/struct.RevertOptions.md @@ -1,5 +1,5 @@ # RevertOptions -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/Revert.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/Revert.sol) Struct containing revert options diff --git a/src/pages/developers/architecture/protocol/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md b/src/pages/developers/architecture/protocol/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md index 689e5653..ba9963b6 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md @@ -1,8 +1,8 @@ # ERC20Custody -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/ERC20Custody.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/ERC20Custody.sol) **Inherits:** -[IERC20Custody](/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md), ReentrancyGuard, AccessControl, Pausable +Initializable, UUPSUpgradeable, [IERC20Custody](/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md), ReentrancyGuardUpgradeable, AccessControlUpgradeable, PausableUpgradeable Holds the ERC20 tokens deposited on ZetaChain and includes functionality to call a contract. @@ -15,7 +15,7 @@ Gateway contract. ```solidity -IGatewayEVM public immutable gateway; +IGatewayEVM public gateway; ``` @@ -74,17 +74,32 @@ bytes32 public constant WHITELISTER_ROLE = keccak256("WHITELISTER_ROLE"); ## Functions -### constructor +### initialize -Constructor for ERC20Custody. +Initializer for ERC20Custody. *Set admin as default admin and pauser, and tssAddress as tss role.* ```solidity -constructor(address gateway_, address tssAddress_, address admin_); +function initialize(address gateway_, address tssAddress_, address admin_) public initializer; ``` +### _authorizeUpgrade + +*Authorizes the upgrade of the contract, sender must be owner.* + + +```solidity +function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`newImplementation`|`address`|Address of the new implementation.| + + ### pause Pause contract. @@ -103,6 +118,21 @@ Unpause contract. function unpause() external onlyRole(PAUSER_ROLE); ``` +### updateTSSAddress + +Update tss address + + +```solidity +function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`newTSSAddress`|`address`|new tss address| + + ### setSupportsLegacy Unpause contract. @@ -234,6 +264,9 @@ function withdrawAndRevert( Deposits asset to custody and pay fee in zeta erc20. +**Note:** +This method is deprecated. + ```solidity function deposit( diff --git a/src/pages/developers/architecture/protocol/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md b/src/pages/developers/architecture/protocol/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md index a5e9c818..4da40091 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md @@ -1,8 +1,8 @@ # GatewayEVM -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/GatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/GatewayEVM.sol) **Inherits:** -Initializable, AccessControlUpgradeable, UUPSUpgradeable, [IGatewayEVM](/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md), ReentrancyGuardUpgradeable, PausableUpgradeable +Initializable, AccessControlUpgradeable, UUPSUpgradeable, [IGatewayEVM](/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md), ReentrancyGuardUpgradeable, PausableUpgradeable, [INotSupportedMethods](/contracts/Errors.sol/interface.INotSupportedMethods.md) The GatewayEVM contract is the endpoint to call smart contracts on external chains. @@ -73,9 +73,21 @@ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); ``` +### MAX_PAYLOAD_SIZE +Max size of payload + revertOptions revert message. + + +```solidity +uint256 public constant MAX_PAYLOAD_SIZE = 1024; +``` + + ## Functions ### constructor +**Note:** +constructor + ```solidity constructor(); @@ -107,6 +119,21 @@ function _authorizeUpgrade(address newImplementation) internal override onlyRole |`newImplementation`|`address`|Address of the new implementation.| +### updateTSSAddress + +Update tss address + + +```solidity +function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`newTSSAddress`|`address`|new tss address| + + ### pause Pause contract. @@ -430,14 +457,14 @@ function setConnector(address zetaConnector_) external onlyRole(DEFAULT_ADMIN_RO |`zetaConnector_`|`address`|Address of the connector contract.| -### resetApproval +### _resetApproval *Resets the approval of a token for a specified address. This is used to ensure that the approval is set to zero before setting it to a new value.* ```solidity -function resetApproval(address token, address to) private returns (bool); +function _resetApproval(address token, address to) private returns (bool); ``` **Parameters** @@ -453,7 +480,7 @@ function resetApproval(address token, address to) private returns (bool); |``|`bool`|True if the approval reset was successful, false otherwise.| -### transferFromToAssetHandler +### _transferFromToAssetHandler *Transfers tokens from the sender to the asset handler. This function handles the transfer of tokens to either the connector or custody contract based on the asset @@ -461,7 +488,7 @@ type.* ```solidity -function transferFromToAssetHandler(address from, address token, uint256 amount) private; +function _transferFromToAssetHandler(address from, address token, uint256 amount) private; ``` **Parameters** @@ -472,7 +499,7 @@ function transferFromToAssetHandler(address from, address token, uint256 amount) |`amount`|`uint256`|Amount of tokens to transfer.| -### transferToAssetHandler +### _transferToAssetHandler *Transfers tokens to the asset handler. This function handles the transfer of tokens to either the connector or custody contract based on the asset @@ -480,7 +507,7 @@ type.* ```solidity -function transferToAssetHandler(address token, uint256 amount) private; +function _transferToAssetHandler(address token, uint256 amount) private; ``` **Parameters** @@ -541,10 +568,10 @@ function _executeAuthenticatedCall( |``|`bytes`|The result of the call.| -### revertIfOnCallOrOnRevert +### _revertIfOnCallOrOnRevert ```solidity -function revertIfOnCallOrOnRevert(bytes calldata data) private pure; +function _revertIfOnCallOrOnRevert(bytes calldata data) private pure; ``` diff --git a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md index bd21e0cc..b797eac1 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md @@ -1,8 +1,8 @@ # ZetaConnectorBase -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/ZetaConnectorBase.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/ZetaConnectorBase.sol) **Inherits:** -[IZetaConnectorEvents](/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md), ReentrancyGuard, Pausable, AccessControl +Initializable, UUPSUpgradeable, [IZetaConnectorEvents](/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md), ReentrancyGuardUpgradeable, PausableUpgradeable, AccessControlUpgradeable Abstract base contract for ZetaConnector. @@ -15,7 +15,7 @@ The Gateway contract used for executing cross-chain calls. ```solidity -IGatewayEVM public immutable gateway; +IGatewayEVM public gateway; ``` @@ -24,7 +24,16 @@ The address of the Zeta token. ```solidity -address public immutable zetaToken; +address public zetaToken; +``` + + +### tssAddress +The address of the TSS (Threshold Signature Scheme) contract. + + +```solidity +address public tssAddress; ``` @@ -56,17 +65,55 @@ bytes32 public constant TSS_ROLE = keccak256("TSS_ROLE"); ## Functions -### constructor +### initialize -Constructor for ZetaConnectors. +Initializer for ZetaConnectors. *Set admin as default admin and pauser, and tssAddress as tss role.* ```solidity -constructor(address gateway_, address zetaToken_, address tssAddress_, address admin_); +function initialize( + address gateway_, + address zetaToken_, + address tssAddress_, + address admin_ +) + public + virtual + initializer; ``` +### _authorizeUpgrade + +*Authorizes the upgrade of the contract, sender must be owner.* + + +```solidity +function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`newImplementation`|`address`|Address of the new implementation.| + + +### updateTSSAddress + +Update tss address + + +```solidity +function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE); +``` +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`newTSSAddress`|`address`|new tss address| + + ### pause Pause contract. diff --git a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md index ca5dfa6b..835d1ba6 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md @@ -1,5 +1,5 @@ # ZetaConnectorNative -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/ZetaConnectorNative.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/ZetaConnectorNative.sol) **Inherits:** [ZetaConnectorBase](/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md) @@ -10,17 +10,19 @@ Implementation of ZetaConnectorBase for native token handling. ## Functions -### constructor +### initialize ```solidity -constructor( +function initialize( address gateway_, address zetaToken_, address tssAddress_, address admin_ ) - ZetaConnectorBase(gateway_, zetaToken_, tssAddress_, admin_); + public + override + initializer; ``` ### withdraw @@ -34,7 +36,7 @@ Withdraw tokens to a specified address. function withdraw( address to, uint256 amount, - bytes32 internalSendHash + bytes32 ) external override @@ -48,7 +50,7 @@ function withdraw( |----|----|-----------| |`to`|`address`|The address to withdraw tokens to.| |`amount`|`uint256`|The amount of tokens to withdraw.| -|`internalSendHash`|`bytes32`|A hash used for internal tracking of the transaction.| +|``|`bytes32`|| ### withdrawAndCall @@ -63,7 +65,7 @@ function withdrawAndCall( address to, uint256 amount, bytes calldata data, - bytes32 internalSendHash + bytes32 ) external override @@ -78,7 +80,7 @@ function withdrawAndCall( |`to`|`address`|The address to withdraw tokens to.| |`amount`|`uint256`|The amount of tokens to withdraw.| |`data`|`bytes`|The calldata to pass to the contract call.| -|`internalSendHash`|`bytes32`|A hash used for internal tracking of the transaction.| +|``|`bytes32`|| ### withdrawAndRevert @@ -93,7 +95,7 @@ function withdrawAndRevert( address to, uint256 amount, bytes calldata data, - bytes32 internalSendHash, + bytes32, RevertContext calldata revertContext ) external @@ -109,7 +111,7 @@ function withdrawAndRevert( |`to`|`address`|The address to withdraw tokens to.| |`amount`|`uint256`|The amount of tokens to withdraw.| |`data`|`bytes`|The calldata to pass to the contract call.| -|`internalSendHash`|`bytes32`|A hash used for internal tracking of the transaction.| +|``|`bytes32`|| |`revertContext`|`RevertContext`|Revert context to pass to onRevert.| diff --git a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md index 1b484436..e77aae79 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md @@ -1,5 +1,5 @@ # ZetaConnectorNonNative -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/ZetaConnectorNonNative.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/ZetaConnectorNonNative.sol) **Inherits:** [ZetaConnectorBase](/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md) @@ -15,22 +15,24 @@ Max supply for minting. ```solidity -uint256 public maxSupply = type(uint256).max; +uint256 public maxSupply; ``` ## Functions -### constructor +### initialize ```solidity -constructor( +function initialize( address gateway_, address zetaToken_, address tssAddress_, address admin_ ) - ZetaConnectorBase(gateway_, zetaToken_, tssAddress_, admin_); + public + override + initializer; ``` ### setMaxSupply @@ -161,7 +163,7 @@ function receiveTokens(uint256 amount) external override whenNotPaused; ```solidity -function _mintTo(address to, uint256 amount, bytes32 internalSendHash) internal; +function _mintTo(address to, uint256 amount, bytes32 internalSendHash) private; ``` ## Events diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md index 0e62cbc7..40000f51 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md @@ -1,5 +1,5 @@ # IERC20Custody -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IERC20Custody.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IERC20Custody.sol) **Inherits:** [IERC20CustodyEvents](/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md), [IERC20CustodyErrors](/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md) diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md index 65aa6d6e..16835cd5 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md @@ -1,5 +1,5 @@ # IERC20CustodyErrors -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IERC20Custody.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IERC20Custody.sol) Interface for the errors used in the ERC20 custody contract. diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md index 2433e422..88f01457 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md @@ -1,5 +1,5 @@ # IERC20CustodyEvents -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IERC20Custody.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IERC20Custody.sol) Interface for the events emitted by the ERC20 custody contract. @@ -94,3 +94,18 @@ Emitted in legacy deposit method. event Deposited(bytes recipient, IERC20 indexed asset, uint256 amount, bytes message); ``` +### UpdatedCustodyTSSAddress +Emitted when tss address is updated + + +```solidity +event UpdatedCustodyTSSAddress(address oldTSSAddress, address newTSSAddress); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`oldTSSAddress`|`address`|old tss address| +|`newTSSAddress`|`address`|new tss address| + diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md index 057b5550..129162c9 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md @@ -1,5 +1,5 @@ # Callable -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IGatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IGatewayEVM.sol) Interface implemented by contracts receiving authenticated calls. diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md index f72c1a06..03094631 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md @@ -1,5 +1,5 @@ # IGatewayEVM -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IGatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IGatewayEVM.sol) **Inherits:** [IGatewayEVMErrors](/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md), [IGatewayEVMEvents](/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md) diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md index 1c0aeeda..3ca74b54 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md @@ -1,5 +1,5 @@ # IGatewayEVMErrors -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IGatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IGatewayEVM.sol) Interface for the errors used in the GatewayEVM contract. @@ -93,3 +93,11 @@ Error when trying to call onRevert method using arbitrary call. error NotAllowedToCallOnRevert(); ``` +### PayloadSizeExceeded +Error indicating payload size exceeded in external functions. + + +```solidity +error PayloadSizeExceeded(); +``` + diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md index a4a9a3a0..7052b97b 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md @@ -1,5 +1,5 @@ # IGatewayEVMEvents -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IGatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IGatewayEVM.sol) Interface for the events emitted by the GatewayEVM contract. @@ -99,3 +99,18 @@ event Called(address indexed sender, address indexed receiver, bytes payload, Re |`payload`|`bytes`|The calldata passed to the call.| |`revertOptions`|`RevertOptions`|Revert options.| +### UpdatedGatewayTSSAddress +Emitted when tss address is updated + + +```solidity +event UpdatedGatewayTSSAddress(address oldTSSAddress, address newTSSAddress); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`oldTSSAddress`|`address`|old tss address| +|`newTSSAddress`|`address`|new tss address| + diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md index 13bce47a..8d63e175 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md @@ -1,5 +1,5 @@ # MessageContext -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IGatewayEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IGatewayEVM.sol) Message context passed to execute function. diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md index 4e75ea4a..973ad71e 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md @@ -1,5 +1,5 @@ # IZetaConnectorEvents -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IZetaConnector.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IZetaConnector.sol) Interface for the events emitted by the ZetaConnector contracts. @@ -53,3 +53,18 @@ event WithdrawnAndReverted(address indexed to, uint256 amount, bytes data, Rever |`data`|`bytes`|The calldata passed to the contract call.| |`revertContext`|`RevertContext`|Revert context to pass to onRevert.| +### UpdatedZetaConnectorTSSAddress +Emitted when tss address is updated + + +```solidity +event UpdatedZetaConnectorTSSAddress(address oldTSSAddress, address newTSSAddress); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`oldTSSAddress`|`address`|old tss address| +|`newTSSAddress`|`address`|new tss address| + diff --git a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md index ba9b4f53..e64a321e 100644 --- a/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md +++ b/src/pages/developers/architecture/protocol/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md @@ -1,5 +1,5 @@ # IZetaNonEthNew -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/evm/interfaces/IZetaNonEthNew.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/evm/interfaces/IZetaNonEthNew.sol) **Inherits:** IERC20 diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md b/src/pages/developers/architecture/protocol/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md index 70ffd85c..d60f97f8 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md @@ -1,8 +1,8 @@ # GatewayZEVM -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/GatewayZEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/GatewayZEVM.sol) **Inherits:** -[IGatewayZEVM](/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md), Initializable, AccessControlUpgradeable, UUPSUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable +[IGatewayZEVM](/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md), Initializable, AccessControlUpgradeable, UUPSUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable, [INotSupportedMethods](/contracts/Errors.sol/interface.INotSupportedMethods.md) The GatewayZEVM contract is the endpoint to call smart contracts on omnichain. @@ -37,6 +37,15 @@ bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); ``` +### MAX_MESSAGE_SIZE +Max size of message + revertOptions revert message. + + +```solidity +uint256 public constant MAX_MESSAGE_SIZE = 1024; +``` + + ## Functions ### onlyProtocol @@ -49,6 +58,9 @@ modifier onlyProtocol(); ### constructor +**Note:** +constructor + ```solidity constructor(); @@ -109,11 +121,11 @@ function unpause() external onlyRole(PAUSER_ROLE); ### _withdrawZRC20 -*Internal function to withdraw ZRC20 tokens.* +*Private function to withdraw ZRC20 tokens.* ```solidity -function _withdrawZRC20(uint256 amount, address zrc20) internal returns (uint256); +function _withdrawZRC20(uint256 amount, address zrc20) private returns (uint256); ``` **Parameters** @@ -131,11 +143,11 @@ function _withdrawZRC20(uint256 amount, address zrc20) internal returns (uint256 ### _withdrawZRC20WithGasLimit -*Internal function to withdraw ZRC20 tokens with gas limit.* +*Private function to withdraw ZRC20 tokens with gas limit.* ```solidity -function _withdrawZRC20WithGasLimit(uint256 amount, address zrc20, uint256 gasLimit) internal returns (uint256); +function _withdrawZRC20WithGasLimit(uint256 amount, address zrc20, uint256 gasLimit) private returns (uint256); ``` **Parameters** @@ -154,11 +166,11 @@ function _withdrawZRC20WithGasLimit(uint256 amount, address zrc20, uint256 gasLi ### _transferZETA -*Internal function to transfer ZETA tokens.* +*Private function to transfer ZETA tokens.* ```solidity -function _transferZETA(uint256 amount, address to) internal; +function _transferZETA(uint256 amount, address to) private; ``` **Parameters** @@ -199,36 +211,6 @@ function withdraw( Withdraw ZRC20 tokens and call a smart contract on an external chain. -```solidity -function withdrawAndCall( - bytes memory receiver, - uint256 amount, - address zrc20, - bytes calldata message, - uint256 gasLimit, - RevertOptions calldata revertOptions -) - external - nonReentrant - whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`zrc20`|`address`|The address of the ZRC20 token.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`gasLimit`|`uint256`|Gas limit.| -|`revertOptions`|`RevertOptions`|Revert options.| - - -### withdrawAndCall - -Withdraw ZRC20 tokens and call a smart contract on an external chain. - - ```solidity function withdrawAndCall( bytes memory receiver, @@ -260,53 +242,8 @@ Withdraw ZETA tokens to an external chain. ```solidity -function withdraw( - bytes memory receiver, - uint256 amount, - uint256 chainId, - RevertOptions calldata revertOptions -) - external - nonReentrant - whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`chainId`|`uint256`|| -|`revertOptions`|`RevertOptions`|Revert options.| - - -### withdrawAndCall - -Withdraw ZETA tokens and call a smart contract on an external chain. - - -```solidity -function withdrawAndCall( - bytes memory receiver, - uint256 amount, - uint256 chainId, - bytes calldata message, - RevertOptions calldata revertOptions -) - external - nonReentrant - whenNotPaused; +function withdraw(bytes memory, uint256, uint256, RevertOptions calldata) external nonReentrant whenNotPaused; ``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`chainId`|`uint256`|Chain id of the external chain.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`revertOptions`|`RevertOptions`|Revert options.| - ### withdrawAndCall @@ -315,28 +252,17 @@ Withdraw ZETA tokens and call a smart contract on an external chain. ```solidity function withdrawAndCall( - bytes memory receiver, - uint256 amount, - uint256 chainId, - bytes calldata message, - CallOptions calldata callOptions, - RevertOptions calldata revertOptions + bytes memory, + uint256, + uint256, + bytes calldata, + CallOptions calldata, + RevertOptions calldata ) external nonReentrant whenNotPaused; ``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`chainId`|`uint256`|Chain id of the external chain.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`callOptions`|`CallOptions`|Call options including gas limit and arbirtrary call flag.| -|`revertOptions`|`RevertOptions`|Revert options.| - ### call @@ -366,34 +292,6 @@ function call( |`revertOptions`|`RevertOptions`|Revert options.| -### call - -Call a smart contract on an external chain without asset transfer. - - -```solidity -function call( - bytes memory receiver, - address zrc20, - bytes calldata message, - uint256 gasLimit, - RevertOptions calldata revertOptions -) - external - nonReentrant - whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`zrc20`|`address`|Address of zrc20 to pay fees.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`gasLimit`|`uint256`|Gas limit.| -|`revertOptions`|`RevertOptions`|Revert options.| - - ### _call @@ -405,7 +303,7 @@ function _call( CallOptions memory callOptions, RevertOptions memory revertOptions ) - internal; + private; ``` ### deposit @@ -432,7 +330,7 @@ Execute a user-specified contract on ZEVM. ```solidity function execute( - zContext calldata context, + MessageContext calldata context, address zrc20, uint256 amount, address target, @@ -446,7 +344,7 @@ function execute( |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`zrc20`|`address`|The address of the ZRC20 token.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| @@ -460,7 +358,7 @@ Deposit foreign coins into ZRC20 and call a user-specified contract on ZEVM. ```solidity function depositAndCall( - zContext calldata context, + MessageContext calldata context, address zrc20, uint256 amount, address target, @@ -474,7 +372,7 @@ function depositAndCall( |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`zrc20`|`address`|The address of the ZRC20 token.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| @@ -488,7 +386,7 @@ Deposit ZETA and call a user-specified contract on ZEVM. ```solidity function depositAndCall( - zContext calldata context, + MessageContext calldata context, uint256 amount, address target, bytes calldata message @@ -501,7 +399,7 @@ function depositAndCall( |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| |`message`|`bytes`|The calldata to pass to the contract call.| diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/contract.SystemContract.md b/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/contract.SystemContract.md index 240cbdd4..05851785 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/contract.SystemContract.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/contract.SystemContract.md @@ -1,5 +1,5 @@ # SystemContract -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/SystemContract.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/SystemContract.sol) **Inherits:** [SystemContractErrors](/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md) diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md b/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md index ee11a49d..4f339330 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md @@ -1,5 +1,5 @@ # SystemContractErrors -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/SystemContract.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/SystemContract.sol) *Custom errors for SystemContract* diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/contract.ZRC20.md b/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/contract.ZRC20.md index 028af2aa..22b4de91 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/contract.ZRC20.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/contract.ZRC20.md @@ -1,5 +1,5 @@ # ZRC20 -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/ZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/ZRC20.sol) **Inherits:** [IZRC20Metadata](/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md), [ZRC20Errors](/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md), [ZRC20Events](/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md) diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md b/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md index 0697b96f..494eea81 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md @@ -1,5 +1,5 @@ # ZRC20Errors -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/ZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/ZRC20.sol) *Custom errors for ZRC20* diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md index 30ec1677..d74d541d 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md @@ -1,5 +1,5 @@ # IGatewayZEVM -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IGatewayZEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IGatewayZEVM.sol) **Inherits:** [IGatewayZEVMErrors](/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md), [IGatewayZEVMEvents](/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md) @@ -63,34 +63,6 @@ function withdraw( Withdraw ZRC20 tokens and call a smart contract on an external chain. -```solidity -function withdrawAndCall( - bytes memory receiver, - uint256 amount, - address zrc20, - bytes calldata message, - uint256 gasLimit, - RevertOptions calldata revertOptions -) - external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`zrc20`|`address`|The address of the ZRC20 token.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`gasLimit`|`uint256`|Gas limit.| -|`revertOptions`|`RevertOptions`|Revert options.| - - -### withdrawAndCall - -Withdraw ZRC20 tokens and call a smart contract on an external chain. - - ```solidity function withdrawAndCall( bytes memory receiver, @@ -119,32 +91,6 @@ function withdrawAndCall( Withdraw ZETA tokens and call a smart contract on an external chain. -```solidity -function withdrawAndCall( - bytes memory receiver, - uint256 amount, - uint256 chainId, - bytes calldata message, - RevertOptions calldata revertOptions -) - external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`amount`|`uint256`|The amount of tokens to withdraw.| -|`chainId`|`uint256`|Chain id of the external chain.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`revertOptions`|`RevertOptions`|Revert options.| - - -### withdrawAndCall - -Withdraw ZETA tokens and call a smart contract on an external chain. - - ```solidity function withdrawAndCall( bytes memory receiver, @@ -194,32 +140,6 @@ function call( |`revertOptions`|`RevertOptions`|Revert options.| -### call - -Call a smart contract on an external chain without asset transfer. - - -```solidity -function call( - bytes memory receiver, - address zrc20, - bytes calldata message, - uint256 gasLimit, - RevertOptions calldata revertOptions -) - external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`receiver`|`bytes`|The receiver address on the external chain.| -|`zrc20`|`address`|Address of zrc20 to pay fees.| -|`message`|`bytes`|The calldata to pass to the contract call.| -|`gasLimit`|`uint256`|Gas limit.| -|`revertOptions`|`RevertOptions`|Revert options.| - - ### deposit Deposit foreign coins into ZRC20. @@ -244,7 +164,7 @@ Execute a user-specified contract on ZEVM. ```solidity function execute( - zContext calldata context, + MessageContext calldata context, address zrc20, uint256 amount, address target, @@ -256,7 +176,7 @@ function execute( |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`zrc20`|`address`|The address of the ZRC20 token.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| @@ -270,7 +190,7 @@ Deposit foreign coins into ZRC20 and call a user-specified contract on ZEVM. ```solidity function depositAndCall( - zContext calldata context, + MessageContext calldata context, address zrc20, uint256 amount, address target, @@ -282,7 +202,7 @@ function depositAndCall( |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`zrc20`|`address`|The address of the ZRC20 token.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| @@ -295,13 +215,19 @@ Deposit ZETA and call a user-specified contract on ZEVM. ```solidity -function depositAndCall(zContext calldata context, uint256 amount, address target, bytes calldata message) external; +function depositAndCall( + MessageContext calldata context, + uint256 amount, + address target, + bytes calldata message +) + external; ``` **Parameters** |Name|Type|Description| |----|----|-----------| -|`context`|`zContext`|The context of the cross-chain call.| +|`context`|`MessageContext`|The context of the cross-chain call.| |`amount`|`uint256`|The amount of tokens to transfer.| |`target`|`address`|The target contract to call.| |`message`|`bytes`|The calldata to pass to the contract call.| diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md index 3c6a6819..62c2de45 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md @@ -1,5 +1,5 @@ # IGatewayZEVMErrors -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IGatewayZEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IGatewayZEVM.sol) Interface for the errors used in the GatewayZEVM contract. @@ -93,11 +93,19 @@ Error indicating that only WZETA or the protocol address can call the function. error OnlyWZETAOrProtocol(); ``` -### EmptyMessage -Error indicating call method received empty message as argument. +### InsufficientGasLimit +Error indicating an insufficient gas limit. ```solidity -error EmptyMessage(); +error InsufficientGasLimit(); +``` + +### MessageSizeExceeded +Error indicating message size exceeded in external functions. + + +```solidity +error MessageSizeExceeded(); ``` diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md index aa9bf0e0..7b234bf4 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md @@ -1,5 +1,5 @@ # IGatewayZEVMEvents -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IGatewayZEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IGatewayZEVM.sol) Interface for the events emitted by the GatewayZEVM contract. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md index ee90dcd7..559f469c 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md @@ -1,5 +1,5 @@ # CallOptions -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IGatewayZEVM.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IGatewayZEVM.sol) CallOptions struct passed to call and withdrawAndCall functions. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md index bc60fa8f..288a3271 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md @@ -1,5 +1,5 @@ # ISystem -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/ISystem.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/ISystem.sol) Interface for the System contract. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md index 698ca481..21c5567c 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md @@ -1,5 +1,5 @@ # IWETH9 -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IWZETA.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IWZETA.sol) Interface for the Weth9 contract. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md index 0020dfc6..ffc1a100 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md @@ -1,5 +1,5 @@ # CoinType -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IZRC20.sol) *Coin types for ZRC20. Zeta value should not be used.* diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md index d37b0c16..cc7b4ddb 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md @@ -1,5 +1,5 @@ # IZRC20 -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IZRC20.sol) Interface for the ZRC20 token contract. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md index f503d704..57214b2f 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md @@ -1,5 +1,5 @@ # IZRC20Metadata -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IZRC20.sol) **Inherits:** [IZRC20](/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md) diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md index fc49e913..4be93510 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md @@ -1,5 +1,5 @@ # ZRC20Events -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/IZRC20.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/IZRC20.sol) Interface for the ZRC20 events. diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/README.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/README.md index 27c982d5..ef978911 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/README.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/README.md @@ -13,4 +13,5 @@ - [CoinType](IZRC20.sol/enum.CoinType.md) - [zContext](UniversalContract.sol/struct.zContext.md) - [zContract](UniversalContract.sol/interface.zContract.md) +- [MessageContext](UniversalContract.sol/struct.MessageContext.md) - [UniversalContract](UniversalContract.sol/interface.UniversalContract.md) diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md index 900df737..28923583 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md @@ -1,12 +1,12 @@ # UniversalContract -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/UniversalContract.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol) ## Functions -### onCrossChainCall +### onCall ```solidity -function onCrossChainCall(zContext calldata context, address zrc20, uint256 amount, bytes calldata message) external; +function onCall(MessageContext calldata context, address zrc20, uint256 amount, bytes calldata message) external; ``` diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md index 3aa62bb9..adcf0675 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md @@ -1,5 +1,9 @@ # zContract -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/UniversalContract.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol) + +**Note:** +should be removed once v2 SystemContract is not used anymore. +UniversalContract should be used ## Functions diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md new file mode 100644 index 00000000..00e1a7e4 --- /dev/null +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md @@ -0,0 +1,12 @@ +# MessageContext +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol) + + +```solidity +struct MessageContext { + bytes origin; + address sender; + uint256 chainID; +} +``` + diff --git a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md index f15fa3b7..e50ac885 100644 --- a/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md +++ b/src/pages/developers/architecture/protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md @@ -1,5 +1,9 @@ # zContext -[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/3a274ce7bad045a879c73669586611d35509cbce/contracts/zevm/interfaces/UniversalContract.sol) +[Git Source](https://github.com/zeta-chain/protocol-contracts/blob/main/v2/contracts/zevm/interfaces/UniversalContract.sol) + +**Note:** +should be removed once v2 SystemContract is not used anymore. +MessageContext should be used ```solidity diff --git a/src/pages/developers/architecture/protocol/index.md b/src/pages/developers/architecture/protocol/index.md index fa2538bd..167051d0 100644 --- a/src/pages/developers/architecture/protocol/index.md +++ b/src/pages/developers/architecture/protocol/index.md @@ -98,12 +98,14 @@ $ cast --help - [CoinType](protocol/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md) - [zContext](protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md) - [zContract](protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md) + - [MessageContext](protocol/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md) - [UniversalContract](protocol/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md) - [GatewayZEVM](protocol/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md) - [SystemContractErrors](protocol/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md) - [SystemContract](protocol/contracts/zevm/SystemContract.sol/contract.SystemContract.md) - [ZRC20Errors](protocol/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md) - [ZRC20](protocol/contracts/zevm/ZRC20.sol/contract.ZRC20.md) + - [INotSupportedMethods](protocol/contracts/Errors.sol/interface.INotSupportedMethods.md) - [RevertOptions](protocol/contracts/Revert.sol/struct.RevertOptions.md) - [RevertContext](protocol/contracts/Revert.sol/struct.RevertContext.md) - [Revertable](protocol/contracts/Revert.sol/interface.Revertable.md)