From 0ba9959de3fbc1605ca7010640d72c053e907463 Mon Sep 17 00:00:00 2001 From: skosito Date: Thu, 25 Jul 2024 18:01:50 +0100 Subject: [PATCH] feat: connector native minting cap (#248) --- .../prototypes/evm/ZetaConnectorNonNative.sol | 30 ++- .../zetaconnectornonnative.go | 190 +++++++++++++++++- testFoundry/GatewayEVM.t.sol | 2 + testFoundry/ZetaConnectorNative.t.sol | 2 + testFoundry/ZetaConnectorNonNative.t.sol | 56 +++++- .../prototypes/evm/ZetaConnectorNonNative.ts | 65 ++++++ .../evm/ZetaConnectorNonNative__factory.ts | 46 ++++- 7 files changed, 383 insertions(+), 8 deletions(-) diff --git a/contracts/prototypes/evm/ZetaConnectorNonNative.sol b/contracts/prototypes/evm/ZetaConnectorNonNative.sol index 3bb8a04a..97d45f0d 100644 --- a/contracts/prototypes/evm/ZetaConnectorNonNative.sol +++ b/contracts/prototypes/evm/ZetaConnectorNonNative.sol @@ -6,18 +6,38 @@ import "./IZetaNonEthNew.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract ZetaConnectorNonNative is ZetaConnectorNewBase { + /// @notice Max supply for minting + uint256 public maxSupply = type(uint256).max; + + /// @notice Event triggered when max supply is updated + /// @param maxSupply New max supply + event MaxSupplyUpdated(uint256 maxSupply); + error ExceedsMaxSupply(); + constructor(address _gateway, address _zetaToken, address _tssAddress) ZetaConnectorNewBase(_gateway, _zetaToken, _tssAddress) {} - // @dev withdraw is called by TSS address, it mints zetaToken to the destination address + /// @notice Set max supply for minting + /// @param _maxSupply New max supply + /// @dev Caller must be TSS + function setMaxSupply(uint256 _maxSupply) external onlyTSS() { + maxSupply = _maxSupply; + emit MaxSupplyUpdated(_maxSupply); + } + + /// @dev withdraw is called by TSS address, it mints zetaToken to the destination address function withdraw(address to, uint256 amount, bytes32 internalSendHash) external override nonReentrant onlyTSS { + if (amount + IERC20(zetaToken).totalSupply() > maxSupply) revert ExceedsMaxSupply(); + IZetaNonEthNew(zetaToken).mint(to, amount, internalSendHash); emit Withdraw(to, amount); } - // @dev withdrawAndCall is called by TSS address, it mints zetaToken and calls a contract + /// @dev withdrawAndCall is called by TSS address, it mints zetaToken and calls a contract function withdrawAndCall(address to, uint256 amount, bytes calldata data, bytes32 internalSendHash) external override nonReentrant onlyTSS { + if (amount + IERC20(zetaToken).totalSupply() > maxSupply) revert ExceedsMaxSupply(); + // Mint zetaToken to the Gateway contract IZetaNonEthNew(zetaToken).mint(address(gateway), amount, internalSendHash); @@ -27,8 +47,10 @@ contract ZetaConnectorNonNative is ZetaConnectorNewBase { emit WithdrawAndCall(to, amount, data); } - // @dev withdrawAndRevert is called by TSS address, it mints zetaToken to the gateway and calls onRevert on a contract + /// @dev withdrawAndRevert is called by TSS address, it mints zetaToken to the gateway and calls onRevert on a contract function withdrawAndRevert(address to, uint256 amount, bytes calldata data, bytes32 internalSendHash) external override nonReentrant onlyTSS { + if (amount + IERC20(zetaToken).totalSupply() > maxSupply) revert ExceedsMaxSupply(); + // Mint zetaToken to the Gateway contract IZetaNonEthNew(zetaToken).mint(address(gateway), amount, internalSendHash); @@ -38,7 +60,7 @@ contract ZetaConnectorNonNative is ZetaConnectorNewBase { emit WithdrawAndRevert(to, amount, data); } - // @dev receiveTokens handles token transfer and burn them + /// @dev receiveTokens handles token transfer and burn them function receiveTokens(uint256 amount) external override { IZetaNonEthNew(zetaToken).burnFrom(msg.sender, amount); } diff --git a/pkg/contracts/prototypes/evm/zetaconnectornonnative.sol/zetaconnectornonnative.go b/pkg/contracts/prototypes/evm/zetaconnectornonnative.sol/zetaconnectornonnative.go index 7adaa59f..21c68ebd 100644 --- a/pkg/contracts/prototypes/evm/zetaconnectornonnative.sol/zetaconnectornonnative.go +++ b/pkg/contracts/prototypes/evm/zetaconnectornonnative.sol/zetaconnectornonnative.go @@ -31,8 +31,8 @@ var ( // ZetaConnectorNonNativeMetaData contains all meta data concerning the ZetaConnectorNonNative contract. var ZetaConnectorNonNativeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_zetaToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tssAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"WithdrawAndCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"WithdrawAndRevert\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"gateway\",\"outputs\":[{\"internalType\":\"contractIGatewayEVM\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tssAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawAndCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawAndRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"zetaToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b50604051620010c3380380620010c38339818101604052810190620000379190620001ec565b8282826001600081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480620000aa5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620000e25750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156200011a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050506200029b565b600081519050620001e68162000281565b92915050565b6000806000606084860312156200020857620002076200027c565b5b60006200021886828701620001d5565b93505060206200022b86828701620001d5565b92505060406200023e86828701620001d5565b9150509250925092565b600062000255826200025c565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6200028c8162000248565b81146200029857600080fd5b50565b60805160601c60a05160601c610db66200030d600039600081816101dd015281816102c80152818161042f0152818161053d015281816106160152818161070101526107d90152600081816102190152818161028c015281816105190152818161065201526106c50152610db66000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806321e093b11161005b57806321e093b1146100d85780635b112591146100f65780635e3e9fef14610114578063743e0c9b146101305761007d565b806302d5c89914610082578063106e62901461009e578063116191b6146100ba575b600080fd5b61009c600480360381019061009791906109a9565b61014c565b005b6100b860048036038101906100b39190610956565b61039e565b005b6100c2610517565b6040516100cf9190610bb3565b60405180910390f35b6100e061053b565b6040516100ed9190610aea565b60405180910390f35b6100fe61055f565b60405161010b9190610aea565b60405180910390f35b61012e600480360381019061012991906109a9565b610585565b005b61014a60048036038101906101459190610a31565b6107d7565b005b610154610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101db576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161025893929190610b7c565b600060405180830381600087803b15801561027257600080fd5b505af1158015610286573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b8969bd47f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b815260040161030b959493929190610b05565b600060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe85858560405161038793929190610c09565b60405180910390a26103976108b7565b5050505050565b6103a6610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461042d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee8484846040518463ffffffff1660e01b815260040161048a93929190610b7c565b600060405180830381600087803b1580156104a457600080fd5b505af11580156104b8573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364836040516105029190610bee565b60405180910390a26105126108b7565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61058d610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610614576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161069193929190610b7c565b600060405180830381600087803b1580156106ab57600080fd5b505af11580156106bf573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635131ab597f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b8152600401610744959493929190610b05565b600060405180830381600087803b15801561075e57600080fd5b505af1158015610772573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced8585856040516107c093929190610c09565b60405180910390a26107d06108b7565b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166379cc679033836040518363ffffffff1660e01b8152600401610832929190610b53565b600060405180830381600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b5050505050565b600260005414156108ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a490610bce565b60405180910390fd5b6002600081905550565b6001600081905550565b6000813590506108d081610d3b565b92915050565b6000813590506108e581610d52565b92915050565b60008083601f84011261090157610900610ced565b5b8235905067ffffffffffffffff81111561091e5761091d610ce8565b5b60208301915083600182028301111561093a57610939610cf2565b5b9250929050565b60008135905061095081610d69565b92915050565b60008060006060848603121561096f5761096e610cfc565b5b600061097d868287016108c1565b935050602061098e86828701610941565b925050604061099f868287016108d6565b9150509250925092565b6000806000806000608086880312156109c5576109c4610cfc565b5b60006109d3888289016108c1565b95505060206109e488828901610941565b945050604086013567ffffffffffffffff811115610a0557610a04610cf7565b5b610a11888289016108eb565b93509350506060610a24888289016108d6565b9150509295509295909350565b600060208284031215610a4757610a46610cfc565b5b6000610a5584828501610941565b91505092915050565b610a6781610c5d565b82525050565b610a7681610c6f565b82525050565b6000610a888385610c3b565b9350610a95838584610cd9565b610a9e83610d01565b840190509392505050565b610ab281610ca3565b82525050565b6000610ac5601f83610c4c565b9150610ad082610d12565b602082019050919050565b610ae481610c99565b82525050565b6000602082019050610aff6000830184610a5e565b92915050565b6000608082019050610b1a6000830188610a5e565b610b276020830187610a5e565b610b346040830186610adb565b8181036060830152610b47818486610a7c565b90509695505050505050565b6000604082019050610b686000830185610a5e565b610b756020830184610adb565b9392505050565b6000606082019050610b916000830186610a5e565b610b9e6020830185610adb565b610bab6040830184610a6d565b949350505050565b6000602082019050610bc86000830184610aa9565b92915050565b60006020820190508181036000830152610be781610ab8565b9050919050565b6000602082019050610c036000830184610adb565b92915050565b6000604082019050610c1e6000830186610adb565b8181036020830152610c31818486610a7c565b9050949350505050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610c6882610c79565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cae82610cb5565b9050919050565b6000610cc082610cc7565b9050919050565b6000610cd282610c79565b9050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b610d4481610c5d565b8114610d4f57600080fd5b50565b610d5b81610c6f565b8114610d6657600080fd5b50565b610d7281610c99565b8114610d7d57600080fd5b5056fea26469706673582212209d543e668c793d4944964e21ce09680a6432aef47847a599106ee141e7a8a01264736f6c63430008070033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_zetaToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tssAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExceedsMaxSupply\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSupply\",\"type\":\"uint256\"}],\"name\":\"MaxSupplyUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"WithdrawAndCall\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"WithdrawAndRevert\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"gateway\",\"outputs\":[{\"internalType\":\"contractIGatewayEVM\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxSupply\",\"type\":\"uint256\"}],\"name\":\"setMaxSupply\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tssAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawAndCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"internalSendHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawAndRevert\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"zetaToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60c06040527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002553480156200003557600080fd5b506040516200158d3803806200158d83398181016040528101906200005b919062000210565b8282826001600081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480620000ce5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620001065750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156200013e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620002bf565b6000815190506200020a81620002a5565b92915050565b6000806000606084860312156200022c576200022b620002a0565b5b60006200023c86828701620001f9565b93505060206200024f86828701620001f9565b92505060406200026286828701620001f9565b9150509250925092565b6000620002798262000280565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620002b0816200026c565b8114620002bc57600080fd5b50565b60805160601c60a05160601c611247620003466000396000818161023001528181610311015281816103fc0152818161056601528181610647015281816107550152818161083101528181610912015281816109fd0152610b9d01526000818161034d015281816103c0015281816107310152818161094e01526109c101526112476000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80635b112591116100665780635b1125911461010c5780635e3e9fef1461012a5780636f8b44b014610146578063743e0c9b14610162578063d5abeb011461017e57610093565b806302d5c89914610098578063106e6290146100b4578063116191b6146100d057806321e093b1146100ee575b600080fd5b6100b260048036038101906100ad9190610d88565b61019c565b005b6100ce60048036038101906100c99190610d35565b6104d2565b005b6100d861072f565b6040516100e59190610fbf565b60405180910390f35b6100f6610753565b6040516101039190610ef6565b60405180910390f35b610114610777565b6040516101219190610ef6565b60405180910390f35b610144600480360381019061013f9190610d88565b61079d565b005b610160600480360381019061015b9190610e10565b610ad3565b005b61017c60048036038101906101779190610e10565b610b9b565b005b610186610c2b565b6040516101939190610ffa565b60405180910390f35b6101a4610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461022b576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029457600080fd5b505afa1580156102a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cc9190610e3d565b856102d79190611069565b111561030f576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161038c93929190610f88565b600060405180830381600087803b1580156103a657600080fd5b505af11580156103ba573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b8969bd47f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b815260040161043f959493929190610f11565b600060405180830381600087803b15801561045957600080fd5b505af115801561046d573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe8585856040516104bb93929190611015565b60405180910390a26104cb610c81565b5050505050565b6104da610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610561576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ca57600080fd5b505afa1580156105de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106029190610e3d565b8361060d9190611069565b1115610645576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee8484846040518463ffffffff1660e01b81526004016106a293929190610f88565b600060405180830381600087803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161071a9190610ffa565b60405180910390a261072a610c81565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6107a5610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461082c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561089557600080fd5b505afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd9190610e3d565b856108d89190611069565b1115610910576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161098d93929190610f88565b600060405180830381600087803b1580156109a757600080fd5b505af11580156109bb573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635131ab597f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b8152600401610a40959493929190610f11565b600060405180830381600087803b158015610a5a57600080fd5b505af1158015610a6e573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced858585604051610abc93929190611015565b60405180910390a2610acc610c81565b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b5a576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806002819055507f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c81604051610b909190610ffa565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166379cc679033836040518363ffffffff1660e01b8152600401610bf6929190610f5f565b600060405180830381600087803b158015610c1057600080fd5b505af1158015610c24573d6000803e3d6000fd5b5050505050565b60025481565b60026000541415610c77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6e90610fda565b60405180910390fd5b6002600081905550565b6001600081905550565b600081359050610c9a816111cc565b92915050565b600081359050610caf816111e3565b92915050565b60008083601f840112610ccb57610cca61117e565b5b8235905067ffffffffffffffff811115610ce857610ce7611179565b5b602083019150836001820283011115610d0457610d03611183565b5b9250929050565b600081359050610d1a816111fa565b92915050565b600081519050610d2f816111fa565b92915050565b600080600060608486031215610d4e57610d4d61118d565b5b6000610d5c86828701610c8b565b9350506020610d6d86828701610d0b565b9250506040610d7e86828701610ca0565b9150509250925092565b600080600080600060808688031215610da457610da361118d565b5b6000610db288828901610c8b565b9550506020610dc388828901610d0b565b945050604086013567ffffffffffffffff811115610de457610de3611188565b5b610df088828901610cb5565b93509350506060610e0388828901610ca0565b9150509295509295909350565b600060208284031215610e2657610e2561118d565b5b6000610e3484828501610d0b565b91505092915050565b600060208284031215610e5357610e5261118d565b5b6000610e6184828501610d20565b91505092915050565b610e73816110bf565b82525050565b610e82816110d1565b82525050565b6000610e948385611047565b9350610ea183858461113b565b610eaa83611192565b840190509392505050565b610ebe81611105565b82525050565b6000610ed1601f83611058565b9150610edc826111a3565b602082019050919050565b610ef0816110fb565b82525050565b6000602082019050610f0b6000830184610e6a565b92915050565b6000608082019050610f266000830188610e6a565b610f336020830187610e6a565b610f406040830186610ee7565b8181036060830152610f53818486610e88565b90509695505050505050565b6000604082019050610f746000830185610e6a565b610f816020830184610ee7565b9392505050565b6000606082019050610f9d6000830186610e6a565b610faa6020830185610ee7565b610fb76040830184610e79565b949350505050565b6000602082019050610fd46000830184610eb5565b92915050565b60006020820190508181036000830152610ff381610ec4565b9050919050565b600060208201905061100f6000830184610ee7565b92915050565b600060408201905061102a6000830186610ee7565b818103602083015261103d818486610e88565b9050949350505050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611074826110fb565b915061107f836110fb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156110b4576110b361114a565b5b828201905092915050565b60006110ca826110db565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061111082611117565b9050919050565b600061112282611129565b9050919050565b6000611134826110db565b9050919050565b82818337600083830152505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6111d5816110bf565b81146111e057600080fd5b50565b6111ec816110d1565b81146111f757600080fd5b50565b611203816110fb565b811461120e57600080fd5b5056fea26469706673582212201f817c0195940fddc4165c2ca6317081a920edafb2f79b81682fec2a95beb85364736f6c63430008070033", } // ZetaConnectorNonNativeABI is the input ABI used to generate the binding from. @@ -233,6 +233,37 @@ func (_ZetaConnectorNonNative *ZetaConnectorNonNativeCallerSession) Gateway() (c return _ZetaConnectorNonNative.Contract.Gateway(&_ZetaConnectorNonNative.CallOpts) } +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeCaller) MaxSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ZetaConnectorNonNative.contract.Call(opts, &out, "maxSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeSession) MaxSupply() (*big.Int, error) { + return _ZetaConnectorNonNative.Contract.MaxSupply(&_ZetaConnectorNonNative.CallOpts) +} + +// MaxSupply is a free data retrieval call binding the contract method 0xd5abeb01. +// +// Solidity: function maxSupply() view returns(uint256) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeCallerSession) MaxSupply() (*big.Int, error) { + return _ZetaConnectorNonNative.Contract.MaxSupply(&_ZetaConnectorNonNative.CallOpts) +} + // TssAddress is a free data retrieval call binding the contract method 0x5b112591. // // Solidity: function tssAddress() view returns(address) @@ -316,6 +347,27 @@ func (_ZetaConnectorNonNative *ZetaConnectorNonNativeTransactorSession) ReceiveT return _ZetaConnectorNonNative.Contract.ReceiveTokens(&_ZetaConnectorNonNative.TransactOpts, amount) } +// SetMaxSupply is a paid mutator transaction binding the contract method 0x6f8b44b0. +// +// Solidity: function setMaxSupply(uint256 _maxSupply) returns() +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeTransactor) SetMaxSupply(opts *bind.TransactOpts, _maxSupply *big.Int) (*types.Transaction, error) { + return _ZetaConnectorNonNative.contract.Transact(opts, "setMaxSupply", _maxSupply) +} + +// SetMaxSupply is a paid mutator transaction binding the contract method 0x6f8b44b0. +// +// Solidity: function setMaxSupply(uint256 _maxSupply) returns() +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeSession) SetMaxSupply(_maxSupply *big.Int) (*types.Transaction, error) { + return _ZetaConnectorNonNative.Contract.SetMaxSupply(&_ZetaConnectorNonNative.TransactOpts, _maxSupply) +} + +// SetMaxSupply is a paid mutator transaction binding the contract method 0x6f8b44b0. +// +// Solidity: function setMaxSupply(uint256 _maxSupply) returns() +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeTransactorSession) SetMaxSupply(_maxSupply *big.Int) (*types.Transaction, error) { + return _ZetaConnectorNonNative.Contract.SetMaxSupply(&_ZetaConnectorNonNative.TransactOpts, _maxSupply) +} + // Withdraw is a paid mutator transaction binding the contract method 0x106e6290. // // Solidity: function withdraw(address to, uint256 amount, bytes32 internalSendHash) returns() @@ -379,6 +431,140 @@ func (_ZetaConnectorNonNative *ZetaConnectorNonNativeTransactorSession) Withdraw return _ZetaConnectorNonNative.Contract.WithdrawAndRevert(&_ZetaConnectorNonNative.TransactOpts, to, amount, data, internalSendHash) } +// ZetaConnectorNonNativeMaxSupplyUpdatedIterator is returned from FilterMaxSupplyUpdated and is used to iterate over the raw logs and unpacked data for MaxSupplyUpdated events raised by the ZetaConnectorNonNative contract. +type ZetaConnectorNonNativeMaxSupplyUpdatedIterator struct { + Event *ZetaConnectorNonNativeMaxSupplyUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ZetaConnectorNonNativeMaxSupplyUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ZetaConnectorNonNativeMaxSupplyUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ZetaConnectorNonNativeMaxSupplyUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ZetaConnectorNonNativeMaxSupplyUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ZetaConnectorNonNativeMaxSupplyUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ZetaConnectorNonNativeMaxSupplyUpdated represents a MaxSupplyUpdated event raised by the ZetaConnectorNonNative contract. +type ZetaConnectorNonNativeMaxSupplyUpdated struct { + MaxSupply *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMaxSupplyUpdated is a free log retrieval operation binding the contract event 0x7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c. +// +// Solidity: event MaxSupplyUpdated(uint256 maxSupply) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeFilterer) FilterMaxSupplyUpdated(opts *bind.FilterOpts) (*ZetaConnectorNonNativeMaxSupplyUpdatedIterator, error) { + + logs, sub, err := _ZetaConnectorNonNative.contract.FilterLogs(opts, "MaxSupplyUpdated") + if err != nil { + return nil, err + } + return &ZetaConnectorNonNativeMaxSupplyUpdatedIterator{contract: _ZetaConnectorNonNative.contract, event: "MaxSupplyUpdated", logs: logs, sub: sub}, nil +} + +// WatchMaxSupplyUpdated is a free log subscription operation binding the contract event 0x7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c. +// +// Solidity: event MaxSupplyUpdated(uint256 maxSupply) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeFilterer) WatchMaxSupplyUpdated(opts *bind.WatchOpts, sink chan<- *ZetaConnectorNonNativeMaxSupplyUpdated) (event.Subscription, error) { + + logs, sub, err := _ZetaConnectorNonNative.contract.WatchLogs(opts, "MaxSupplyUpdated") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ZetaConnectorNonNativeMaxSupplyUpdated) + if err := _ZetaConnectorNonNative.contract.UnpackLog(event, "MaxSupplyUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseMaxSupplyUpdated is a log parse operation binding the contract event 0x7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c. +// +// Solidity: event MaxSupplyUpdated(uint256 maxSupply) +func (_ZetaConnectorNonNative *ZetaConnectorNonNativeFilterer) ParseMaxSupplyUpdated(log types.Log) (*ZetaConnectorNonNativeMaxSupplyUpdated, error) { + event := new(ZetaConnectorNonNativeMaxSupplyUpdated) + if err := _ZetaConnectorNonNative.contract.UnpackLog(event, "MaxSupplyUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ZetaConnectorNonNativeWithdrawIterator is returned from FilterWithdraw and is used to iterate over the raw logs and unpacked data for Withdraw events raised by the ZetaConnectorNonNative contract. type ZetaConnectorNonNativeWithdrawIterator struct { Event *ZetaConnectorNonNativeWithdraw // Event containing the contract specifics and raw log diff --git a/testFoundry/GatewayEVM.t.sol b/testFoundry/GatewayEVM.t.sol index efcaf9b4..46cefda4 100644 --- a/testFoundry/GatewayEVM.t.sol +++ b/testFoundry/GatewayEVM.t.sol @@ -58,6 +58,8 @@ contract GatewayEVMTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiver token.mint(owner, 1000000); token.transfer(address(custody), 500000); + + vm.deal(tssAddress, 1 ether); } function testForwardCallToReceiveNonPayable() public { diff --git a/testFoundry/ZetaConnectorNative.t.sol b/testFoundry/ZetaConnectorNative.t.sol index 5e905809..9c20be84 100644 --- a/testFoundry/ZetaConnectorNative.t.sol +++ b/testFoundry/ZetaConnectorNative.t.sol @@ -56,6 +56,8 @@ contract ZetaConnectorNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, vm.stopPrank(); zetaToken.mint(address(zetaConnector), 5000000); + + vm.deal(tssAddress, 1 ether); } function testWithdraw() public { diff --git a/testFoundry/ZetaConnectorNonNative.t.sol b/testFoundry/ZetaConnectorNonNative.t.sol index 915ca8b6..79905972 100644 --- a/testFoundry/ZetaConnectorNonNative.t.sol +++ b/testFoundry/ZetaConnectorNonNative.t.sol @@ -32,6 +32,9 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent address destination; address tssAddress; + error ExceedsMaxSupply(); + event MaxSupplyUpdated(uint256 maxSupply); + function setUp() public { owner = address(this); destination = address(0x1234); @@ -58,6 +61,8 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent gateway.setCustody(address(custody)); gateway.setConnector(address(zetaConnector)); vm.stopPrank(); + + vm.deal(tssAddress, 1 ether); } function testWithdraw() public { @@ -76,6 +81,23 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent assertEq(balanceAfter, amount); } + function testWithdrawFailsIfMaxSupplyReached() public { + uint256 amount = 100000; + uint256 balanceBefore = zetaToken.balanceOf(destination); + assertEq(balanceBefore, 0); + bytes32 internalSendHash = ""; + + uint256 maxSupply = 90000; + vm.expectEmit(true, true, true, true, address(zetaConnector)); + emit MaxSupplyUpdated(maxSupply); + vm.prank(tssAddress); + zetaConnector.setMaxSupply(maxSupply); + + vm.prank(tssAddress); + vm.expectRevert(ExceedsMaxSupply.selector); + zetaConnector.withdraw(destination, amount, internalSendHash); + } + function testWithdrawFailsIfSenderIsNotTSS() public { uint256 amount = 100000; bytes32 internalSendHash = ""; @@ -130,6 +152,22 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent zetaConnector.withdrawAndCall(address(receiver), amount, data, internalSendHash); } + function testWithdrawAndCallReceiveERC20FailsIfMaxSupplyReached() public { + uint256 amount = 100000; + bytes32 internalSendHash = ""; + bytes memory data = abi.encodeWithSignature("receiveERC20(uint256,address,address)", amount, address(zetaToken), destination); + + uint256 maxSupply = 90000; + vm.expectEmit(true, true, true, true, address(zetaConnector)); + emit MaxSupplyUpdated(maxSupply); + vm.prank(tssAddress); + zetaConnector.setMaxSupply(maxSupply); + + vm.prank(tssAddress); + vm.expectRevert(ExceedsMaxSupply.selector); + zetaConnector.withdrawAndCall(address(receiver), amount, data, internalSendHash); + } + function testWithdrawAndCallReceiveNoParams() public { uint256 amount = 100000; bytes32 internalSendHash = ""; @@ -237,7 +275,7 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent assertEq(balanceGateway, 0); } - function testWithdrawAndRevertFailsIfSenderIsNotTSS() public { + function testWithdrawAndRevertFailsIfSenderIsNotTSS() public { uint256 amount = 100000; bytes32 internalSendHash = ""; bytes memory data = abi.encodePacked("hello"); @@ -246,4 +284,20 @@ contract ZetaConnectorNonNativeTest is Test, IGatewayEVMErrors, IGatewayEVMEvent vm.expectRevert(InvalidSender.selector); zetaConnector.withdrawAndRevert(address(receiver), amount, data, internalSendHash); } + + function testWithdrawAndRevertFailsIfMaxSupplyReached() public { + uint256 amount = 100000; + bytes32 internalSendHash = ""; + bytes memory data = abi.encodePacked("hello"); + + uint256 maxSupply = 90000; + vm.expectEmit(true, true, true, true, address(zetaConnector)); + emit MaxSupplyUpdated(maxSupply); + vm.prank(tssAddress); + zetaConnector.setMaxSupply(maxSupply); + + vm.prank(tssAddress); + vm.expectRevert(ExceedsMaxSupply.selector); + zetaConnector.withdrawAndRevert(address(receiver), amount, data, internalSendHash); + } } \ No newline at end of file diff --git a/typechain-types/contracts/prototypes/evm/ZetaConnectorNonNative.ts b/typechain-types/contracts/prototypes/evm/ZetaConnectorNonNative.ts index fa4f18bc..ec008409 100644 --- a/typechain-types/contracts/prototypes/evm/ZetaConnectorNonNative.ts +++ b/typechain-types/contracts/prototypes/evm/ZetaConnectorNonNative.ts @@ -30,7 +30,9 @@ import type { export interface ZetaConnectorNonNativeInterface extends utils.Interface { functions: { "gateway()": FunctionFragment; + "maxSupply()": FunctionFragment; "receiveTokens(uint256)": FunctionFragment; + "setMaxSupply(uint256)": FunctionFragment; "tssAddress()": FunctionFragment; "withdraw(address,uint256,bytes32)": FunctionFragment; "withdrawAndCall(address,uint256,bytes,bytes32)": FunctionFragment; @@ -41,7 +43,9 @@ export interface ZetaConnectorNonNativeInterface extends utils.Interface { getFunction( nameOrSignatureOrTopic: | "gateway" + | "maxSupply" | "receiveTokens" + | "setMaxSupply" | "tssAddress" | "withdraw" | "withdrawAndCall" @@ -50,10 +54,15 @@ export interface ZetaConnectorNonNativeInterface extends utils.Interface { ): FunctionFragment; encodeFunctionData(functionFragment: "gateway", values?: undefined): string; + encodeFunctionData(functionFragment: "maxSupply", values?: undefined): string; encodeFunctionData( functionFragment: "receiveTokens", values: [PromiseOrValue] ): string; + encodeFunctionData( + functionFragment: "setMaxSupply", + values: [PromiseOrValue] + ): string; encodeFunctionData( functionFragment: "tssAddress", values?: undefined @@ -87,10 +96,15 @@ export interface ZetaConnectorNonNativeInterface extends utils.Interface { encodeFunctionData(functionFragment: "zetaToken", values?: undefined): string; decodeFunctionResult(functionFragment: "gateway", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "maxSupply", data: BytesLike): Result; decodeFunctionResult( functionFragment: "receiveTokens", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "setMaxSupply", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "tssAddress", data: BytesLike): Result; decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result; decodeFunctionResult( @@ -104,16 +118,29 @@ export interface ZetaConnectorNonNativeInterface extends utils.Interface { decodeFunctionResult(functionFragment: "zetaToken", data: BytesLike): Result; events: { + "MaxSupplyUpdated(uint256)": EventFragment; "Withdraw(address,uint256)": EventFragment; "WithdrawAndCall(address,uint256,bytes)": EventFragment; "WithdrawAndRevert(address,uint256,bytes)": EventFragment; }; + getEvent(nameOrSignatureOrTopic: "MaxSupplyUpdated"): EventFragment; getEvent(nameOrSignatureOrTopic: "Withdraw"): EventFragment; getEvent(nameOrSignatureOrTopic: "WithdrawAndCall"): EventFragment; getEvent(nameOrSignatureOrTopic: "WithdrawAndRevert"): EventFragment; } +export interface MaxSupplyUpdatedEventObject { + maxSupply: BigNumber; +} +export type MaxSupplyUpdatedEvent = TypedEvent< + [BigNumber], + MaxSupplyUpdatedEventObject +>; + +export type MaxSupplyUpdatedEventFilter = + TypedEventFilter; + export interface WithdrawEventObject { to: string; amount: BigNumber; @@ -179,11 +206,18 @@ export interface ZetaConnectorNonNative extends BaseContract { functions: { gateway(overrides?: CallOverrides): Promise<[string]>; + maxSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + receiveTokens( amount: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setMaxSupply( + _maxSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tssAddress(overrides?: CallOverrides): Promise<[string]>; withdraw( @@ -214,11 +248,18 @@ export interface ZetaConnectorNonNative extends BaseContract { gateway(overrides?: CallOverrides): Promise; + maxSupply(overrides?: CallOverrides): Promise; + receiveTokens( amount: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setMaxSupply( + _maxSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tssAddress(overrides?: CallOverrides): Promise; withdraw( @@ -249,11 +290,18 @@ export interface ZetaConnectorNonNative extends BaseContract { callStatic: { gateway(overrides?: CallOverrides): Promise; + maxSupply(overrides?: CallOverrides): Promise; + receiveTokens( amount: PromiseOrValue, overrides?: CallOverrides ): Promise; + setMaxSupply( + _maxSupply: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + tssAddress(overrides?: CallOverrides): Promise; withdraw( @@ -283,6 +331,9 @@ export interface ZetaConnectorNonNative extends BaseContract { }; filters: { + "MaxSupplyUpdated(uint256)"(maxSupply?: null): MaxSupplyUpdatedEventFilter; + MaxSupplyUpdated(maxSupply?: null): MaxSupplyUpdatedEventFilter; + "Withdraw(address,uint256)"( to?: PromiseOrValue | null, amount?: null @@ -318,11 +369,18 @@ export interface ZetaConnectorNonNative extends BaseContract { estimateGas: { gateway(overrides?: CallOverrides): Promise; + maxSupply(overrides?: CallOverrides): Promise; + receiveTokens( amount: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setMaxSupply( + _maxSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tssAddress(overrides?: CallOverrides): Promise; withdraw( @@ -354,11 +412,18 @@ export interface ZetaConnectorNonNative extends BaseContract { populateTransaction: { gateway(overrides?: CallOverrides): Promise; + maxSupply(overrides?: CallOverrides): Promise; + receiveTokens( amount: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } ): Promise; + setMaxSupply( + _maxSupply: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + tssAddress(overrides?: CallOverrides): Promise; withdraw( diff --git a/typechain-types/factories/contracts/prototypes/evm/ZetaConnectorNonNative__factory.ts b/typechain-types/factories/contracts/prototypes/evm/ZetaConnectorNonNative__factory.ts index e418b28d..d915e84f 100644 --- a/typechain-types/factories/contracts/prototypes/evm/ZetaConnectorNonNative__factory.ts +++ b/typechain-types/factories/contracts/prototypes/evm/ZetaConnectorNonNative__factory.ts @@ -31,6 +31,11 @@ const _abi = [ stateMutability: "nonpayable", type: "constructor", }, + { + inputs: [], + name: "ExceedsMaxSupply", + type: "error", + }, { inputs: [], name: "InvalidSender", @@ -41,6 +46,19 @@ const _abi = [ name: "ZeroAddress", type: "error", }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "maxSupply", + type: "uint256", + }, + ], + name: "MaxSupplyUpdated", + type: "event", + }, { anonymous: false, inputs: [ @@ -123,6 +141,19 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [], + name: "maxSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -136,6 +167,19 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "uint256", + name: "_maxSupply", + type: "uint256", + }, + ], + name: "setMaxSupply", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [], name: "tssAddress", @@ -244,7 +288,7 @@ const _abi = [ ] as const; const _bytecode = - "0x60c06040523480156200001157600080fd5b50604051620010c3380380620010c38339818101604052810190620000379190620001ec565b8282826001600081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480620000aa5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620000e25750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156200011a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050506200029b565b600081519050620001e68162000281565b92915050565b6000806000606084860312156200020857620002076200027c565b5b60006200021886828701620001d5565b93505060206200022b86828701620001d5565b92505060406200023e86828701620001d5565b9150509250925092565b600062000255826200025c565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6200028c8162000248565b81146200029857600080fd5b50565b60805160601c60a05160601c610db66200030d600039600081816101dd015281816102c80152818161042f0152818161053d015281816106160152818161070101526107d90152600081816102190152818161028c015281816105190152818161065201526106c50152610db66000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806321e093b11161005b57806321e093b1146100d85780635b112591146100f65780635e3e9fef14610114578063743e0c9b146101305761007d565b806302d5c89914610082578063106e62901461009e578063116191b6146100ba575b600080fd5b61009c600480360381019061009791906109a9565b61014c565b005b6100b860048036038101906100b39190610956565b61039e565b005b6100c2610517565b6040516100cf9190610bb3565b60405180910390f35b6100e061053b565b6040516100ed9190610aea565b60405180910390f35b6100fe61055f565b60405161010b9190610aea565b60405180910390f35b61012e600480360381019061012991906109a9565b610585565b005b61014a60048036038101906101459190610a31565b6107d7565b005b610154610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101db576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161025893929190610b7c565b600060405180830381600087803b15801561027257600080fd5b505af1158015610286573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b8969bd47f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b815260040161030b959493929190610b05565b600060405180830381600087803b15801561032557600080fd5b505af1158015610339573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe85858560405161038793929190610c09565b60405180910390a26103976108b7565b5050505050565b6103a6610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461042d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee8484846040518463ffffffff1660e01b815260040161048a93929190610b7c565b600060405180830381600087803b1580156104a457600080fd5b505af11580156104b8573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364836040516105029190610bee565b60405180910390a26105126108b7565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61058d610867565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610614576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161069193929190610b7c565b600060405180830381600087803b1580156106ab57600080fd5b505af11580156106bf573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635131ab597f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b8152600401610744959493929190610b05565b600060405180830381600087803b15801561075e57600080fd5b505af1158015610772573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced8585856040516107c093929190610c09565b60405180910390a26107d06108b7565b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166379cc679033836040518363ffffffff1660e01b8152600401610832929190610b53565b600060405180830381600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b5050505050565b600260005414156108ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a490610bce565b60405180910390fd5b6002600081905550565b6001600081905550565b6000813590506108d081610d3b565b92915050565b6000813590506108e581610d52565b92915050565b60008083601f84011261090157610900610ced565b5b8235905067ffffffffffffffff81111561091e5761091d610ce8565b5b60208301915083600182028301111561093a57610939610cf2565b5b9250929050565b60008135905061095081610d69565b92915050565b60008060006060848603121561096f5761096e610cfc565b5b600061097d868287016108c1565b935050602061098e86828701610941565b925050604061099f868287016108d6565b9150509250925092565b6000806000806000608086880312156109c5576109c4610cfc565b5b60006109d3888289016108c1565b95505060206109e488828901610941565b945050604086013567ffffffffffffffff811115610a0557610a04610cf7565b5b610a11888289016108eb565b93509350506060610a24888289016108d6565b9150509295509295909350565b600060208284031215610a4757610a46610cfc565b5b6000610a5584828501610941565b91505092915050565b610a6781610c5d565b82525050565b610a7681610c6f565b82525050565b6000610a888385610c3b565b9350610a95838584610cd9565b610a9e83610d01565b840190509392505050565b610ab281610ca3565b82525050565b6000610ac5601f83610c4c565b9150610ad082610d12565b602082019050919050565b610ae481610c99565b82525050565b6000602082019050610aff6000830184610a5e565b92915050565b6000608082019050610b1a6000830188610a5e565b610b276020830187610a5e565b610b346040830186610adb565b8181036060830152610b47818486610a7c565b90509695505050505050565b6000604082019050610b686000830185610a5e565b610b756020830184610adb565b9392505050565b6000606082019050610b916000830186610a5e565b610b9e6020830185610adb565b610bab6040830184610a6d565b949350505050565b6000602082019050610bc86000830184610aa9565b92915050565b60006020820190508181036000830152610be781610ab8565b9050919050565b6000602082019050610c036000830184610adb565b92915050565b6000604082019050610c1e6000830186610adb565b8181036020830152610c31818486610a7c565b9050949350505050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610c6882610c79565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cae82610cb5565b9050919050565b6000610cc082610cc7565b9050919050565b6000610cd282610c79565b9050919050565b82818337600083830152505050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b610d4481610c5d565b8114610d4f57600080fd5b50565b610d5b81610c6f565b8114610d6657600080fd5b50565b610d7281610c99565b8114610d7d57600080fd5b5056fea26469706673582212209d543e668c793d4944964e21ce09680a6432aef47847a599106ee141e7a8a01264736f6c63430008070033"; + "0x60c06040527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002553480156200003557600080fd5b506040516200158d3803806200158d83398181016040528101906200005b919062000210565b8282826001600081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480620000ce5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620001065750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b156200013e576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620002bf565b6000815190506200020a81620002a5565b92915050565b6000806000606084860312156200022c576200022b620002a0565b5b60006200023c86828701620001f9565b93505060206200024f86828701620001f9565b92505060406200026286828701620001f9565b9150509250925092565b6000620002798262000280565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b620002b0816200026c565b8114620002bc57600080fd5b50565b60805160601c60a05160601c611247620003466000396000818161023001528181610311015281816103fc0152818161056601528181610647015281816107550152818161083101528181610912015281816109fd0152610b9d01526000818161034d015281816103c0015281816107310152818161094e01526109c101526112476000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80635b112591116100665780635b1125911461010c5780635e3e9fef1461012a5780636f8b44b014610146578063743e0c9b14610162578063d5abeb011461017e57610093565b806302d5c89914610098578063106e6290146100b4578063116191b6146100d057806321e093b1146100ee575b600080fd5b6100b260048036038101906100ad9190610d88565b61019c565b005b6100ce60048036038101906100c99190610d35565b6104d2565b005b6100d861072f565b6040516100e59190610fbf565b60405180910390f35b6100f6610753565b6040516101039190610ef6565b60405180910390f35b610114610777565b6040516101219190610ef6565b60405180910390f35b610144600480360381019061013f9190610d88565b61079d565b005b610160600480360381019061015b9190610e10565b610ad3565b005b61017c60048036038101906101779190610e10565b610b9b565b005b610186610c2b565b6040516101939190610ffa565b60405180910390f35b6101a4610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461022b576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029457600080fd5b505afa1580156102a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cc9190610e3d565b856102d79190611069565b111561030f576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161038c93929190610f88565b600060405180830381600087803b1580156103a657600080fd5b505af11580156103ba573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b8969bd47f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b815260040161043f959493929190610f11565b600060405180830381600087803b15801561045957600080fd5b505af115801561046d573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe8585856040516104bb93929190611015565b60405180910390a26104cb610c81565b5050505050565b6104da610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610561576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ca57600080fd5b505afa1580156105de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106029190610e3d565b8361060d9190611069565b1115610645576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee8484846040518463ffffffff1660e01b81526004016106a293929190610f88565b600060405180830381600087803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161071a9190610ffa565b60405180910390a261072a610c81565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6107a5610c31565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461082c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561089557600080fd5b505afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd9190610e3d565b856108d89190611069565b1115610910576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16631e458bee7f000000000000000000000000000000000000000000000000000000000000000086846040518463ffffffff1660e01b815260040161098d93929190610f88565b600060405180830381600087803b1580156109a757600080fd5b505af11580156109bb573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16635131ab597f0000000000000000000000000000000000000000000000000000000000000000878787876040518663ffffffff1660e01b8152600401610a40959493929190610f11565b600060405180830381600087803b158015610a5a57600080fd5b505af1158015610a6e573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced858585604051610abc93929190611015565b60405180910390a2610acc610c81565b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b5a576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806002819055507f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c81604051610b909190610ffa565b60405180910390a150565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166379cc679033836040518363ffffffff1660e01b8152600401610bf6929190610f5f565b600060405180830381600087803b158015610c1057600080fd5b505af1158015610c24573d6000803e3d6000fd5b5050505050565b60025481565b60026000541415610c77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6e90610fda565b60405180910390fd5b6002600081905550565b6001600081905550565b600081359050610c9a816111cc565b92915050565b600081359050610caf816111e3565b92915050565b60008083601f840112610ccb57610cca61117e565b5b8235905067ffffffffffffffff811115610ce857610ce7611179565b5b602083019150836001820283011115610d0457610d03611183565b5b9250929050565b600081359050610d1a816111fa565b92915050565b600081519050610d2f816111fa565b92915050565b600080600060608486031215610d4e57610d4d61118d565b5b6000610d5c86828701610c8b565b9350506020610d6d86828701610d0b565b9250506040610d7e86828701610ca0565b9150509250925092565b600080600080600060808688031215610da457610da361118d565b5b6000610db288828901610c8b565b9550506020610dc388828901610d0b565b945050604086013567ffffffffffffffff811115610de457610de3611188565b5b610df088828901610cb5565b93509350506060610e0388828901610ca0565b9150509295509295909350565b600060208284031215610e2657610e2561118d565b5b6000610e3484828501610d0b565b91505092915050565b600060208284031215610e5357610e5261118d565b5b6000610e6184828501610d20565b91505092915050565b610e73816110bf565b82525050565b610e82816110d1565b82525050565b6000610e948385611047565b9350610ea183858461113b565b610eaa83611192565b840190509392505050565b610ebe81611105565b82525050565b6000610ed1601f83611058565b9150610edc826111a3565b602082019050919050565b610ef0816110fb565b82525050565b6000602082019050610f0b6000830184610e6a565b92915050565b6000608082019050610f266000830188610e6a565b610f336020830187610e6a565b610f406040830186610ee7565b8181036060830152610f53818486610e88565b90509695505050505050565b6000604082019050610f746000830185610e6a565b610f816020830184610ee7565b9392505050565b6000606082019050610f9d6000830186610e6a565b610faa6020830185610ee7565b610fb76040830184610e79565b949350505050565b6000602082019050610fd46000830184610eb5565b92915050565b60006020820190508181036000830152610ff381610ec4565b9050919050565b600060208201905061100f6000830184610ee7565b92915050565b600060408201905061102a6000830186610ee7565b818103602083015261103d818486610e88565b9050949350505050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611074826110fb565b915061107f836110fb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156110b4576110b361114a565b5b828201905092915050565b60006110ca826110db565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061111082611117565b9050919050565b600061112282611129565b9050919050565b6000611134826110db565b9050919050565b82818337600083830152505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6111d5816110bf565b81146111e057600080fd5b50565b6111ec816110d1565b81146111f757600080fd5b50565b611203816110fb565b811461120e57600080fd5b5056fea26469706673582212201f817c0195940fddc4165c2ca6317081a920edafb2f79b81682fec2a95beb85364736f6c63430008070033"; type ZetaConnectorNonNativeConstructorParams = | [signer?: Signer]