diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5bfafdb7c..11de25d55 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -21,8 +21,7 @@ jobs: solhint --version - name: Run Lint - run: | - ./scripts/lint.sh -l sol + run: ./scripts/lint.sh --sol-lint golangci: runs-on: ubuntu-20.04 @@ -43,5 +42,21 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run Lint - run: | - ./scripts/lint.sh -l go + run: ./scripts/lint.sh --go-lint + + format-solidity: + runs-on: ubuntu-20.04 + timeout-minutes: 10 + steps: + - name: Checkout repository and submodules + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + run: ./scripts/install_foundry.sh + + - name: Check Solidity Formatting + run: | + export PATH=$PATH:$HOME/.foundry/bin + ./scripts/lint.sh --sol-format-check diff --git a/abi-bindings/go/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go b/abi-bindings/go/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go index 7ce0423c8..f2c5dfcfe 100644 --- a/abi-bindings/go/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go +++ b/abi-bindings/go/CrossChainApplications/ERC20Bridge/BridgeToken/BridgeToken.go @@ -32,7 +32,7 @@ var ( // BridgeTokenMetaData contains all meta data concerning the BridgeToken contract. var BridgeTokenMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sourceBridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sourceAsset\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"tokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"tokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"tokenDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeAsset\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea26469706673582212208a8e82a679ec260481bb5d10cf7933d8213beeeb9291c42d2ad6b12aa8eb16e264736f6c63430008120033", + Bin: "0x6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea2646970667358221220ff15d87d9e06053eea65bea2fb7624abc50212a4686d7d62b9d7a5a0ec3d931364736f6c63430008120033", } // BridgeTokenABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index 417861656..f112fcb00 100644 --- a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -31,8 +31,8 @@ var ( // ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. var ERC20BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"CreateBridgeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintBridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"SubmitCreateBridgeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CREATE_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"primaryFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondaryFeeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nativeName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"nativeSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"nativeDecimals\",\"type\":\"uint8\"}],\"name\":\"encodeCreateBridgeTokenData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"bridgeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeMintBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeTransferBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"contractERC20\",\"name\":\"nativeToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"messageFeeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"messageFeeAmount\",\"type\":\"uint256\"}],\"name\":\"submitCreateBridgeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"tokenCreationSubmitted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeToken\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"bridgeTokenExists\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b506040516200440738038062004407833981016040819052620000349162000212565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d919062000244565b600255506200013c33620001c0565b507302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000190573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b6919062000244565b60a052506200025e565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156200022557600080fd5b81516001600160a01b03811681146200023d57600080fd5b9392505050565b6000602082840312156200025757600080fd5b5051919050565b60805160a051614159620002ae600039600081816101f801528181610a42015281816119c1015261228c01526000818161017401528181610d0201528181610f2f015261113201526141596000f3fe60806040523480156200001157600080fd5b5060043610620001695760003560e01c80637a465fd911620000d3578063b9e55da11162000086578063b9e55da11462000394578063c60da61214620003c8578063c63d220714620003df578063c868efaa14620003f6578063d2cc7a70146200040d578063f2fde38b146200041657600080fd5b80637a465fd914620002c35780638343f66114620002ce5780638c56fcf014620003165780638da5cb5b146200032d57806397314297146200033f5780639bd9abc0146200036e57600080fd5b80635f217bcc116200012c5780635f217bcc146200024057806365435568146200024b5780636b47cd9a14620002885780636c7e40d11462000293578063715018a614620002aa5780637497185614620002b457600080fd5b80631a7f5bec146200016e5780632b0d8f1814620001b3578063367e958414620001cc5780634950d2d014620001f25780635eb995141462000229575b600080fd5b620001967f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b620001ca620001c436600462002512565b6200042d565b005b620001e3620001dd36600462002613565b6200057a565b604051620001aa9190620026fb565b6200021a7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001620001aa565b620001ca6200023a36600462002710565b620005d9565b6200021a621e848081565b620001966200025c3660046200272a565b60076020908152600093845260408085208252928452828420905282529020546001600160a01b031681565b6200021a620493e081565b620001ca620002a436600462002771565b620005f1565b620001ca62000942565b620001966005600160991b0181565b6200021a62030d4081565b62000305620002df3660046200272a565b600460209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001620001aa565b620001e362000327366004620027d3565b6200095a565b6003546001600160a01b031662000196565b620003056200035036600462002512565b6001600160a01b031660009081526001602052604090205460ff1690565b620003056200037f36600462002512565b60066020526000908152604090205460ff1681565b6200021a620003a53660046200272a565b600560209081526000938452604080852082529284528284209052825290205481565b620001e3620003d936600462002819565b620009b6565b620001ca620003f036600462002885565b62000a36565b620001ca62000407366004620028fa565b62000cea565b6002546200021a565b620001ca6200042736600462002512565b62000ea5565b6200043762000f21565b6001600160a01b038116620004aa5760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560448201526d706f72746572206164647265737360901b60648201526084015b60405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff16156200052b5760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b6064820152608401620004a1565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b60606000858585856040516020016200059794939291906200298a565b6040516020818303038152906040529050600081604051602001620005be929190620029ef565b6040516020818303038152906040529150505b949350505050565b620005e362000f21565b620005ee8162000f2b565b50565b620005fb620010d2565b6001600160a01b038416620006245760405162461bcd60e51b8152600401620004a19062002a29565b6000620006306200112d565b9050600082156200065f5762000647848462001247565b90506200065f6001600160a01b0385168383620013bd565b60006200079d86876001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015620006a5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620006cf919081019062002ace565b886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa1580156200070e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000738919081019062002ace565b896001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000777573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001dd919062002b07565b90506000836001600160a01b031663624488506040518060c001604052808c81526020018b6001600160a01b0316815260200160405180604001604052808b6001600160a01b03168152602001888152508152602001621e84808152602001600067ffffffffffffffff81111562000819576200081962002532565b60405190808252806020026020018201604052801562000843578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b81526004016200086b919062002b6d565b6020604051808303816000875af11580156200088b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008b1919062002bef565b60008a81526004602090815260408083206001600160a01b03808e16808652918452828520908d16808652935292819020805460ff1916600117905551929350918b907f110b902745a3d7d6b66732479f01de654a3bc6e501be7c8ba2c3a6f9868cb53990620009249086815260200190565b60405180910390a4505050506200093b6001600055565b5050505050565b6200094c620014a9565b62000958600062001505565b565b60606000848484604051602001620009759392919062002c09565b60405160208183030381529060405290506001816040516020016200099c929190620029ef565b6040516020818303038152906040529150505b9392505050565b60408051602081018890526001600160a01b0387811682840152868116606080840191909152908616608083015260a0820185905260c08083018590528351808403909101815260e08301909352919062000a1a90600290839061010001620029ef565b6040516020818303038152906040529150509695505050505050565b62000a40620010d2565b7f0000000000000000000000000000000000000000000000000000000000000000870362000a825760405162461bcd60e51b8152600401620004a19062002c2d565b6001600160a01b03841662000aab5760405162461bcd60e51b8152600401620004a19062002c75565b6001600160a01b03861662000ad45760405162461bcd60e51b8152600401620004a19062002a29565b6001600160a01b03851660009081526006602052604090205460ff161562000bbf5762000b02818362002cce565b831162000b615760405162461bcd60e51b815260206004820152602660248201527f45524332304272696467653a20696e73756666696369656e7420746f74616c20604482015265185b5bdd5b9d60d21b6064820152608401620004a1565b62000bb96040518060e00160405280898152602001886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018381525062001557565b62000cd6565b60008781526004602090815260408083206001600160a01b03808b168552908352818420908916845290915290205460ff1662000c515760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e76616c69642062726964676520746f6b656044820152686e206164647265737360b81b6064820152608401620004a1565b600062000c5f868562001247565b905082811162000cc45760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e73756666696369656e742061646a757374604482015268195908185b5bdd5b9d60ba1b6064820152608401620004a1565b62000cd488888888858862001943565b505b62000ce16001600055565b50505050505050565b60025460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801562000d52573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d78919062002bef565b101562000de15760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b6064820152608401620004a1565b3360009081526001602052604090205460ff161562000e5c5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b6064820152608401620004a1565b62000e9f848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062001bff92505050565b50505050565b62000eaf620014a9565b6001600160a01b03811662000f165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401620004a1565b620005ee8162001505565b62000958620014a9565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000f8c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fb2919062002bef565b60025490915081831115620010245760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b6064820152608401620004a1565b8083116200109b5760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e006064820152608401620004a1565b6002839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b600260005403620011265760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401620004a1565b6002600055565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200118f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011b5919062002ce4565b9050620011da816001600160a01b031660009081526001602052604090205460ff1690565b15620012425760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881cd95b991a5b99c81c185d5cd95960821b6064820152608401620004a1565b919050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801562001291573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012b7919062002bef565b9050620012d06001600160a01b03851633308662001d7d565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801562001318573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200133e919062002bef565b9050818111620013a65760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b6064820152608401620004a1565b620013b2828262002d04565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156200140f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001435919062002bef565b62001441919062002cce565b6040516001600160a01b03851660248201526044810182905290915062000e9f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001da1565b6003546001600160a01b03163314620009585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620004a1565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000620015636200112d565b90506000808360a001511115620015a6576200158883604001518460a0015162001247565b6040840151909150620015a6906001600160a01b03168383620013bd565b60008360a001518460800151620015be919062002d04565b604085810151905163079cc67960e41b815233600482015260248101839052919250906001600160a01b038216906379cc679090604401600060405180830381600087803b1580156200161057600080fd5b505af115801562001625573d6000803e3d6000fd5b505050506000816001600160a01b031663f72539686040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200166a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001690919062002bef565b90506000826001600160a01b0316631a0b79bf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620016d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620016f9919062002ce4565b9050818760000151036200173f57806001600160a01b031687602001516001600160a01b0316146200173f5760405162461bcd60e51b8152600401620004a19062002d1a565b6000620017c588600001518960200151866001600160a01b03166374d32ad46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200178e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620017b4919062002ce4565b8b60600151898d60c00151620009b6565b90506000876001600160a01b031663624488506040518060c00160405280878152602001866001600160a01b0316815260200160405180604001604052808e604001516001600160a01b031681526020018c8152508152602001620493e08152602001600067ffffffffffffffff81111562001845576200184562002532565b6040519080825280602002602001820160405280156200186f578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001897919062002b6d565b6020604051808303816000875af1158015620018b7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018dd919062002bef565b90508089600001518a604001516001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c602001518d606001518b604051620019309392919062002c09565b60405180910390a4505050505050505050565b6001600160a01b03841660009081526006602052604090205460ff1615620019bf5760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2063616e6e6f742062726964676520777261707060448201526732b2103a37b5b2b760c11b6064820152608401620004a1565b7f0000000000000000000000000000000000000000000000000000000000000000860362001a015760405162461bcd60e51b8152600401620004a19062002c2d565b600062001a0d6200112d565b9050811562001a2c5762001a2c6001600160a01b0386168284620013bd565b600062001a3a838562002d04565b60008981526005602090815260408083206001600160a01b03808d168552908352818420908b16845290915281208054929350839290919062001a7f90849062002cce565b909155506000905062001a948787846200095a565b90506000836001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b031681526020018a815250815260200162030d408152602001600067ffffffffffffffff81111562001b105762001b1062002532565b60405190808252806020026020018201604052801562001b3a578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001b62919062002b6d565b6020604051808303816000875af115801562001b82573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ba8919062002bef565b9050808a896001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c8b8860405162001beb9392919062002c09565b60405180910390a450505050505050505050565b6000808280602001905181019062001c18919062002d69565b9092509050600082600281111562001c345762001c34620029d9565b0362001c78576000806000808480602001905181019062001c56919062002dd8565b935093509350935062001c6e89898686868662001e7f565b505050506200093b565b600182600281111562001c8f5762001c8f620029d9565b0362001cce5760008060008380602001905181019062001cb0919062002e62565b92509250925062001cc5888885858562001fee565b5050506200093b565b600282600281111562001ce55762001ce5620029d9565b0362001d34576000806000806000808680602001905181019062001d0a919062002eaa565b95509550955095509550955062001d288b8b88888888888862002168565b5050505050506200093b565b60405162461bcd60e51b815260206004820152601b60248201527f45524332304272696467653a20696e76616c696420616374696f6e00000000006044820152606401620004a1565b62000e9f846323b872dd60e01b858585604051602401620014719392919062002c09565b600062001df8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620023219092919063ffffffff16565b80519091501562001e7a578080602001905181019062001e19919062002f1a565b62001e7a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620004a1565b505050565b60008681526007602090815260408083206001600160a01b038981168552908352818420888216855290925290912054161562001f105760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20616c72656164604482015267792065786973747360c01b6064820152608401620004a1565b600086868686868660405162001f2690620024ee565b62001f379695949392919062002f3e565b604051809103906000f08015801562001f54573d6000803e3d6000fd5b506001600160a01b038181166000818152600660209081526040808320805460ff191660011790558c8352600782528083208c8616808552908352818420958c168085529583529281902080546001600160a01b031916851790555192835293945091928a917fe1c61a845f79534e11924517ddbedc668d0c20e467eafb4d3bd2858e2815f3b5910160405180910390a450505050505050565b62001ff8620010d2565b6001600160a01b038216620020215760405162461bcd60e51b8152600401620004a19062002c75565b60008581526007602090815260408083206001600160a01b0380891685529083528184208782168552909252909120541680620020b25760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20646f6573206e6044820152671bdd08195e1a5cdd60c21b6064820152608401620004a1565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490528216906340c10f1990604401600060405180830381600087803b158015620020fd57600080fd5b505af115801562002112573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052851693507fc0767f158f0d5394b598489a51ed607cd55a8be2dcef113ba1626efcf4c6395492500160405180910390a2506200093b6001600055565b62002172620010d2565b6001600160a01b0383166200219b5760405162461bcd60e51b8152600401620004a19062002c75565b6001600160a01b038516620021c45760405162461bcd60e51b8152600401620004a19062002a29565b60008881526005602090815260408083206001600160a01b03808c1685529083528184209088168452909152902054828110156200224f5760405162461bcd60e51b815260206004820152602160248201527f45524332304272696467653a20696e73756666696369656e742062616c616e636044820152606560f81b6064820152608401620004a1565b6200225b838262002d04565b60008a81526005602090815260408083206001600160a01b03808e168552908352818420908a1684529091529020557f00000000000000000000000000000000000000000000000000000000000000008703620022fa576001600160a01b0386163014620022dd5760405162461bcd60e51b8152600401620004a19062002d1a565b620022f36001600160a01b038616858562002332565b506200230c565b6200230a87878787878762001943565b505b620023176001600055565b5050505050505050565b6060620005d1848460008562002364565b6040516001600160a01b03831660248201526044810182905262001e7a90849063a9059cbb60e01b9060640162001471565b606082471015620023c75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620004a1565b600080866001600160a01b03168587604051620023e5919062002f9d565b60006040518083038185875af1925050503d806000811462002424576040519150601f19603f3d011682016040523d82523d6000602084013e62002429565b606091505b50915091506200243c8783838762002447565b979650505050505050565b60608315620024bb578251600003620024b3576001600160a01b0385163b620024b35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620004a1565b5081620005d1565b620005d18383815115620024d25781518083602001fd5b8060405162461bcd60e51b8152600401620004a19190620026fb565b6111688062002fbc83390190565b6001600160a01b0381168114620005ee57600080fd5b6000602082840312156200252557600080fd5b8135620009af81620024fc565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171562002574576200257462002532565b604052919050565b600067ffffffffffffffff82111562002599576200259962002532565b50601f01601f191660200190565b600082601f830112620025b957600080fd5b8135620025d0620025ca826200257c565b62002548565b818152846020838601011115620025e657600080fd5b816020850160208301376000918101602001919091529392505050565b60ff81168114620005ee57600080fd5b600080600080608085870312156200262a57600080fd5b84356200263781620024fc565b9350602085013567ffffffffffffffff808211156200265557600080fd5b6200266388838901620025a7565b945060408701359150808211156200267a57600080fd5b506200268987828801620025a7565b92505060608501356200269c8162002603565b939692955090935050565b60005b83811015620026c4578181015183820152602001620026aa565b50506000910152565b60008151808452620026e7816020860160208601620026a7565b601f01601f19169290920160200192915050565b602081526000620009af6020830184620026cd565b6000602082840312156200272357600080fd5b5035919050565b6000806000606084860312156200274057600080fd5b8335925060208401356200275481620024fc565b915060408401356200276681620024fc565b809150509250925092565b600080600080600060a086880312156200278a57600080fd5b8535945060208601356200279e81620024fc565b93506040860135620027b081620024fc565b92506060860135620027c281620024fc565b949793965091946080013592915050565b600080600060608486031215620027e957600080fd5b8335620027f681620024fc565b925060208401356200280881620024fc565b929592945050506040919091013590565b60008060008060008060c087890312156200283357600080fd5b8635955060208701356200284781620024fc565b945060408701356200285981620024fc565b935060608701356200286b81620024fc565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a031215620028a157600080fd5b873596506020880135620028b581620024fc565b95506040880135620028c781620024fc565b94506060880135620028d981620024fc565b9699959850939660808101359560a0820135955060c0909101359350915050565b600080600080606085870312156200291157600080fd5b8435935060208501356200292581620024fc565b9250604085013567ffffffffffffffff808211156200294357600080fd5b818701915087601f8301126200295857600080fd5b8135818111156200296857600080fd5b8860208285010111156200297b57600080fd5b95989497505060200194505050565b6001600160a01b0385168152608060208201819052600090620029b090830186620026cd565b8281036040840152620029c48186620026cd565b91505060ff8316606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b60006003841062002a1057634e487b7160e01b600052602160045260246000fd5b83825260406020830152620005d16040830184620026cd565b6020808252602c908201527f45524332304272696467653a207a65726f2064657374696e6174696f6e20627260408201526b69646765206164647265737360a01b606082015260800190565b600062002a86620025ca846200257c565b905082815283838301111562002a9b57600080fd5b620009af836020830184620026a7565b600082601f83011262002abd57600080fd5b620009af8383516020850162002a75565b60006020828403121562002ae157600080fd5b815167ffffffffffffffff81111562002af957600080fd5b620005d18482850162002aab565b60006020828403121562002b1a57600080fd5b8151620009af8162002603565b600081518084526020808501945080840160005b8381101562002b625781516001600160a01b03168752958201959082019060010162002b3b565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015262002bd061010084018262002b27565b905060a0840151601f198483030160e0850152620013b28282620026cd565b60006020828403121562002c0257600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526028908201527f45524332304272696467653a2063616e6e6f742062726964676520746f20736160408201526736b29031b430b4b760c11b606082015260800190565b60208082526023908201527f45524332304272696467653a207a65726f20726563697069656e74206164647260408201526265737360e81b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115620013b757620013b762002cb8565b60006020828403121562002cf757600080fd5b8151620009af81620024fc565b81810381811115620013b757620013b762002cb8565b6020808252602f908201527f45524332304272696467653a20696e76616c69642064657374696e6174696f6e60408201526e20627269646765206164647265737360881b606082015260800190565b6000806040838503121562002d7d57600080fd5b82516003811062002d8d57600080fd5b602084015190925067ffffffffffffffff81111562002dab57600080fd5b8301601f8101851362002dbd57600080fd5b62002dce8582516020840162002a75565b9150509250929050565b6000806000806080858703121562002def57600080fd5b845162002dfc81620024fc565b602086015190945067ffffffffffffffff8082111562002e1b57600080fd5b62002e298883890162002aab565b9450604087015191508082111562002e4057600080fd5b5062002e4f8782880162002aab565b92505060608501516200269c8162002603565b60008060006060848603121562002e7857600080fd5b835162002e8581620024fc565b602085015190935062002e9881620024fc565b80925050604084015190509250925092565b60008060008060008060c0878903121562002ec457600080fd5b86519550602087015162002ed881620024fc565b604088015190955062002eeb81620024fc565b606088015190945062002efe81620024fc565b809350506080870151915060a087015190509295509295509295565b60006020828403121562002f2d57600080fd5b81518015158114620009af57600080fd5b8681526001600160a01b0386811660208301528516604082015260c06060820181905260009062002f7290830186620026cd565b828103608084015262002f868186620026cd565b91505060ff831660a0830152979650505050505050565b6000825162002fb1818460208701620026a7565b919091019291505056fe6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea26469706673582212208a8e82a679ec260481bb5d10cf7933d8213beeeb9291c42d2ad6b12aa8eb16e264736f6c63430008120033a26469706673582212201a6762e1ca2a6c158b8866f6e8aabad27e479be480b76d34bbab5720b348768764736f6c63430008120033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"name\":\"CreateBridgeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"contractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MintBridgeTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"}],\"name\":\"SubmitCreateBridgeToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressUnpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CREATE_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_BRIDGE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_PRECOMPILE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"primaryFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondaryFeeAmount\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nativeName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"nativeSymbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"nativeDecimals\",\"type\":\"uint8\"}],\"name\":\"encodeCreateBridgeTokenData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"bridgeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeMintBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeContractAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"}],\"name\":\"encodeTransferBridgeTokensData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenAddress\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridgeTokenAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"contractERC20\",\"name\":\"nativeToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"messageFeeAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"messageFeeAmount\",\"type\":\"uint256\"}],\"name\":\"submitCreateBridgeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"nativeTokenContract\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"tokenCreationSubmitted\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"unpauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridgeToken\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"bridgeTokenExists\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x60c06040523480156200001157600080fd5b50604051620044ff380380620044ff833981016040819052620000349162000212565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d919062000244565b600255506200013c33620001c0565b507302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000190573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b6919062000244565b60a052506200025e565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156200022557600080fd5b81516001600160a01b03811681146200023d57600080fd5b9392505050565b6000602082840312156200025757600080fd5b5051919050565b60805160a051614251620002ae6000396000818161021b01528181610b0c01528181611a6b015261233601526000818161018001528181610dcc01528181610ff101526111f401526142516000f3fe60806040523480156200001157600080fd5b5060043610620001755760003560e01c80637a465fd911620000d3578063b9e55da11162000086578063b9e55da1146200039f578063c60da61214620003d3578063c63d220714620003ea578063c868efaa1462000401578063d2cc7a701462000418578063f2fde38b146200042157600080fd5b80637a465fd914620002e65780638343f66114620002f15780638c56fcf014620003395780638da5cb5b14620003505780639731429714620003625780639bd9abc0146200037957600080fd5b80635f217bcc116200012c5780635f217bcc146200026357806365435568146200026e5780636b47cd9a14620002ab5780636c7e40d114620002b6578063715018a614620002cd5780637497185614620002d757600080fd5b80631a7f5bec146200017a5780632b0d8f1814620001bf578063367e958414620001d85780634511243e14620001fe5780634950d2d014620002155780635eb99514146200024c575b600080fd5b620001a27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b620001d6620001d0366004620025bc565b62000438565b005b620001ef620001e9366004620026bd565b62000533565b604051620001b69190620027a5565b620001d66200020f366004620025bc565b62000592565b6200023d7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001620001b6565b620001d66200025d366004620027ba565b62000685565b6200023d621e848081565b620001a26200027f366004620027d4565b60076020908152600093845260408085208252928452828420905282529020546001600160a01b031681565b6200023d620493e081565b620001d6620002c73660046200281b565b6200069d565b620001d6620009ee565b620001a26005600160991b0181565b6200023d62030d4081565b6200032862000302366004620027d4565b600460209081526000938452604080852082529284528284209052825290205460ff1681565b6040519015158152602001620001b6565b620001ef6200034a3660046200287d565b62000a06565b6003546001600160a01b0316620001a2565b6200032862000373366004620025bc565b62000a62565b620003286200038a366004620025bc565b60066020526000908152604090205460ff1681565b6200023d620003b0366004620027d4565b600560209081526000938452604080852082529284528284209052825290205481565b620001ef620003e4366004620028c3565b62000a80565b620001d6620003fb3660046200292f565b62000b00565b620001d662000412366004620029a4565b62000db4565b6002546200023d565b620001d662000432366004620025bc565b62000f67565b6200044262000fe3565b6001600160a01b038116620004745760405162461bcd60e51b81526004016200046b9062002a34565b60405180910390fd5b6200047f8162000a62565b15620004e45760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b60648201526084016200046b565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b606060008585858560405160200162000550949392919062002a82565b60405160208183030381529060405290506000816040516020016200057792919062002ae7565b6040516020818303038152906040529150505b949350505050565b6200059c62000fe3565b6001600160a01b038116620005c55760405162461bcd60e51b81526004016200046b9062002a34565b620005d08162000a62565b620006305760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465725570677261646561626c653a2061646472657373206e6044820152681bdd081c185d5cd95960ba1b60648201526084016200046b565b6040516001600160a01b038216907f844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c390600090a26001600160a01b03166000908152600160205260409020805460ff19169055565b6200068f62000fe3565b6200069a8162000fed565b50565b620006a762001194565b6001600160a01b038416620006d05760405162461bcd60e51b81526004016200046b9062002b21565b6000620006dc620011ef565b9050600082156200070b57620006f38484620012f1565b90506200070b6001600160a01b038516838362001467565b60006200084986876001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000751573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200077b919081019062002bc6565b886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620007ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620007e4919081019062002bc6565b896001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000823573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e9919062002bff565b90506000836001600160a01b031663624488506040518060c001604052808c81526020018b6001600160a01b0316815260200160405180604001604052808b6001600160a01b03168152602001888152508152602001621e84808152602001600067ffffffffffffffff811115620008c557620008c5620025dc565b604051908082528060200260200182016040528015620008ef578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162000917919062002c65565b6020604051808303816000875af115801562000937573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200095d919062002ce7565b60008a81526004602090815260408083206001600160a01b03808e16808652918452828520908d16808652935292819020805460ff1916600117905551929350918b907f110b902745a3d7d6b66732479f01de654a3bc6e501be7c8ba2c3a6f9868cb53990620009d09086815260200190565b60405180910390a450505050620009e76001600055565b5050505050565b620009f862001553565b62000a046000620015af565b565b6060600084848460405160200162000a219392919062002d01565b604051602081830303815290604052905060018160405160200162000a4892919062002ae7565b6040516020818303038152906040529150505b9392505050565b6001600160a01b031660009081526001602052604090205460ff1690565b60408051602081018890526001600160a01b0387811682840152868116606080840191909152908616608083015260a0820185905260c08083018590528351808403909101815260e08301909352919062000ae49060029083906101000162002ae7565b6040516020818303038152906040529150509695505050505050565b62000b0a62001194565b7f0000000000000000000000000000000000000000000000000000000000000000870362000b4c5760405162461bcd60e51b81526004016200046b9062002d25565b6001600160a01b03841662000b755760405162461bcd60e51b81526004016200046b9062002d6d565b6001600160a01b03861662000b9e5760405162461bcd60e51b81526004016200046b9062002b21565b6001600160a01b03851660009081526006602052604090205460ff161562000c895762000bcc818362002dc6565b831162000c2b5760405162461bcd60e51b815260206004820152602660248201527f45524332304272696467653a20696e73756666696369656e7420746f74616c20604482015265185b5bdd5b9d60d21b60648201526084016200046b565b62000c836040518060e00160405280898152602001886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018381525062001601565b62000da0565b60008781526004602090815260408083206001600160a01b03808b168552908352818420908916845290915290205460ff1662000d1b5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e76616c69642062726964676520746f6b656044820152686e206164647265737360b81b60648201526084016200046b565b600062000d298685620012f1565b905082811162000d8e5760405162461bcd60e51b815260206004820152602960248201527f45524332304272696467653a20696e73756666696369656e742061646a757374604482015268195908185b5bdd5b9d60ba1b60648201526084016200046b565b62000d9e888888888588620019ed565b505b62000dab6001600055565b50505050505050565b60025460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801562000e1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e42919062002ce7565b101562000eab5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b60648201526084016200046b565b62000eb63362000a62565b1562000f1e5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b60648201526084016200046b565b62000f61848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525062001ca992505050565b50505050565b62000f7162001553565b6001600160a01b03811662000fd85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200046b565b6200069a81620015af565b62000a0462001553565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200104e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001074919062002ce7565b60025490915081831115620010e65760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b60648201526084016200046b565b8083116200115d5760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e0060648201526084016200046b565b6002839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b600260005403620011e85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016200046b565b6002600055565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001251573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001277919062002ddc565b9050620012848162000a62565b15620012ec5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881cd95b991a5b99c81c185d5cd95960821b60648201526084016200046b565b919050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156200133b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001361919062002ce7565b90506200137a6001600160a01b03851633308662001e27565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015620013c2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013e8919062002ce7565b9050818111620014505760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016200046b565b6200145c828262002dfc565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015620014b9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014df919062002ce7565b620014eb919062002dc6565b6040516001600160a01b03851660248201526044810182905290915062000f6190859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001e4b565b6003546001600160a01b0316331462000a045760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200046b565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006200160d620011ef565b90506000808360a00151111562001650576200163283604001518460a00151620012f1565b604084015190915062001650906001600160a01b0316838362001467565b60008360a00151846080015162001668919062002dfc565b604085810151905163079cc67960e41b815233600482015260248101839052919250906001600160a01b038216906379cc679090604401600060405180830381600087803b158015620016ba57600080fd5b505af1158015620016cf573d6000803e3d6000fd5b505050506000816001600160a01b031663f72539686040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001714573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200173a919062002ce7565b90506000826001600160a01b0316631a0b79bf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200177d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620017a3919062002ddc565b905081876000015103620017e957806001600160a01b031687602001516001600160a01b031614620017e95760405162461bcd60e51b81526004016200046b9062002e12565b60006200186f88600001518960200151866001600160a01b03166374d32ad46040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001838573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200185e919062002ddc565b8b60600151898d60c0015162000a80565b90506000876001600160a01b031663624488506040518060c00160405280878152602001866001600160a01b0316815260200160405180604001604052808e604001516001600160a01b031681526020018c8152508152602001620493e08152602001600067ffffffffffffffff811115620018ef57620018ef620025dc565b60405190808252806020026020018201604052801562001919578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001941919062002c65565b6020604051808303816000875af115801562001961573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001987919062002ce7565b90508089600001518a604001516001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c602001518d606001518b604051620019da9392919062002d01565b60405180910390a4505050505050505050565b6001600160a01b03841660009081526006602052604090205460ff161562001a695760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2063616e6e6f742062726964676520777261707060448201526732b2103a37b5b2b760c11b60648201526084016200046b565b7f0000000000000000000000000000000000000000000000000000000000000000860362001aab5760405162461bcd60e51b81526004016200046b9062002d25565b600062001ab7620011ef565b9050811562001ad65762001ad66001600160a01b038616828462001467565b600062001ae4838562002dfc565b60008981526005602090815260408083206001600160a01b03808d168552908352818420908b16845290915281208054929350839290919062001b2990849062002dc6565b909155506000905062001b3e87878462000a06565b90506000836001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b031681526020018a815250815260200162030d408152602001600067ffffffffffffffff81111562001bba5762001bba620025dc565b60405190808252806020026020018201604052801562001be4578160200160208202803683370190505b508152602001858152506040518263ffffffff1660e01b815260040162001c0c919062002c65565b6020604051808303816000875af115801562001c2c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001c52919062002ce7565b9050808a896001600160a01b03167f97935c4470efae40c8440c3abfe968a5512232dd375cc974e712f487c2b99c318c8b8860405162001c959392919062002d01565b60405180910390a450505050505050505050565b6000808280602001905181019062001cc2919062002e61565b9092509050600082600281111562001cde5762001cde62002ad1565b0362001d22576000806000808480602001905181019062001d00919062002ed0565b935093509350935062001d1889898686868662001f29565b50505050620009e7565b600182600281111562001d395762001d3962002ad1565b0362001d785760008060008380602001905181019062001d5a919062002f5a565b92509250925062001d6f888885858562002098565b505050620009e7565b600282600281111562001d8f5762001d8f62002ad1565b0362001dde576000806000806000808680602001905181019062001db4919062002fa2565b95509550955095509550955062001dd28b8b88888888888862002212565b505050505050620009e7565b60405162461bcd60e51b815260206004820152601b60248201527f45524332304272696467653a20696e76616c696420616374696f6e000000000060448201526064016200046b565b62000f61846323b872dd60e01b8585856040516024016200151b9392919062002d01565b600062001ea2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620023cb9092919063ffffffff16565b80519091501562001f24578080602001905181019062001ec3919062003012565b62001f245760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200046b565b505050565b60008681526007602090815260408083206001600160a01b038981168552908352818420888216855290925290912054161562001fba5760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20616c72656164604482015267792065786973747360c01b60648201526084016200046b565b600086868686868660405162001fd09062002598565b62001fe19695949392919062003036565b604051809103906000f08015801562001ffe573d6000803e3d6000fd5b506001600160a01b038181166000818152600660209081526040808320805460ff191660011790558c8352600782528083208c8616808552908352818420958c168085529583529281902080546001600160a01b031916851790555192835293945091928a917fe1c61a845f79534e11924517ddbedc668d0c20e467eafb4d3bd2858e2815f3b5910160405180910390a450505050505050565b620020a262001194565b6001600160a01b038216620020cb5760405162461bcd60e51b81526004016200046b9062002d6d565b60008581526007602090815260408083206001600160a01b03808916855290835281842087821685529092529091205416806200215c5760405162461bcd60e51b815260206004820152602860248201527f45524332304272696467653a2062726964676520746f6b656e20646f6573206e6044820152671bdd08195e1a5cdd60c21b60648201526084016200046b565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490528216906340c10f1990604401600060405180830381600087803b158015620021a757600080fd5b505af1158015620021bc573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052851693507fc0767f158f0d5394b598489a51ed607cd55a8be2dcef113ba1626efcf4c6395492500160405180910390a250620009e76001600055565b6200221c62001194565b6001600160a01b038316620022455760405162461bcd60e51b81526004016200046b9062002d6d565b6001600160a01b0385166200226e5760405162461bcd60e51b81526004016200046b9062002b21565b60008881526005602090815260408083206001600160a01b03808c168552908352818420908816845290915290205482811015620022f95760405162461bcd60e51b815260206004820152602160248201527f45524332304272696467653a20696e73756666696369656e742062616c616e636044820152606560f81b60648201526084016200046b565b62002305838262002dfc565b60008a81526005602090815260408083206001600160a01b03808e168552908352818420908a1684529091529020557f00000000000000000000000000000000000000000000000000000000000000008703620023a4576001600160a01b0386163014620023875760405162461bcd60e51b81526004016200046b9062002e12565b6200239d6001600160a01b0386168585620023dc565b50620023b6565b620023b4878787878787620019ed565b505b620023c16001600055565b5050505050505050565b60606200058a84846000856200240e565b6040516001600160a01b03831660248201526044810182905262001f2490849063a9059cbb60e01b906064016200151b565b606082471015620024715760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200046b565b600080866001600160a01b031685876040516200248f919062003095565b60006040518083038185875af1925050503d8060008114620024ce576040519150601f19603f3d011682016040523d82523d6000602084013e620024d3565b606091505b5091509150620024e687838387620024f1565b979650505050505050565b60608315620025655782516000036200255d576001600160a01b0385163b6200255d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200046b565b50816200058a565b6200058a83838151156200257c5781518083602001fd5b8060405162461bcd60e51b81526004016200046b9190620027a5565b61116880620030b483390190565b6001600160a01b03811681146200069a57600080fd5b600060208284031215620025cf57600080fd5b813562000a5b81620025a6565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156200261e576200261e620025dc565b604052919050565b600067ffffffffffffffff821115620026435762002643620025dc565b50601f01601f191660200190565b600082601f8301126200266357600080fd5b81356200267a620026748262002626565b620025f2565b8181528460208386010111156200269057600080fd5b816020850160208301376000918101602001919091529392505050565b60ff811681146200069a57600080fd5b60008060008060808587031215620026d457600080fd5b8435620026e181620025a6565b9350602085013567ffffffffffffffff80821115620026ff57600080fd5b6200270d8883890162002651565b945060408701359150808211156200272457600080fd5b50620027338782880162002651565b92505060608501356200274681620026ad565b939692955090935050565b60005b838110156200276e57818101518382015260200162002754565b50506000910152565b600081518084526200279181602086016020860162002751565b601f01601f19169290920160200192915050565b60208152600062000a5b602083018462002777565b600060208284031215620027cd57600080fd5b5035919050565b600080600060608486031215620027ea57600080fd5b833592506020840135620027fe81620025a6565b915060408401356200281081620025a6565b809150509250925092565b600080600080600060a086880312156200283457600080fd5b8535945060208601356200284881620025a6565b935060408601356200285a81620025a6565b925060608601356200286c81620025a6565b949793965091946080013592915050565b6000806000606084860312156200289357600080fd5b8335620028a081620025a6565b92506020840135620028b281620025a6565b929592945050506040919091013590565b60008060008060008060c08789031215620028dd57600080fd5b863595506020870135620028f181620025a6565b945060408701356200290381620025a6565b935060608701356200291581620025a6565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a0312156200294b57600080fd5b8735965060208801356200295f81620025a6565b955060408801356200297181620025a6565b945060608801356200298381620025a6565b9699959850939660808101359560a0820135955060c0909101359350915050565b60008060008060608587031215620029bb57600080fd5b843593506020850135620029cf81620025a6565b9250604085013567ffffffffffffffff80821115620029ed57600080fd5b818701915087601f83011262002a0257600080fd5b81358181111562002a1257600080fd5b88602082850101111562002a2557600080fd5b95989497505060200194505050565b6020808252602e908201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560408201526d706f72746572206164647265737360901b606082015260800190565b6001600160a01b038516815260806020820181905260009062002aa89083018662002777565b828103604084015262002abc818662002777565b91505060ff8316606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b60006003841062002b0857634e487b7160e01b600052602160045260246000fd5b838252604060208301526200058a604083018462002777565b6020808252602c908201527f45524332304272696467653a207a65726f2064657374696e6174696f6e20627260408201526b69646765206164647265737360a01b606082015260800190565b600062002b7e620026748462002626565b905082815283838301111562002b9357600080fd5b62000a5b83602083018462002751565b600082601f83011262002bb557600080fd5b62000a5b8383516020850162002b6d565b60006020828403121562002bd957600080fd5b815167ffffffffffffffff81111562002bf157600080fd5b6200058a8482850162002ba3565b60006020828403121562002c1257600080fd5b815162000a5b81620026ad565b600081518084526020808501945080840160005b8381101562002c5a5781516001600160a01b03168752958201959082019060010162002c33565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015262002cc861010084018262002c1f565b905060a0840151601f198483030160e08501526200145c828262002777565b60006020828403121562002cfa57600080fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526028908201527f45524332304272696467653a2063616e6e6f742062726964676520746f20736160408201526736b29031b430b4b760c11b606082015260800190565b60208082526023908201527f45524332304272696467653a207a65726f20726563697069656e74206164647260408201526265737360e81b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111562001461576200146162002db0565b60006020828403121562002def57600080fd5b815162000a5b81620025a6565b8181038181111562001461576200146162002db0565b6020808252602f908201527f45524332304272696467653a20696e76616c69642064657374696e6174696f6e60408201526e20627269646765206164647265737360881b606082015260800190565b6000806040838503121562002e7557600080fd5b82516003811062002e8557600080fd5b602084015190925067ffffffffffffffff81111562002ea357600080fd5b8301601f8101851362002eb557600080fd5b62002ec68582516020840162002b6d565b9150509250929050565b6000806000806080858703121562002ee757600080fd5b845162002ef481620025a6565b602086015190945067ffffffffffffffff8082111562002f1357600080fd5b62002f218883890162002ba3565b9450604087015191508082111562002f3857600080fd5b5062002f478782880162002ba3565b92505060608501516200274681620026ad565b60008060006060848603121562002f7057600080fd5b835162002f7d81620025a6565b602085015190935062002f9081620025a6565b80925050604084015190509250925092565b60008060008060008060c0878903121562002fbc57600080fd5b86519550602087015162002fd081620025a6565b604088015190955062002fe381620025a6565b606088015190945062002ff681620025a6565b809350506080870151915060a087015190509295509295509295565b6000602082840312156200302557600080fd5b8151801515811462000a5b57600080fd5b8681526001600160a01b0386811660208301528516604082015260c0606082018190526000906200306a9083018662002777565b82810360808401526200307e818662002777565b91505060ff831660a0830152979650505050505050565b60008251620030a981846020870162002751565b919091019291505056fe6101206040523480156200001257600080fd5b506040516200116838038062001168833981016040819052620000359162000292565b82826003620000458382620003d5565b506004620000548282620003d5565b50879150620000b690505760405162461bcd60e51b815260206004820152602160248201527f427269646765546f6b656e3a207a65726f20736f7572636520636861696e20696044820152601960fa1b60648201526084015b60405180910390fd5b6001600160a01b0385166200011e5760405162461bcd60e51b815260206004820152602760248201527f427269646765546f6b656e3a207a65726f20736f7572636520627269646765206044820152666164647265737360c81b6064820152608401620000ad565b6001600160a01b038416620001855760405162461bcd60e51b815260206004820152602660248201527f427269646765546f6b656e3a207a65726f20736f75726365206173736574206160448201526564647265737360d01b6064820152608401620000ad565b3360805260a09590955250506001600160a01b0391821660c0521660e05260ff1661010052620004a1565b80516001600160a01b0381168114620001c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f557600080fd5b81516001600160401b0380821115620002125762000212620001cd565b604051601f8301601f19908116603f011681019082821181831017156200023d576200023d620001cd565b816040528381526020925086838588010111156200025a57600080fd5b600091505b838210156200027e57858201830151818301840152908201906200025f565b600093810190920192909252949350505050565b60008060008060008060c08789031215620002ac57600080fd5b86519550620002be60208801620001b0565b9450620002ce60408801620001b0565b60608801519094506001600160401b0380821115620002ec57600080fd5b620002fa8a838b01620001e3565b945060808901519150808211156200031157600080fd5b506200032089828a01620001e3565b92505060a087015160ff811681146200033857600080fd5b809150509295509295509295565b600181811c908216806200035b57607f821691505b6020821081036200037c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d057600081815260208120601f850160051c81016020861015620003ab5750805b601f850160051c820191505b81811015620003cc57828155600101620003b7565b5050505b505050565b81516001600160401b03811115620003f157620003f1620001cd565b620004098162000402845462000346565b8462000382565b602080601f831160018114620004415760008415620004285750858301515b600019600386901b1c1916600185901b178555620003cc565b600085815260208120601f198616915b82811015620004725788860151825594840194600190910190840162000451565b5085821015620004915787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610c7b620004ed60003960006101c70152600061025a01526000610173015260006102fc0152600081816102c2015261041b0152610c7b6000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d714610297578063a9059cbb146102aa578063cd596583146102bd578063dd62ed3e146102e4578063f7253968146102f757600080fd5b806370a082311461022c57806374d32ad41461025557806379cc67901461027c57806395d89b411461028f57600080fd5b806323b872dd116100e957806323b872dd146101ad578063313ce567146101c057806339509351146101f157806340c10f191461020457806342966c681461021957600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c5780631a0b79bf1461016e575b600080fd5b61012361031e565b6040516101309190610aac565b60405180910390f35b61014c610147366004610b16565b6103b0565b6040519015158152602001610130565b6002545b604051908152602001610130565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610130565b61014c6101bb366004610b40565b6103ca565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610130565b61014c6101ff366004610b16565b6103ee565b610217610212366004610b16565b610410565b005b610217610227366004610b7c565b61049b565b61016061023a366004610b95565b6001600160a01b031660009081526020819052604090205490565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b61021761028a366004610b16565b6104a8565b6101236104bd565b61014c6102a5366004610b16565b6104cc565b61014c6102b8366004610b16565b610547565b6101957f000000000000000000000000000000000000000000000000000000000000000081565b6101606102f2366004610bb7565b610555565b6101607f000000000000000000000000000000000000000000000000000000000000000081565b60606003805461032d90610bea565b80601f016020809104026020016040519081016040528092919081815260200182805461035990610bea565b80156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b6000336103be818585610580565b60019150505b92915050565b6000336103d88582856106a5565b6103e385858561071f565b506001949350505050565b6000336103be8185856104018383610555565b61040b9190610c24565b610580565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461048d5760405162461bcd60e51b815260206004820152601960248201527f427269646765546f6b656e3a20756e617574686f72697a65640000000000000060448201526064015b60405180910390fd5b61049782826108c3565b5050565b6104a53382610982565b50565b6104b38233836106a5565b6104978282610982565b60606004805461032d90610bea565b600033816104da8286610555565b90508381101561053a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610484565b6103e38286868403610580565b6000336103be81858561071f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166105e25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610484565b6001600160a01b0382166106435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610484565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006106b18484610555565b90506000198114610719578181101561070c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610484565b6107198484848403610580565b50505050565b6001600160a01b0383166107835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610484565b6001600160a01b0382166107e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610484565b6001600160a01b0383166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610484565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610719565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610484565b806002600082825461092b9190610c24565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166109e25760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610484565b6001600160a01b03821660009081526020819052604090205481811015610a565760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610484565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610698565b600060208083528351808285015260005b81811015610ad957858101830151858201604001528201610abd565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b1157600080fd5b919050565b60008060408385031215610b2957600080fd5b610b3283610afa565b946020939093013593505050565b600080600060608486031215610b5557600080fd5b610b5e84610afa565b9250610b6c60208501610afa565b9150604084013590509250925092565b600060208284031215610b8e57600080fd5b5035919050565b600060208284031215610ba757600080fd5b610bb082610afa565b9392505050565b60008060408385031215610bca57600080fd5b610bd383610afa565b9150610be160208401610afa565b90509250929050565b600181811c90821680610bfe57607f821691505b602082108103610c1e57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156103c457634e487b7160e01b600052601160045260246000fdfea2646970667358221220ff15d87d9e06053eea65bea2fb7624abc50212a4686d7d62b9d7a5a0ec3d931364736f6c63430008120033a2646970667358221220a34db2904319553ab2729ffad73eab0cddd3e9279131a37da1acdfb654c22ffe64736f6c63430008120033", } // ERC20BridgeABI is the input ABI used to generate the binding from. @@ -824,6 +824,27 @@ func (_ERC20Bridge *ERC20BridgeTransactorSession) TransferOwnership(newOwner com return _ERC20Bridge.Contract.TransferOwnership(&_ERC20Bridge.TransactOpts, newOwner) } +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) UnpauseTeleporterAddress(opts *bind.TransactOpts, teleporterAddress common.Address) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "unpauseTeleporterAddress", teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ERC20Bridge *ERC20BridgeSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _ERC20Bridge.Contract.UnpauseTeleporterAddress(&_ERC20Bridge.TransactOpts, teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _ERC20Bridge.Contract.UnpauseTeleporterAddress(&_ERC20Bridge.TransactOpts, teleporterAddress) +} + // UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0x5eb99514. // // Solidity: function updateMinTeleporterVersion(uint256 version) returns() @@ -1931,3 +1952,147 @@ func (_ERC20Bridge *ERC20BridgeFilterer) ParseTeleporterAddressPaused(log types. event.Raw = log return event, nil } + +// ERC20BridgeTeleporterAddressUnpausedIterator is returned from FilterTeleporterAddressUnpaused and is used to iterate over the raw logs and unpacked data for TeleporterAddressUnpaused events raised by the ERC20Bridge contract. +type ERC20BridgeTeleporterAddressUnpausedIterator struct { + Event *ERC20BridgeTeleporterAddressUnpaused // 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 interfaces.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 *ERC20BridgeTeleporterAddressUnpausedIterator) 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(ERC20BridgeTeleporterAddressUnpaused) + 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(ERC20BridgeTeleporterAddressUnpaused) + 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 *ERC20BridgeTeleporterAddressUnpausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeTeleporterAddressUnpausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeTeleporterAddressUnpaused represents a TeleporterAddressUnpaused event raised by the ERC20Bridge contract. +type ERC20BridgeTeleporterAddressUnpaused struct { + TeleporterAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTeleporterAddressUnpaused is a free log retrieval operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterTeleporterAddressUnpaused(opts *bind.FilterOpts, teleporterAddress []common.Address) (*ERC20BridgeTeleporterAddressUnpausedIterator, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + if err != nil { + return nil, err + } + return &ERC20BridgeTeleporterAddressUnpausedIterator{contract: _ERC20Bridge.contract, event: "TeleporterAddressUnpaused", logs: logs, sub: sub}, nil +} + +// WatchTeleporterAddressUnpaused is a free log subscription operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchTeleporterAddressUnpaused(opts *bind.WatchOpts, sink chan<- *ERC20BridgeTeleporterAddressUnpaused, teleporterAddress []common.Address) (event.Subscription, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + 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(ERC20BridgeTeleporterAddressUnpaused) + if err := _ERC20Bridge.contract.UnpackLog(event, "TeleporterAddressUnpaused", 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 +} + +// ParseTeleporterAddressUnpaused is a log parse operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseTeleporterAddressUnpaused(log types.Log) (*ERC20BridgeTeleporterAddressUnpaused, error) { + event := new(ERC20BridgeTeleporterAddressUnpaused) + if err := _ERC20Bridge.contract.UnpackLog(event, "TeleporterAddressUnpaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index 9539e5ba7..c77939f4b 100644 --- a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -31,8 +31,8 @@ var ( // ExampleCrossChainMessengerMetaData contains all meta data concerning the ExampleCrossChainMessenger contract. var ExampleCrossChainMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"ReceiveMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"SendMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60a06040523480156200001157600080fd5b506040516200199138038062001991833981016040819052620000349162000196565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d9190620001c8565b600255506200013c3362000144565b5050620001e2565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001a957600080fd5b81516001600160a01b0381168114620001c157600080fd5b9392505050565b600060208284031215620001db57600080fd5b5051919050565b60805161177f620002126000396000818160b30152818161043b0152818161081d0152610b7b015261177f6000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806397314297116100715780639731429714610133578063b33fead41461016f578063c868efaa14610190578063d2cc7a70146101a3578063f2fde38b146101b5578063f63d09d7146101c857600080fd5b80631a7f5bec146100ae5780632b0d8f18146100f25780635eb9951414610107578063715018a61461011a5780638da5cb5b14610122575b600080fd5b6100d57f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61010561010036600461117d565b6101db565b005b6101056101153660046111a1565b610323565b610105610337565b6003546001600160a01b03166100d5565b61015f61014136600461117d565b6001600160a01b031660009081526001602052604090205460ff1690565b60405190151581526020016100e9565b61018261017d3660046111a1565b61034b565b6040516100e992919061120a565b61010561019e366004611277565b610423565b6002545b6040519081526020016100e9565b6101056101c336600461117d565b6105d5565b6101a76101d63660046112d3565b61064b565b6101e3610811565b6001600160a01b0381166102555760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560448201526d706f72746572206164647265737360901b60648201526084015b60405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff16156102d45760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b606482015260840161024c565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b61032b610811565b61033481610819565b50565b61033f6109b9565b6103496000610a13565b565b6000818152600460209081526040808320815180830190925280546001600160a01b03168252600181018054606094869493929084019161038b90611359565b80601f01602080910402602001604051908101604052809291908181526020018280546103b790611359565b80156104045780601f106103d957610100808354040283529160200191610404565b820191906000526020600020905b8154815290600101906020018083116103e757829003601f168201915b5050505050815250509050806000015181602001519250925050915091565b60025460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae9190611393565b10156105155760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b606482015260840161024c565b3360009081526001602052604090205460ff161561058e5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b606482015260840161024c565b6105cf848484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610a6592505050565b50505050565b6105dd6109b9565b6001600160a01b0381166106425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161024c565b61033481610a13565b6000610655610b1d565b600061065f610b76565b905060008615610689576106738888610c8a565b90506106896001600160a01b0389168383610df4565b886001600160a01b03168a7fa06eff1edd0c66b8dc96d086dda7ba263edf88d7417e6cb15073b5e7bff8a8ca8a848a8a8a6040516106cb9594939291906113d5565b60405180910390a3816001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b03168152602001868152508152602001898152602001600067ffffffffffffffff81111561074557610745611403565b60405190808252806020026020018201604052801561076e578160200160208202803683370190505b5081526020018888604051602001610787929190611419565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016107b59190611471565b6020604051808303816000875af11580156107d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f89190611393565b925050506108066001600055565b979650505050505050565b6103496109b9565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089d9190611393565b6002549091508183111561090d5760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b606482015260840161024c565b8083116109825760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e00606482015260840161024c565b6002839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b6003546001600160a01b031633146103495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161024c565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081806020019051810190610a7b91906114ef565b6040805180820182526001600160a01b038681168252602080830185815260008a81526004909252939020825181546001600160a01b03191692169190911781559151929350916001820190610ad190826115df565b50905050826001600160a01b0316847f1f5c800b5f2b573929a7948f82a199c2a212851b53a6c5bd703ece23999d24aa83604051610b0f919061169f565b60405180910390a350505050565b600260005403610b6f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161024c565b6002600055565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfb91906116b2565b9050610c1f816001600160a01b031660009081526001602052604090205460ff1690565b15610c855760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881cd95b991a5b99c81c185d5cd95960821b606482015260840161024c565b919050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610cd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf79190611393565b9050610d0e6001600160a01b038516333086610ed9565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d799190611393565b9050818111610ddf5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161024c565b610de982826116e5565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190611393565b610e7391906116f8565b6040516001600160a01b0385166024820152604481018290529091506105cf90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610f11565b6040516001600160a01b03808516602483015283166044820152606481018290526105cf9085906323b872dd60e01b90608401610ea2565b6000610f66826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610fe89092919063ffffffff16565b805190915015610fe35780806020019051810190610f84919061170b565b610fe35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161024c565b505050565b6060610ff78484600085610fff565b949350505050565b6060824710156110605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161024c565b600080866001600160a01b0316858760405161107c919061172d565b60006040518083038185875af1925050503d80600081146110b9576040519150601f19603f3d011682016040523d82523d6000602084013e6110be565b606091505b50915091506108068783838760608315611139578251600003611132576001600160a01b0385163b6111325760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161024c565b5081610ff7565b610ff7838381511561114e5781518083602001fd5b8060405162461bcd60e51b815260040161024c919061169f565b6001600160a01b038116811461033457600080fd5b60006020828403121561118f57600080fd5b813561119a81611168565b9392505050565b6000602082840312156111b357600080fd5b5035919050565b60005b838110156111d55781810151838201526020016111bd565b50506000910152565b600081518084526111f68160208601602086016111ba565b601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090610ff7908301846111de565b60008083601f84011261124057600080fd5b50813567ffffffffffffffff81111561125857600080fd5b60208301915083602082850101111561127057600080fd5b9250929050565b6000806000806060858703121561128d57600080fd5b84359350602085013561129f81611168565b9250604085013567ffffffffffffffff8111156112bb57600080fd5b6112c78782880161122e565b95989497509550505050565b600080600080600080600060c0888a0312156112ee57600080fd5b87359650602088013561130081611168565b9550604088013561131081611168565b9450606088013593506080880135925060a088013567ffffffffffffffff81111561133a57600080fd5b6113468a828b0161122e565b989b979a50959850939692959293505050565b600181811c9082168061136d57607f821691505b60208210810361138d57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156113a557600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b03861681528460208201528360408201526080606082015260006108066080830184866113ac565b634e487b7160e01b600052604160045260246000fd5b602081526000610ff76020830184866113ac565b600081518084526020808501945080840160005b838110156114665781516001600160a01b031687529582019590820190600101611441565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526114d261010084018261142d565b905060a0840151601f198483030160e0850152610de982826111de565b60006020828403121561150157600080fd5b815167ffffffffffffffff8082111561151957600080fd5b818401915084601f83011261152d57600080fd5b81518181111561153f5761153f611403565b604051601f8201601f19908116603f0116810190838211818310171561156757611567611403565b8160405282815287602084870101111561158057600080fd5b6108068360208301602088016111ba565b601f821115610fe357600081815260208120601f850160051c810160208610156115b85750805b601f850160051c820191505b818110156115d7578281556001016115c4565b505050505050565b815167ffffffffffffffff8111156115f9576115f9611403565b61160d816116078454611359565b84611591565b602080601f831160018114611642576000841561162a5750858301515b600019600386901b1c1916600185901b1785556115d7565b600085815260208120601f198616915b8281101561167157888601518255948401946001909101908401611652565b508582101561168f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208152600061119a60208301846111de565b6000602082840312156116c457600080fd5b815161119a81611168565b634e487b7160e01b600052601160045260246000fd5b81810381811115610dee57610dee6116cf565b80820180821115610dee57610dee6116cf565b60006020828403121561171d57600080fd5b8151801515811461119a57600080fd5b6000825161173f8184602087016111ba565b919091019291505056fea2646970667358221220a651942342b498ac562cd9582ae4b6fabcf63abeee7de51030619739298cf7c364736f6c63430008120033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"ReceiveMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"SendMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressUnpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"unpauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60a06040523480156200001157600080fd5b5060405162001a7338038062001a73833981016040819052620000349162000196565b600160005580806001600160a01b038116620000bc5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa15801562000107573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012d9190620001c8565b600255506200013c3362000144565b5050620001e2565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001a957600080fd5b81516001600160a01b0381168114620001c157600080fd5b9392505050565b600060208284031215620001db57600080fd5b5051919050565b608051611861620002126000396000818160be015281816104f2015281816108ca0152610c2801526118616000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806397314297116100715780639731429714610151578063b33fead414610174578063c868efaa14610195578063d2cc7a70146101a8578063f2fde38b146101ba578063f63d09d7146101cd57600080fd5b80631a7f5bec146100b95780632b0d8f18146100fd5780634511243e146101125780635eb9951414610125578063715018a6146101385780638da5cb5b14610140575b600080fd5b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61011061010b366004611211565b6101e0565b005b610110610120366004611211565b6102d2565b610110610133366004611235565b6103bc565b6101106103d0565b6003546001600160a01b03166100e0565b61016461015f366004611211565b6103e4565b60405190151581526020016100f4565b610187610182366004611235565b610402565b6040516100f492919061129e565b6101106101a336600461130b565b6104da565b6002545b6040519081526020016100f4565b6101106101c8366004611211565b610682565b6101ac6101db366004611367565b6106f8565b6101e86108be565b6001600160a01b0381166102175760405162461bcd60e51b815260040161020e906113ed565b60405180910390fd5b610220816103e4565b156102835760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b606482015260840161020e565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b6102da6108be565b6001600160a01b0381166103005760405162461bcd60e51b815260040161020e906113ed565b610309816103e4565b6103675760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465725570677261646561626c653a2061646472657373206e6044820152681bdd081c185d5cd95960ba1b606482015260840161020e565b6040516001600160a01b038216907f844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c390600090a26001600160a01b03166000908152600160205260409020805460ff19169055565b6103c46108be565b6103cd816108c6565b50565b6103d8610a66565b6103e26000610ac0565b565b6001600160a01b031660009081526001602052604090205460ff1690565b6000818152600460209081526040808320815180830190925280546001600160a01b0316825260018101805460609486949392908401916104429061143b565b80601f016020809104026020016040519081016040528092919081815260200182805461046e9061143b565b80156104bb5780601f10610490576101008083540402835291602001916104bb565b820191906000526020600020905b81548152906001019060200180831161049e57829003601f168201915b5050505050815250509050806000015181602001519250925050915091565b60025460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa158015610541573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105659190611475565b10156105cc5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b606482015260840161020e565b6105d5336103e4565b1561063b5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b606482015260840161020e565b61067c848484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b1292505050565b50505050565b61068a610a66565b6001600160a01b0381166106ef5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161020e565b6103cd81610ac0565b6000610702610bca565b600061070c610c23565b905060008615610736576107208888610d1e565b90506107366001600160a01b0389168383610e88565b886001600160a01b03168a7fa06eff1edd0c66b8dc96d086dda7ba263edf88d7417e6cb15073b5e7bff8a8ca8a848a8a8a6040516107789594939291906114b7565b60405180910390a3816001600160a01b031663624488506040518060c001604052808d81526020018c6001600160a01b0316815260200160405180604001604052808d6001600160a01b03168152602001868152508152602001898152602001600067ffffffffffffffff8111156107f2576107f26114e5565b60405190808252806020026020018201604052801561081b578160200160208202803683370190505b50815260200188886040516020016108349291906114fb565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016108629190611553565b6020604051808303816000875af1158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190611475565b925050506108b36001600055565b979650505050505050565b6103e2610a66565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094a9190611475565b600254909150818311156109ba5760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b606482015260840161020e565b808311610a2f5760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e00606482015260840161020e565b6002839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b6003546001600160a01b031633146103e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161020e565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081806020019051810190610b2891906115d1565b6040805180820182526001600160a01b038681168252602080830185815260008a81526004909252939020825181546001600160a01b03191692169190911781559151929350916001820190610b7e90826116c1565b50905050826001600160a01b0316847f1f5c800b5f2b573929a7948f82a199c2a212851b53a6c5bd703ece23999d24aa83604051610bbc9190611781565b60405180910390a350505050565b600260005403610c1c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161020e565b6002600055565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca89190611794565b9050610cb3816103e4565b15610d195760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881cd95b991a5b99c81c185d5cd95960821b606482015260840161020e565b919050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8b9190611475565b9050610da26001600160a01b038516333086610f6d565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610de9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0d9190611475565b9050818111610e735760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161020e565b610e7d82826117c7565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd9190611475565b610f0791906117da565b6040516001600160a01b03851660248201526044810182905290915061067c90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610fa5565b6040516001600160a01b038085166024830152831660448201526064810182905261067c9085906323b872dd60e01b90608401610f36565b6000610ffa826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661107c9092919063ffffffff16565b805190915015611077578080602001905181019061101891906117ed565b6110775760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161020e565b505050565b606061108b8484600085611093565b949350505050565b6060824710156110f45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161020e565b600080866001600160a01b03168587604051611110919061180f565b60006040518083038185875af1925050503d806000811461114d576040519150601f19603f3d011682016040523d82523d6000602084013e611152565b606091505b50915091506108b387838387606083156111cd5782516000036111c6576001600160a01b0385163b6111c65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161020e565b508161108b565b61108b83838151156111e25781518083602001fd5b8060405162461bcd60e51b815260040161020e9190611781565b6001600160a01b03811681146103cd57600080fd5b60006020828403121561122357600080fd5b813561122e816111fc565b9392505050565b60006020828403121561124757600080fd5b5035919050565b60005b83811015611269578181015183820152602001611251565b50506000910152565b6000815180845261128a81602086016020860161124e565b601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061108b90830184611272565b60008083601f8401126112d457600080fd5b50813567ffffffffffffffff8111156112ec57600080fd5b60208301915083602082850101111561130457600080fd5b9250929050565b6000806000806060858703121561132157600080fd5b843593506020850135611333816111fc565b9250604085013567ffffffffffffffff81111561134f57600080fd5b61135b878288016112c2565b95989497509550505050565b600080600080600080600060c0888a03121561138257600080fd5b873596506020880135611394816111fc565b955060408801356113a4816111fc565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156113ce57600080fd5b6113da8a828b016112c2565b989b979a50959850939692959293505050565b6020808252602e908201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560408201526d706f72746572206164647265737360901b606082015260800190565b600181811c9082168061144f57607f821691505b60208210810361146f57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561148757600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b03861681528460208201528360408201526080606082015260006108b360808301848661148e565b634e487b7160e01b600052604160045260246000fd5b60208152600061108b60208301848661148e565b600081518084526020808501945080840160005b838110156115485781516001600160a01b031687529582019590820190600101611523565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526115b461010084018261150f565b905060a0840151601f198483030160e0850152610e7d8282611272565b6000602082840312156115e357600080fd5b815167ffffffffffffffff808211156115fb57600080fd5b818401915084601f83011261160f57600080fd5b815181811115611621576116216114e5565b604051601f8201601f19908116603f01168101908382118183101715611649576116496114e5565b8160405282815287602084870101111561166257600080fd5b6108b383602083016020880161124e565b601f82111561107757600081815260208120601f850160051c8101602086101561169a5750805b601f850160051c820191505b818110156116b9578281556001016116a6565b505050505050565b815167ffffffffffffffff8111156116db576116db6114e5565b6116ef816116e9845461143b565b84611673565b602080601f831160018114611724576000841561170c5750858301515b600019600386901b1c1916600185901b1785556116b9565b600085815260208120601f198616915b8281101561175357888601518255948401946001909101908401611734565b50858210156117715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208152600061122e6020830184611272565b6000602082840312156117a657600080fd5b815161122e816111fc565b634e487b7160e01b600052601160045260246000fd5b81810381811115610e8257610e826117b1565b80820180821115610e8257610e826117b1565b6000602082840312156117ff57600080fd5b8151801515811461122e57600080fd5b6000825161182181846020870161124e565b919091019291505056fea26469706673582212206556f2e9799d302a47c7c6448287c25ac918783fc26a424aad369e0f24fb964264736f6c63430008120033", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. @@ -463,6 +463,27 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) return _ExampleCrossChainMessenger.Contract.TransferOwnership(&_ExampleCrossChainMessenger.TransactOpts, newOwner) } +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) UnpauseTeleporterAddress(opts *bind.TransactOpts, teleporterAddress common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.contract.Transact(opts, "unpauseTeleporterAddress", teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UnpauseTeleporterAddress(&_ExampleCrossChainMessenger.TransactOpts, teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UnpauseTeleporterAddress(&_ExampleCrossChainMessenger.TransactOpts, teleporterAddress) +} + // UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0x5eb99514. // // Solidity: function updateMinTeleporterVersion(uint256 version) returns() @@ -1244,3 +1265,147 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) ParseTele event.Raw = log return event, nil } + +// ExampleCrossChainMessengerTeleporterAddressUnpausedIterator is returned from FilterTeleporterAddressUnpaused and is used to iterate over the raw logs and unpacked data for TeleporterAddressUnpaused events raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerTeleporterAddressUnpausedIterator struct { + Event *ExampleCrossChainMessengerTeleporterAddressUnpaused // 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 interfaces.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 *ExampleCrossChainMessengerTeleporterAddressUnpausedIterator) 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(ExampleCrossChainMessengerTeleporterAddressUnpaused) + 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(ExampleCrossChainMessengerTeleporterAddressUnpaused) + 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 *ExampleCrossChainMessengerTeleporterAddressUnpausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ExampleCrossChainMessengerTeleporterAddressUnpausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ExampleCrossChainMessengerTeleporterAddressUnpaused represents a TeleporterAddressUnpaused event raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerTeleporterAddressUnpaused struct { + TeleporterAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTeleporterAddressUnpaused is a free log retrieval operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) FilterTeleporterAddressUnpaused(opts *bind.FilterOpts, teleporterAddress []common.Address) (*ExampleCrossChainMessengerTeleporterAddressUnpausedIterator, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.FilterLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + if err != nil { + return nil, err + } + return &ExampleCrossChainMessengerTeleporterAddressUnpausedIterator{contract: _ExampleCrossChainMessenger.contract, event: "TeleporterAddressUnpaused", logs: logs, sub: sub}, nil +} + +// WatchTeleporterAddressUnpaused is a free log subscription operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) WatchTeleporterAddressUnpaused(opts *bind.WatchOpts, sink chan<- *ExampleCrossChainMessengerTeleporterAddressUnpaused, teleporterAddress []common.Address) (event.Subscription, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.WatchLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + 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(ExampleCrossChainMessengerTeleporterAddressUnpaused) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "TeleporterAddressUnpaused", 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 +} + +// ParseTeleporterAddressUnpaused is a log parse operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) ParseTeleporterAddressUnpaused(log types.Log) (*ExampleCrossChainMessengerTeleporterAddressUnpaused, error) { + event := new(ExampleCrossChainMessengerTeleporterAddressUnpaused) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "TeleporterAddressUnpaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go index bc06d7c95..261277048 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/ERC20TokenSource/ERC20TokenSource.go @@ -32,7 +32,7 @@ var ( // ERC20TokenSourceMetaData contains all meta data concerning the ERC20TokenSource contract. var ERC20TokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20ContractAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20ContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6101006040523480156200001257600080fd5b50604051620016f1380380620016f183398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d183398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d183398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112ba620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a9a0152610c6a01526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112ba6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e39565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed2565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5b565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fb9565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611060565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110de565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a18385018561110d565b909250905060008260018111156106ba576106ba6111d5565b036106eb57600080828060200190518101906106d691906111eb565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d5565b0361072b5760008180602001905181019061071a91906110de565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110de565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110de565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fb9565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110de565b6109c79190611219565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5b565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610ac07f00000000000000000000000000000000000000000000000000000000000000008383610c02565b5050565b600154811115610af057600060015482610ade9190610fb9565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c949092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122c565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610af07f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6060610ca38484600085610cab565b949350505050565b606082471015610d0c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d289190611255565b60006040518083038185875af1925050503d8060008114610d65576040519150601f19603f3d011682016040523d82523d6000602084013e610d6a565b606091505b5091509150610d7b87838387610d86565b979650505050505050565b60608315610df5578251600003610dee576001600160a01b0385163b610dee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca3565b610ca38383815115610e0a5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611271565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5157600080fd5b8535610e5c81610e24565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8757600080fd5b818801915088601f830112610e9b57600080fd5b813581811115610eaa57600080fd5b8960208260051b8501011115610ebf57600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610ee857600080fd5b843593506020850135610efa81610e24565b9250604085013567ffffffffffffffff80821115610f1757600080fd5b818701915087601f830112610f2b57600080fd5b813581811115610f3a57600080fd5b886020828501011115610f4c57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa3565b600081518084526020808501945080840160005b838110156110055781516001600160a01b031687529582019590820190600101610fe0565b509495945050505050565b60005b8381101561102b578181015183820152602001611013565b50506000910152565b6000815180845261104c816020860160208601611010565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c1610100840182610fcc565b905060a0840151601f198483030160e085015261093d8282611034565b6000602082840312156110f057600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112057600080fd5b82356002811061112f57600080fd5b9150602083013567ffffffffffffffff8082111561114c57600080fd5b818501915085601f83011261116057600080fd5b813581811115611172576111726110f7565b604051601f8201601f19908116603f0116810190838211818310171561119a5761119a6110f7565b816040528281528860208487010111156111b357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111fe57600080fd5b825161120981610e24565b6020939093015192949293505050565b8082018082111561094257610942610fa3565b60006020828403121561123e57600080fd5b8151801515811461124e57600080fd5b9392505050565b60008251611267818460208701611010565b9190910192915050565b60208152600061124e602083018461103456fea2646970667358221220ea4f7fe2fb79a487153a86e34946c46d0dc03e1eb717523b03577a4cf4212c9a64736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", + Bin: "0x6101006040523480156200001257600080fd5b50604051620016f1380380620016f183398101604081905262000035916200031d565b60016000556001600160a01b038416620000b15760405162461bcd60e51b815260206004820152603260248201527f4552433230546f6b656e536f757263653a207a65726f2054656c65706f727465604482015271724d657373656e676572206164647265737360701b60648201526084015b60405180910390fd5b6001600160a01b03841660e05282620001155760405162461bcd60e51b81526020600482015260306024820152600080516020620016d183398151915260448201526f1bdb88189b1bd8dad8da185a5b88125160821b6064820152608401620000a8565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018e919062000371565b8303620002045760405162461bcd60e51b815260206004820152603460248201527f4552433230546f6b656e536f757263653a2063616e6e6f74206272696467652060448201527f776974682073616d6520626c6f636b636861696e0000000000000000000000006064820152608401620000a8565b60808390526001600160a01b038216620002765760405162461bcd60e51b81526020600482015260336024820152600080516020620016d183398151915260448201527f6f6e20636f6e74726163742061646472657373000000000000000000000000006064820152608401620000a8565b6001600160a01b0380831660a0528116620002ea5760405162461bcd60e51b815260206004820152602d60248201527f4552433230546f6b656e536f757263653a207a65726f20455243323020636f6e60448201526c7472616374206164647265737360981b6064820152608401620000a8565b6001600160a01b031660c052506200038b915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080600080608085870312156200033457600080fd5b6200033f8562000300565b935060208501519250620003566040860162000300565b9150620003666060860162000300565b905092959194509250565b6000602082840312156200038457600080fd5b5051919050565b60805160a05160c05160e0516112ba620004176000396000818160f50152818161029c015281816102d301526104ed015260008181610183015281816101e30152818161027b0152818161036d01528181610a9a0152610c6a01526000818161013e015281816103330152610605015260008181609d0152818161030d015261058201526112ba6000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063b6171f7311610066578063b6171f731461012f578063b8c9091a14610139578063c452165e14610160578063c868efaa1461016b578063e486df151461017e57600080fd5b806341d3014d1461009857806355db3e9e146100d257806387a2edba146100db5780639b3e5803146100f0575b600080fd5b6100bf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100bf60015481565b6100ee6100e9366004610e39565b6101a5565b005b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c9565b6100bf620186a081565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b610117600160981b81565b6100ee610179366004610ed2565b6104da565b6101177f000000000000000000000000000000000000000000000000000000000000000081565b6101ad610785565b6001600160a01b0385166101dc5760405162461bcd60e51b81526004016101d390610f5b565b60405180910390fd5b60006102087f0000000000000000000000000000000000000000000000000000000000000000866107de565b90508381116102705760405162461bcd60e51b815260206004820152602e60248201527f4552433230546f6b656e536f757263653a20696e73756666696369656e74206160448201526d191a9d5cdd195908185b5bdd5b9d60921b60648201526084016101d3565b83156102c1576102c17f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000086610948565b60006102cd8583610fb9565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316815260200160405180604001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031681526020018b8152508152602001620186a08152602001888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604080516001600160a01b038e166020808301919091529181018890529101906060016040516020818303038152906040528152506040518263ffffffff1660e01b81526004016104339190611060565b6020604051808303816000875af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906110de565b905080886001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a856040516104be91815260200190565b60405180910390a45050506104d36001600055565b5050505050565b6104e2610785565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105805760405162461bcd60e51b815260206004820152603b60248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564205460448201527f656c65706f727465724d657373656e67657220636f6e7472616374000000000060648201526084016101d3565b7f000000000000000000000000000000000000000000000000000000000000000084146106035760405162461bcd60e51b815260206004820152602b60248201527f4552433230546f6b656e536f757263653a20696e76616c69642064657374696e60448201526a30ba34b7b71031b430b4b760a91b60648201526084016101d3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146106925760405162461bcd60e51b815260206004820152602560248201527f4552433230546f6b656e536f757263653a20756e617574686f72697a6564207360448201526432b73232b960d91b60648201526084016101d3565b6000806106a18385018561110d565b909250905060008260018111156106ba576106ba6111d5565b036106eb57600080828060200190518101906106d691906111eb565b915091506106e48282610a2d565b5050610773565b60018260018111156106ff576106ff6111d5565b0361072b5760008180602001905181019061071a91906110de565b905061072581610ac4565b50610773565b60405162461bcd60e51b815260206004820181905260248201527f4552433230546f6b656e536f757263653a20696e76616c696420616374696f6e60448201526064016101d3565b505061077f6001600055565b50505050565b6002600054036107d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101d3565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b91906110de565b90506108626001600160a01b038516333086610af3565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa1580156108a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cd91906110de565b90508181116109335760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101d3565b61093d8282610fb9565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110de565b6109c79190611219565b6040516001600160a01b03851660248201526044810182905290915061077f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b2b565b6001600160a01b038216610a535760405162461bcd60e51b81526004016101d390610f5b565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610ac07f00000000000000000000000000000000000000000000000000000000000000008383610c02565b5050565b600154811115610af057600060015482610ade9190610fb9565b9050610ae981610c32565b5060018190555b50565b6040516001600160a01b038085166024830152831660448201526064810182905261077f9085906323b872dd60e01b906084016109f6565b6000610b80826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c949092919063ffffffff16565b805190915015610bfd5780806020019051810190610b9e919061122c565b610bfd5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101d3565b505050565b6040516001600160a01b038316602482015260448101829052610bfd90849063a9059cbb60e01b906064016109f6565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610af07f0000000000000000000000000000000000000000000000000000000000000000600160981b83610c02565b6060610ca38484600085610cab565b949350505050565b606082471015610d0c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101d3565b600080866001600160a01b03168587604051610d289190611255565b60006040518083038185875af1925050503d8060008114610d65576040519150601f19603f3d011682016040523d82523d6000602084013e610d6a565b606091505b5091509150610d7b87838387610d86565b979650505050505050565b60608315610df5578251600003610dee576001600160a01b0385163b610dee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101d3565b5081610ca3565b610ca38383815115610e0a5781518083602001fd5b8060405162461bcd60e51b81526004016101d39190611271565b6001600160a01b0381168114610af057600080fd5b600080600080600060808688031215610e5157600080fd5b8535610e5c81610e24565b94506020860135935060408601359250606086013567ffffffffffffffff80821115610e8757600080fd5b818801915088601f830112610e9b57600080fd5b813581811115610eaa57600080fd5b8960208260051b8501011115610ebf57600080fd5b9699959850939650602001949392505050565b60008060008060608587031215610ee857600080fd5b843593506020850135610efa81610e24565b9250604085013567ffffffffffffffff80821115610f1757600080fd5b818701915087601f830112610f2b57600080fd5b813581811115610f3a57600080fd5b886020828501011115610f4c57600080fd5b95989497505060200194505050565b60208082526028908201527f4552433230546f6b656e536f757263653a207a65726f20726563697069656e74604082015267206164647265737360c01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8181038181111561094257610942610fa3565b600081518084526020808501945080840160005b838110156110055781516001600160a01b031687529582019590820190600101610fe0565b509495945050505050565b60005b8381101561102b578181015183820152602001611013565b50506000910152565b6000815180845261104c816020860160208601611010565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526110c1610100840182610fcc565b905060a0840151601f198483030160e085015261093d8282611034565b6000602082840312156110f057600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561112057600080fd5b82356002811061112f57600080fd5b9150602083013567ffffffffffffffff8082111561114c57600080fd5b818501915085601f83011261116057600080fd5b813581811115611172576111726110f7565b604051601f8201601f19908116603f0116810190838211818310171561119a5761119a6110f7565b816040528281528860208487010111156111b357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156111fe57600080fd5b825161120981610e24565b6020939093015192949293505050565b8082018082111561094257610942610fa3565b60006020828403121561123e57600080fd5b8151801515811461124e57600080fd5b9392505050565b60008251611267818460208701611010565b9190910192915050565b60208152600061124e602083018461103456fea26469706673582212206db92aab8e09f9f85b4abd58bbc94a7f36273b9aa5f1dfff3f5f3f7a6060434a64736f6c634300081200334552433230546f6b656e536f757263653a207a65726f2064657374696e617469", } // ERC20TokenSourceABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go index 3ac3a2f87..4017e2666 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenDestination/NativeTokenDestination.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenDestinationMetaData contains all meta data concerning the NativeTokenDestination contract. var NativeTokenDestinationMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenSourceAddress_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"initialReserveImbalance_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"remaining\",\"type\":\"uint256\"}],\"name\":\"CollateralAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NativeTokensMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAddressBalance\",\"type\":\"uint256\"}],\"name\":\"ReportTotalBurnedTxFees\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToSource\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_FOR_TRANSFER_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REPORT_BURNED_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialReserveImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenSourceAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"reportTotalBurnedTxFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalMinted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToSource\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001bf138038062001bf18339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001bd18339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001bd183398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e0516101005161178c62000445600039600081816102440152818161035c015281816105fe01528181610638015261084801526000818161021001526103060152600081816101b1015281816103bc01528181610698015261096b01526000818161013c015281816103960152818161067201526108e701526000610bdc015261178c6000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e61017936600461130a565b610345565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611376565b610520565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113da565b610835565b6000806103006001600160981b0131600160981b31611479565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611479565b905061033e828261148c565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103fa919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161046c91600191606001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161049a91906115d0565b6020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd919061164e565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161051191815260200190565b60405180910390a25050505050565b610528610c46565b6001600160a01b0384166105575760405162461bcd60e51b815260040161054e90611667565b60405180910390fd5b600154156105c45760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b606482015260840161054e565b6000602084013515610623576105ea6105e060208601866116b5565b8560200135610c9f565b90506106236105fc60208601866116b5565b7f000000000000000000000000000000000000000000000000000000000000000083610e09565b6106346001600160981b0134610eee565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906106d6919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361074492508d913491016001600160a01b03929092168252602082015260400190565b60408051601f19818403018152908290526107629291602001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161079091906115d0565b6020604051808303816000875af11580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d3919061164e565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d143460405161081b91815260200190565b60405180910390a4505061082f6001600055565b50505050565b61083d610c46565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108e55760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a40161054e565b7f000000000000000000000000000000000000000000000000000000000000000084146109695760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b606482015260840161054e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146109fe5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b606482015260840161054e565b600080610a0d838501856116d9565b90925090506001600160a01b038216610a385760405162461bcd60e51b815260040161054e90611667565b80600003610a9c5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b606482015260840161054e565b600154819015610b6157600154821115610b055760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610af9908361148c565b60006001559050610b61565b8160016000828254610b17919061148c565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610c3c565b8060026000828254610b739190611479565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b505050505050505b61082f6001600055565b600260005403610c985760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161054e565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c919061164e565b9050610d236001600160a01b03851633308661100c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8e919061164e565b9050818111610df45760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161054e565b610dfe828261148c565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e919061164e565b610e889190611479565b6040516001600160a01b03851660248201526044810182905290915061082f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611044565b80471015610f3e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161054e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f8b576040519150601f19603f3d011682016040523d82523d6000602084013e610f90565b606091505b50509050806110075760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161054e565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261082f9085906323b872dd60e01b90608401610eb7565b6000611099826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111169092919063ffffffff16565b80519091501561100757808060200190518101906110b79190611705565b6110075760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161054e565b6060611125848460008561112d565b949350505050565b60608247101561118e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161054e565b600080866001600160a01b031685876040516111aa9190611727565b60006040518083038185875af1925050503d80600081146111e7576040519150601f19603f3d011682016040523d82523d6000602084013e6111ec565b606091505b50915091506111fd87838387611208565b979650505050505050565b60608315611277578251600003611270576001600160a01b0385163b6112705760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161054e565b5081611125565b611125838381511561128c5781518083602001fd5b8060405162461bcd60e51b815260040161054e9190611743565b6000604082840312156112b857600080fd5b50919050565b60008083601f8401126112d057600080fd5b50813567ffffffffffffffff8111156112e857600080fd5b6020830191508360208260051b850101111561130357600080fd5b9250929050565b60008060006060848603121561131f57600080fd5b61132985856112a6565b9250604084013567ffffffffffffffff81111561134557600080fd5b611351868287016112be565b9497909650939450505050565b6001600160a01b038116811461137357600080fd5b50565b6000806000806080858703121561138c57600080fd5b84356113978161135e565b93506113a686602087016112a6565b9250606085013567ffffffffffffffff8111156113c257600080fd5b6113ce878288016112be565b95989497509550505050565b600080600080606085870312156113f057600080fd5b8435935060208501356114028161135e565b9250604085013567ffffffffffffffff8082111561141f57600080fd5b818701915087601f83011261143357600080fd5b81358181111561144257600080fd5b88602082850101111561145457600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e0357610e03611463565b81810381811115610e0357610e03611463565b6000604082840312156114b157600080fd5b6040516040810181811067ffffffffffffffff821117156114e257634e487b7160e01b600052604160045260246000fd5b60405282356114f08161135e565b81526020928301359281019290925250919050565b60005b83811015611520578181015183820152602001611508565b50506000910152565b60008151808452611541816020860160208601611505565b601f01601f19169290920160200192915050565b60006002841061157557634e487b7160e01b600052602160045260246000fd5b838252604060208301526111256040830184611529565b600081518084526020808501945080840160005b838110156115c55781516001600160a01b0316875295820195908201906001016115a0565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261163161010084018261158c565b905060a0840151601f198483030160e0850152610dfe8282611529565b60006020828403121561166057600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b6000602082840312156116c757600080fd5b81356116d28161135e565b9392505050565b600080604083850312156116ec57600080fd5b82356116f78161135e565b946020939093013593505050565b60006020828403121561171757600080fd5b815180151581146116d257600080fd5b60008251611739818460208701611505565b9190910192915050565b6020815260006116d2602083018461152956fea26469706673582212205d326fcb3551f8c55e1f7f5b63b34a003743c912c76760197098dab12cb9165764736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", + Bin: "0x6101206040527302000000000000000000000000000000000000016080523480156200002a57600080fd5b5060405162001bf138038062001bf18339810160408190526200004d9162000350565b60016000556001600160a01b038416620000d45760405162461bcd60e51b815260206004820152603860248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2054656c60448201527f65706f727465724d657373656e6765722061646472657373000000000000000060648201526084015b60405180910390fd5b6001600160a01b03841661010052826200013a5760405162461bcd60e51b8152602060048201526031602482015260008051602062001bd18339815191526044820152701c98d948189b1bd8dad8da185a5b881251607a1b6064820152608401620000cb565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200018d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b3919062000399565b8303620002295760405162461bcd60e51b815260206004820152603a60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a2063616e6e6f74206260448201527f726964676520776974682073616d6520626c6f636b636861696e0000000000006064820152608401620000cb565b60a08390526001600160a01b0382166200029b5760405162461bcd60e51b8152602060048201526034602482015260008051602062001bd183398151915260448201527f72636520636f6e747261637420616464726573730000000000000000000000006064820152608401620000cb565b6001600160a01b03821660c0526000819003620003215760405162461bcd60e51b815260206004820152603660248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20696e6960448201527f7469616c207265736572766520696d62616c616e6365000000000000000000006064820152608401620000cb565b60e081905260015550620003b3915050565b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080608085870312156200036757600080fd5b620003728562000333565b935060208501519250620003896040860162000333565b6060959095015193969295505050565b600060208284031215620003ac57600080fd5b5051919050565b60805160a05160c05160e0516101005161178c62000445600039600081816102440152818161035c015281816105fe01528181610638015261084801526000818161021001526103060152600081816101b1015281816103bc01528181610698015261096b01526000818161013c015281816103960152818161067201526108e701526000610bdc015261178c6000f3fe6080604052600436106100e75760003560e01c80638ac7dd201161008a578063ab28523011610059578063ab28523014610297578063c452165e146102ae578063c868efaa146102c6578063d30951261461029757600080fd5b80638ac7dd20146101fe5780639b3e580314610232578063a2309ff814610266578063a2a950171461027c57600080fd5b80633a94fe51116100c65780633a94fe511461015e57806349e3284e146101805780635d93f9af1461019f57806375846562146101eb57600080fd5b8062d872ae146100ec57806318160ddd1461011557806329b7b3fd1461012a575b600080fd5b3480156100f857600080fd5b5061010260015481565b6040519081526020015b60405180910390f35b34801561012157600080fd5b506101026102e6565b34801561013657600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561016a57600080fd5b5061017e61017936600461130a565b610345565b005b34801561018c57600080fd5b506001546040519015815260200161010c565b3480156101ab57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010c565b61017e6101f9366004611376565b610520565b34801561020a57600080fd5b506101027f000000000000000000000000000000000000000000000000000000000000000081565b34801561023e57600080fd5b506101d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027257600080fd5b5061010260025481565b34801561028857600080fd5b506101d36001600160981b0181565b3480156102a357600080fd5b50610102620186a081565b3480156102ba57600080fd5b506101d3600160981b81565b3480156102d257600080fd5b5061017e6102e13660046113da565b610835565b6000806103006001600160981b0131600160981b31611479565b905060007f00000000000000000000000000000000000000000000000000000000000000006002546103329190611479565b905061033e828261148c565b9250505090565b6000600160981b6001600160a01b031631905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906103fa919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506040805160208082018990528251808303820181528284019093529092019161046c91600191606001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161049a91906115d0565b6020604051808303816000875af11580156104b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104dd919061164e565b9050807f2550fa6041684d40e635e29e93dde9017d70c25b46aa88393317b5182ed6ae7c8360405161051191815260200190565b60405180910390a25050505050565b610528610c46565b6001600160a01b0384166105575760405162461bcd60e51b815260040161054e90611667565b60405180910390fd5b600154156105c45760405162461bcd60e51b815260206004820152603460248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20636f6e7472616374604482015273081d5b99195c98dbdb1b185d195c985b1a5e995960621b606482015260840161054e565b6000602084013515610623576105ea6105e060208601866116b5565b8560200135610c9f565b90506106236105fc60208601866116b5565b7f000000000000000000000000000000000000000000000000000000000000000083610e09565b6106346001600160981b0134610eee565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906106d6919061149f565b8152602001620186a081526020018787808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505060405160209384019361074492508d913491016001600160a01b03929092168252602082015260400190565b60408051601f19818403018152908290526107629291602001611555565b6040516020818303038152906040528152506040518263ffffffff1660e01b815260040161079091906115d0565b6020604051808303816000875af11580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d3919061164e565b905080866001600160a01b0316336001600160a01b03167f0322cbb1d3c23f6dbf1deddb3b4ef3ce0f93ae6eec7b44e4f395804104466d143460405161081b91815260200190565b60405180910390a4505061082f6001600055565b50505050565b61083d610c46565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108e55760405162461bcd60e51b815260206004820152604160248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201527f697a65642054656c65706f727465724d657373656e67657220636f6e747261636064820152601d60fa1b608482015260a40161054e565b7f000000000000000000000000000000000000000000000000000000000000000084146109695760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20696e76616c69642060448201526b39b7bab931b29031b430b4b760a11b606482015260840161054e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146109fe5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a20756e617574686f7260448201526a34bd32b21039b2b73232b960a91b606482015260840161054e565b600080610a0d838501856116d9565b90925090506001600160a01b038216610a385760405162461bcd60e51b815260040161054e90611667565b80600003610a9c5760405162461bcd60e51b815260206004820152602b60248201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2074726160448201526a6e736665722076616c756560a81b606482015260840161054e565b600154819015610b6157600154821115610b055760015460408051918252600060208301527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1600154610af9908361148c565b60006001559050610b61565b8160016000828254610b17919061148c565b90915550506001546040805184815260208101929092527f244160b15e69cc411f041d94ae7fab6f6bba85dade8403216c05ff4b920d5449910160405180910390a1505050610c3c565b8060026000828254610b739190611479565b90915550506040518181526001600160a01b038416907fd949ea0e9d5db53492d77f28fd5467fb2f6c4f5b88e3350e3c36729b76e99cf29060200160405180910390a26040516327ad555d60e11b81526001600160a01b038481166004830152602482018390527f00000000000000000000000000000000000000000000000000000000000000001690634f5aaaba90604401600060405180830381600087803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b505050505050505b61082f6001600055565b600260005403610c985760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161054e565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c919061164e565b9050610d236001600160a01b03851633308661100c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610d6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8e919061164e565b9050818111610df45760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161054e565b610dfe828261148c565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e919061164e565b610e889190611479565b6040516001600160a01b03851660248201526044810182905290915061082f90859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611044565b80471015610f3e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161054e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610f8b576040519150601f19603f3d011682016040523d82523d6000602084013e610f90565b606091505b50509050806110075760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161054e565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261082f9085906323b872dd60e01b90608401610eb7565b6000611099826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111169092919063ffffffff16565b80519091501561100757808060200190518101906110b79190611705565b6110075760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161054e565b6060611125848460008561112d565b949350505050565b60608247101561118e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161054e565b600080866001600160a01b031685876040516111aa9190611727565b60006040518083038185875af1925050503d80600081146111e7576040519150601f19603f3d011682016040523d82523d6000602084013e6111ec565b606091505b50915091506111fd87838387611208565b979650505050505050565b60608315611277578251600003611270576001600160a01b0385163b6112705760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161054e565b5081611125565b611125838381511561128c5781518083602001fd5b8060405162461bcd60e51b815260040161054e9190611743565b6000604082840312156112b857600080fd5b50919050565b60008083601f8401126112d057600080fd5b50813567ffffffffffffffff8111156112e857600080fd5b6020830191508360208260051b850101111561130357600080fd5b9250929050565b60008060006060848603121561131f57600080fd5b61132985856112a6565b9250604084013567ffffffffffffffff81111561134557600080fd5b611351868287016112be565b9497909650939450505050565b6001600160a01b038116811461137357600080fd5b50565b6000806000806080858703121561138c57600080fd5b84356113978161135e565b93506113a686602087016112a6565b9250606085013567ffffffffffffffff8111156113c257600080fd5b6113ce878288016112be565b95989497509550505050565b600080600080606085870312156113f057600080fd5b8435935060208501356114028161135e565b9250604085013567ffffffffffffffff8082111561141f57600080fd5b818701915087601f83011261143357600080fd5b81358181111561144257600080fd5b88602082850101111561145457600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e0357610e03611463565b81810381811115610e0357610e03611463565b6000604082840312156114b157600080fd5b6040516040810181811067ffffffffffffffff821117156114e257634e487b7160e01b600052604160045260246000fd5b60405282356114f08161135e565b81526020928301359281019290925250919050565b60005b83811015611520578181015183820152602001611508565b50506000910152565b60008151808452611541816020860160208601611505565b601f01601f19169290920160200192915050565b60006002841061157557634e487b7160e01b600052602160045260246000fd5b838252604060208301526111256040830184611529565b600081518084526020808501945080840160005b838110156115c55781516001600160a01b0316875295820195908201906001016115a0565b509495945050505050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261163161010084018261158c565b905060a0840151601f198483030160e0850152610dfe8282611529565b60006020828403121561166057600080fd5b5051919050565b6020808252602e908201527f4e6174697665546f6b656e44657374696e6174696f6e3a207a65726f2072656360408201526d697069656e74206164647265737360901b606082015260800190565b6000602082840312156116c757600080fd5b81356116d28161135e565b9392505050565b600080604083850312156116ec57600080fd5b82356116f78161135e565b946020939093013593505050565b60006020828403121561171757600080fd5b815180151581146116d257600080fd5b60008251611739818460208701611505565b9190910192915050565b6020815260006116d2602083018461152956fea264697066735822122031be351ec7473d9d4a6c8e7fd7b35a9c184972d95b090fff1627f7609890413364736f6c634300081200334e6174697665546f6b656e44657374696e6174696f6e3a207a65726f20736f75", } // NativeTokenDestinationABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go index 6a481c666..0bb70bc2b 100644 --- a/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go +++ b/abi-bindings/go/CrossChainApplications/NativeTokenBridge/NativeTokenSource/NativeTokenSource.go @@ -38,7 +38,7 @@ type TeleporterFeeInfo struct { // NativeTokenSourceMetaData contains all meta data concerning the NativeTokenSource contract. var NativeTokenSourceMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeTokenDestinationAddress_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BurnTokens\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"teleporterMessageID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferToDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"UnlockTokens\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BURNED_TX_FEES_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_NATIVE_TOKENS_REQUIRED_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"destinationBurnedTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeTokenDestinationAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"senderBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"transferToDestination\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b506040516200173a3803806200173a8339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b815260206004820152603160248201526000805160206200171a8339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200171a83398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516113ad6200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526113ad6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610eaa565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610f49565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610fc3565b60405180910390fd5b60006020840135156102575761021e610214602086018661100c565b8560200135610745565b9050610257610230602086018661100c565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190611077565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611163565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906111e1565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856111fa565b9092509050600082600181111561061d5761061d6112a6565b0361064e576000808280602001905181019061063991906112bc565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626112a6565b0361068e5760008180602001905181019061067d91906111e1565b905061068881610a6d565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906111e1565b90506107c96001600160a01b038516333086610a9c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906111e1565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611300565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906111e1565b61092e9190611313565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad4565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610fc3565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610a698282610bab565b5050565b600154811115610a9957600060015482610a879190611300565b9050610a9281610cc4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d059092919063ffffffff16565b805190915015610ba65780806020019051810190610b479190611326565b610ba65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b80471015610bfb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016101ef565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c48576040519150601f19603f3d011682016040523d82523d6000602084013e610c4d565b606091505b5050905080610ba65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610a99600160981b82610bab565b6060610d148484600085610d1c565b949350505050565b606082471015610d7d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610d999190611348565b60006040518083038185875af1925050503d8060008114610dd6576040519150601f19603f3d011682016040523d82523d6000602084013e610ddb565b606091505b5091509150610dec87838387610df7565b979650505050505050565b60608315610e66578251600003610e5f576001600160a01b0385163b610e5f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610d14565b610d148383815115610e7b5781518083602001fd5b8060405162461bcd60e51b81526004016101ef9190611364565b6001600160a01b0381168114610a9957600080fd5b6000806000808486036080811215610ec157600080fd5b8535610ecc81610e95565b94506040601f1982011215610ee057600080fd5b50602085019250606085013567ffffffffffffffff80821115610f0257600080fd5b818701915087601f830112610f1657600080fd5b813581811115610f2557600080fd5b8860208260051b8501011115610f3a57600080fd5b95989497505060200194505050565b60008060008060608587031215610f5f57600080fd5b843593506020850135610f7181610e95565b9250604085013567ffffffffffffffff80821115610f8e57600080fd5b818701915087601f830112610fa257600080fd5b813581811115610fb157600080fd5b886020828501011115610f3a57600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b60006020828403121561101e57600080fd5b813561102981610e95565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561106f5761106f611030565b604052919050565b60006040828403121561108957600080fd5b6040516040810181811067ffffffffffffffff821117156110ac576110ac611030565b60405282356110ba81610e95565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156111085781516001600160a01b0316875295820195908201906001016110e3565b509495945050505050565b60005b8381101561112e578181015183820152602001611116565b50506000910152565b6000815180845261114f816020860160208601611113565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526111c46101008401826110cf565b905060a0840151601f198483030160e08501526108a48282611137565b6000602082840312156111f357600080fd5b5051919050565b6000806040838503121561120d57600080fd5b82356002811061121c57600080fd5b915060208381013567ffffffffffffffff8082111561123a57600080fd5b818601915086601f83011261124e57600080fd5b81358181111561126057611260611030565b611272601f8201601f19168501611046565b9150808252878482850101111561128857600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156112cf57600080fd5b82516112da81610e95565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96112ea565b808201808211156108a9576108a96112ea565b60006020828403121561133857600080fd5b8151801515811461102957600080fd5b6000825161135a818460208701611113565b9190910192915050565b602081526000611029602083018461113756fea2646970667358221220f70e4662c2679fb4a73f670c09d6430821f46cf73e7d1213af9e4e3ec525091f64736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", + Bin: "0x60e06040523480156200001157600080fd5b506040516200173a3803806200173a8339810160408190526200003491620002b3565b60016000556001600160a01b038316620000bb5760405162461bcd60e51b815260206004820152603360248201527f4e6174697665546f6b656e536f757263653a207a65726f2054656c65706f727460448201527f65724d657373656e67657220616464726573730000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b03831660c05281620001205760405162461bcd60e51b815260206004820152603160248201526000805160206200171a8339815191526044820152701a5bdb88189b1bd8dad8da185a5b881251607a1b6064820152608401620000b2565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001999190620002f4565b82036200020f5760405162461bcd60e51b815260206004820152603560248201527f4e6174697665546f6b656e536f757263653a2063616e6e6f742062726964676560448201527f20776974682073616d6520626c6f636b636861696e00000000000000000000006064820152608401620000b2565b60808290526001600160a01b038116620002815760405162461bcd60e51b815260206004820152603460248201526000805160206200171a83398151915260448201527f696f6e20636f6e747261637420616464726573730000000000000000000000006064820152608401620000b2565b6001600160a01b031660a052506200030e9050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b600080600060608486031215620002c957600080fd5b620002d48462000296565b925060208401519150620002eb6040850162000296565b90509250925092565b6000602082840312156200030757600080fd5b5051919050565b60805160a05160c0516113ad6200036d6000396000818160ef015281816102320152818161025b015261044e015260008181610167015281816102bb015261056701526000818160920152818161029501526104e301526113ad6000f3fe60806040526004361061007b5760003560e01c8063b6171f731161004e578063b6171f731461013e578063b8c9091a14610155578063c452165e14610189578063c868efaa146101a157600080fd5b806341d3014d1461008057806355db3e9e146100c75780639b3e5803146100dd578063ad0aee2514610129575b600080fd5b34801561008c57600080fd5b506100b47f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156100d357600080fd5b506100b460015481565b3480156100e957600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100be565b61013c610137366004610eaa565b6101c1565b005b34801561014a57600080fd5b506100b4620186a081565b34801561016157600080fd5b506101117f000000000000000000000000000000000000000000000000000000000000000081565b34801561019557600080fd5b50610111600160981b81565b3480156101ad57600080fd5b5061013c6101bc366004610f49565b61043b565b6101c96106ec565b6001600160a01b0384166101f85760405162461bcd60e51b81526004016101ef90610fc3565b60405180910390fd5b60006020840135156102575761021e610214602086018661100c565b8560200135610745565b9050610257610230602086018661100c565b7f0000000000000000000000000000000000000000000000000000000000000000836108af565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663624488506040518060c001604052807f000000000000000000000000000000000000000000000000000000000000000081526020017f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001888036038101906102f99190611077565b8152602001620186a08152602001878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250604051602091820191610368918c913491016001600160a01b03929092168252602082015260400190565b6040516020818303038152906040528152506040518263ffffffff1660e01b81526004016103969190611163565b6020604051808303816000875af11580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d991906111e1565b905080866001600160a01b0316336001600160a01b03167f2b4e8f08417773e367064a6aea9ca2df303a60876676f70b6c3c5e66b314ca5a3460405161042191815260200190565b60405180910390a450506104356001600055565b50505050565b6104436106ec565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e15760405162461bcd60e51b815260206004820152603c60248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201527f54656c65706f727465724d657373656e67657220636f6e74726163740000000060648201526084016101ef565b7f000000000000000000000000000000000000000000000000000000000000000084146105655760405162461bcd60e51b815260206004820152602c60248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420646573746960448201526b3730ba34b7b71031b430b4b760a11b60648201526084016101ef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316146105f55760405162461bcd60e51b815260206004820152602660248201527f4e6174697665546f6b656e536f757263653a20756e617574686f72697a65642060448201526539b2b73232b960d11b60648201526084016101ef565b600080610604838501856111fa565b9092509050600082600181111561061d5761061d6112a6565b0361064e576000808280602001905181019061063991906112bc565b915091506106478282610994565b50506106e0565b6001826001811115610662576106626112a6565b0361068e5760008180602001905181019061067d91906111e1565b905061068881610a6d565b506106e0565b60405162461bcd60e51b815260206004820152602160248201527f4e6174697665546f6b656e536f757263653a20696e76616c696420616374696f6044820152603760f91b60648201526084016101ef565b50506104356001600055565b60026000540361073e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101ef565b6002600055565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b291906111e1565b90506107c96001600160a01b038516333086610a9c565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906111e1565b905081811161089a5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016101ef565b6108a48282611300565b925050505b92915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610900573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092491906111e1565b61092e9190611313565b6040516001600160a01b03851660248201526044810182905290915061043590859063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad4565b6001600160a01b0382166109ba5760405162461bcd60e51b81526004016101ef90610fc3565b80471015610a1d5760405162461bcd60e51b815260206004820152602a60248201527f4e6174697665546f6b656e536f757263653a20696e73756666696369656e742060448201526918dbdb1b185d195c985b60b21b60648201526084016101ef565b604080516001600160a01b0384168152602081018390527f55aaef8fd8c07238c3618a93c8a1627194187d3b0952908e58f2ab0f944fb407910160405180910390a1610a698282610bab565b5050565b600154811115610a9957600060015482610a879190611300565b9050610a9281610cc4565b5060018190555b50565b6040516001600160a01b03808516602483015283166044820152606481018290526104359085906323b872dd60e01b9060840161095d565b6000610b29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d059092919063ffffffff16565b805190915015610ba65780806020019051810190610b479190611326565b610ba65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016101ef565b505050565b80471015610bfb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016101ef565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c48576040519150601f19603f3d011682016040523d82523d6000602084013e610c4d565b606091505b5050905080610ba65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016101ef565b6040518181527f2cd3fd70cd5a5d6d805e90d22741aa1a84590ace7cf01b244719558d266143829060200160405180910390a1610a99600160981b82610bab565b6060610d148484600085610d1c565b949350505050565b606082471015610d7d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016101ef565b600080866001600160a01b03168587604051610d999190611348565b60006040518083038185875af1925050503d8060008114610dd6576040519150601f19603f3d011682016040523d82523d6000602084013e610ddb565b606091505b5091509150610dec87838387610df7565b979650505050505050565b60608315610e66578251600003610e5f576001600160a01b0385163b610e5f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101ef565b5081610d14565b610d148383815115610e7b5781518083602001fd5b8060405162461bcd60e51b81526004016101ef9190611364565b6001600160a01b0381168114610a9957600080fd5b6000806000808486036080811215610ec157600080fd5b8535610ecc81610e95565b94506040601f1982011215610ee057600080fd5b50602085019250606085013567ffffffffffffffff80821115610f0257600080fd5b818701915087601f830112610f1657600080fd5b813581811115610f2557600080fd5b8860208260051b8501011115610f3a57600080fd5b95989497505060200194505050565b60008060008060608587031215610f5f57600080fd5b843593506020850135610f7181610e95565b9250604085013567ffffffffffffffff80821115610f8e57600080fd5b818701915087601f830112610fa257600080fd5b813581811115610fb157600080fd5b886020828501011115610f3a57600080fd5b60208082526029908201527f4e6174697665546f6b656e536f757263653a207a65726f20726563697069656e60408201526874206164647265737360b81b606082015260800190565b60006020828403121561101e57600080fd5b813561102981610e95565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561106f5761106f611030565b604052919050565b60006040828403121561108957600080fd5b6040516040810181811067ffffffffffffffff821117156110ac576110ac611030565b60405282356110ba81610e95565b81526020928301359281019290925250919050565b600081518084526020808501945080840160005b838110156111085781516001600160a01b0316875295820195908201906001016110e3565b509495945050505050565b60005b8381101561112e578181015183820152602001611116565b50506000910152565b6000815180845261114f816020860160208601611113565b601f01601f19169290920160200192915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c08401526111c46101008401826110cf565b905060a0840151601f198483030160e08501526108a48282611137565b6000602082840312156111f357600080fd5b5051919050565b6000806040838503121561120d57600080fd5b82356002811061121c57600080fd5b915060208381013567ffffffffffffffff8082111561123a57600080fd5b818601915086601f83011261124e57600080fd5b81358181111561126057611260611030565b611272601f8201601f19168501611046565b9150808252878482850101111561128857600080fd5b80848401858401376000848284010152508093505050509250929050565b634e487b7160e01b600052602160045260246000fd5b600080604083850312156112cf57600080fd5b82516112da81610e95565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156108a9576108a96112ea565b808201808211156108a9576108a96112ea565b60006020828403121561133857600080fd5b8151801515811461102957600080fd5b6000825161135a818460208701611113565b9190910192915050565b602081526000611029602083018461113756fea2646970667358221220ef957cee15f1f84359336ed70c1da014d8fd7290244e6c1645813e7729b0bea064736f6c634300081200334e6174697665546f6b656e536f757263653a207a65726f2064657374696e6174", } // NativeTokenSourceABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go index eebf52e96..aff0952d4 100644 --- a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go +++ b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go @@ -32,7 +32,7 @@ var ( // BlockHashPublisherMetaData contains all meta data concerning the BlockHashPublisher contract. var BlockHashPublisherMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"PublishBlockHash\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60a060405234801561001057600080fd5b506040516105cf3803806105cf83398101604081905261002f916100c0565b6001600160a01b0381166100af5760405162461bcd60e51b815260206004820152603460248201527f426c6f636b486173685075626c69736865723a207a65726f2074656c65706f7260448201527f7465722072656769737472792061646472657373000000000000000000000000606482015260840160405180910390fd5b6001600160a01b03166080526100f0565b6000602082840312156100d257600080fd5b81516001600160a01b03811681146100e957600080fd5b9392505050565b6080516104be610111600039600081816068015261012701526104be6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806318aef19b146100465780631a7f5bec1461006357806382ab2b86146100a2575b600080fd5b610050620249f081565b6040519081526020015b60405180910390f35b61008a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161005a565b6100506100b03660046102d3565b6000806100be600143610303565b6040805160208101839052824081830181905282518083038401815260608301938490529281905292935083906001600160a01b0387169088907fe13623d33d18131ce960c33b1282ceac1fe7b5ccfcf7f8c0f6dad32dd61e3bdd9060800160405180910390a47f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610183573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a79190610324565b6001600160a01b031663624488506040518060c00160405280898152602001886001600160a01b03168152602001604051806040016040528060006001600160a01b0316815260200160008152508152602001620249f08152602001600067ffffffffffffffff81111561021d5761021d610348565b604051908082528060200260200182016040528015610246578160200160208202803683370190505b508152602001848152506040518263ffffffff1660e01b815260040161026c91906103e8565b6020604051808303816000875af115801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102af919061046f565b93505050505b92915050565b6001600160a01b03811681146102d057600080fd5b50565b600080604083850312156102e657600080fd5b8235915060208301356102f8816102bb565b809150509250929050565b818103818111156102b557634e487b7160e01b600052601160045260246000fd5b60006020828403121561033657600080fd5b8151610341816102bb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600081518084526020808501945080840160005b838110156103975781516001600160a01b031687529582019590820190600101610372565b509495945050505050565b6000815180845260005b818110156103c8576020818501810151868301820152016103ac565b506000602082860101526020601f19601f83011685010191505092915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261044961010084018261035e565b905060a0840151601f198483030160e085015261046682826103a2565b95945050505050565b60006020828403121561048157600080fd5b505191905056fea264697066735822122010b6af01ae9ccbbddca81b7ca0f9cac050ec865e18949c11b4cd61d7283dee0064736f6c63430008120033", + Bin: "0x60a060405234801561001057600080fd5b506040516105cf3803806105cf83398101604081905261002f916100c0565b6001600160a01b0381166100af5760405162461bcd60e51b815260206004820152603460248201527f426c6f636b486173685075626c69736865723a207a65726f2074656c65706f7260448201527f7465722072656769737472792061646472657373000000000000000000000000606482015260840160405180910390fd5b6001600160a01b03166080526100f0565b6000602082840312156100d257600080fd5b81516001600160a01b03811681146100e957600080fd5b9392505050565b6080516104be610111600039600081816068015261012701526104be6000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806318aef19b146100465780631a7f5bec1461006357806382ab2b86146100a2575b600080fd5b610050620249f081565b6040519081526020015b60405180910390f35b61008a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161005a565b6100506100b03660046102d3565b6000806100be600143610303565b6040805160208101839052824081830181905282518083038401815260608301938490529281905292935083906001600160a01b0387169088907fe13623d33d18131ce960c33b1282ceac1fe7b5ccfcf7f8c0f6dad32dd61e3bdd9060800160405180910390a47f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d820e64f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610183573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a79190610324565b6001600160a01b031663624488506040518060c00160405280898152602001886001600160a01b03168152602001604051806040016040528060006001600160a01b0316815260200160008152508152602001620249f08152602001600067ffffffffffffffff81111561021d5761021d610348565b604051908082528060200260200182016040528015610246578160200160208202803683370190505b508152602001848152506040518263ffffffff1660e01b815260040161026c91906103e8565b6020604051808303816000875af115801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102af919061046f565b93505050505b92915050565b6001600160a01b03811681146102d057600080fd5b50565b600080604083850312156102e657600080fd5b8235915060208301356102f8816102bb565b809150509250929050565b818103818111156102b557634e487b7160e01b600052601160045260246000fd5b60006020828403121561033657600080fd5b8151610341816102bb565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600081518084526020808501945080840160005b838110156103975781516001600160a01b031687529582019590820190600101610372565b509495945050505050565b6000815180845260005b818110156103c8576020818501810151868301820152016103ac565b506000602082860101526020601f19601f83011685010191505092915050565b60208152815160208201526000602083015160018060a01b03808216604085015260408501519150808251166060850152506020810151608084015250606083015160a0830152608083015160e060c084015261044961010084018261035e565b905060a0840151601f198483030160e085015261046682826103a2565b95945050505050565b60006020828403121561048157600080fd5b505191905056fea26469706673582212209c9d1183e402d393c1a969c34af11df64a1e4a0462f7df0c49bc3ebc0ec5368864736f6c63430008120033", } // BlockHashPublisherABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go index 64fb14d3a..27b108df6 100644 --- a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go +++ b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go @@ -31,8 +31,8 @@ var ( // BlockHashReceiverMetaData contains all meta data concerning the BlockHashReceiver contract. var BlockHashReceiverMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60e060405234801561001057600080fd5b50604051610d89380380610d8983398101604081905261002f916101b3565b82806001600160a01b0381166100b15760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa1580156100fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061011f91906101ef565b6001555061012c33610145565b5060a0919091526001600160a01b031660c05250610208565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146101ae57600080fd5b919050565b6000806000606084860312156101c857600080fd5b6101d184610197565b9250602084015191506101e660408501610197565b90509250925092565b60006020828403121561020157600080fd5b5051919050565b60805160a05160c051610b37610252600039600081816101a601526108d4015260008181610138015261085201526000818160f4015281816103ec01526106080152610b376000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063c868efaa11610066578063c868efaa14610230578063d2cc7a7014610243578063f2fde38b1461024b578063f3f39ee51461025e57600080fd5b80638da5cb5b146101c857806397314297146101d9578063b17810be1461021557600080fd5b80635eb99514116100c85780635eb995141461017d5780636c4f6ba914610190578063715018a61461019957806379a0710c146101a157600080fd5b80631a7f5bec146100ef57806329b7b3fd146101335780632b0d8f1814610168575b600080fd5b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61015a7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161012a565b61017b610176366004610a02565b610267565b005b61017b61018b366004610a24565b6103ac565b61015a60045481565b61017b6103c0565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6002546001600160a01b0316610116565b6102056101e7366004610a02565b6001600160a01b031660009081526020819052604090205460ff1690565b604051901515815260200161012a565b6003546004546040805192835260208301919091520161012a565b61017b61023e366004610a3d565b6103d4565b60015461015a565b61017b610259366004610a02565b610586565b61015a60035481565b61026f6105fc565b6001600160a01b0381166102e15760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560448201526d706f72746572206164647265737360901b60648201526084015b60405180910390fd5b6001600160a01b03811660009081526020819052604090205460ff16156103605760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b60648201526084016102d8565b6001600160a01b038116600081815260208190526040808220805460ff19166001179055517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b6103b46105fc565b6103bd81610604565b50565b6103c86107a4565b6103d260006107fe565b565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa15801561043b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045f9190610ac4565b10156104c65760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b60648201526084016102d8565b3360009081526020819052604090205460ff161561053f5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b60648201526084016102d8565b610580848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061085092505050565b50505050565b61058e6107a4565b6001600160a01b0381166105f35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102d8565b6103bd816107fe565b6103d26107a4565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610664573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106889190610ac4565b600154909150818311156106f85760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b60648201526084016102d8565b80831161076d5760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e0060648201526084016102d8565b6001839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b6002546001600160a01b031633146103d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d8565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b7f000000000000000000000000000000000000000000000000000000000000000083146108d25760405162461bcd60e51b815260206004820152602a60248201527f426c6f636b4861736852656365697665723a20696e76616c696420736f757263604482015269194818da185a5b88125160b21b60648201526084016102d8565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461096d5760405162461bcd60e51b815260206004820152603160248201527f426c6f636b4861736852656365697665723a20696e76616c696420736f757263604482015270329031b430b4b710383ab13634b9b432b960791b60648201526084016102d8565b600080828060200190518101906109849190610add565b915091506003548211156109df576003829055600481905560405181815282906001600160a01b0386169087907f0bca78aa82d7575f42e4b4b2fe04765a4b2f3661786403788ce987e065ac590d9060200160405180910390a45b5050505050565b80356001600160a01b03811681146109fd57600080fd5b919050565b600060208284031215610a1457600080fd5b610a1d826109e6565b9392505050565b600060208284031215610a3657600080fd5b5035919050565b60008060008060608587031215610a5357600080fd5b84359350610a63602086016109e6565b9250604085013567ffffffffffffffff80821115610a8057600080fd5b818701915087601f830112610a9457600080fd5b813581811115610aa357600080fd5b886020828501011115610ab557600080fd5b95989497505060200194505050565b600060208284031215610ad657600080fd5b5051919050565b60008060408385031215610af057600080fd5b50508051602090910151909290915056fea26469706673582212205d91745c6c52609e41b12179833976949734d7ab772cc8c8a420bba4dd88ac5864736f6c63430008120033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldMinTeleporterVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newMinTeleporterVersion\",\"type\":\"uint256\"}],\"name\":\"MinTeleporterVersionUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"ReceiveBlockHash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"TeleporterAddressUnpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getMinTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"isTeleporterAddressPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"pauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourcePublisherContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterAddress\",\"type\":\"address\"}],\"name\":\"unpauseTeleporterAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60e060405234801561001057600080fd5b50604051610eaf380380610eaf83398101604081905261002f916101b3565b82806001600160a01b0381166100b15760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465725570677261646561626c653a207a65726f2074656c6560448201527f706f727465722072656769737472792061646472657373000000000000000000606482015260840160405180910390fd5b6001600160a01b03811660808190526040805163301fd1f560e21b8152905163c07f47d4916004808201926020929091908290030181865afa1580156100fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061011f91906101ef565b6001555061012c33610145565b5060a0919091526001600160a01b031660c05250610208565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146101ae57600080fd5b919050565b6000806000606084860312156101c857600080fd5b6101d184610197565b9250602084015191506101e660408501610197565b90509250925092565b60006020828403121561020157600080fd5b5051919050565b60805160a05160c051610c5d610252600039600081816101c401526109ac015260008181610143015261092a01526000818160ff015281816104c401526106e00152610c5d6000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806379a0710c11610097578063c868efaa11610066578063c868efaa1461024e578063d2cc7a7014610261578063f2fde38b14610269578063f3f39ee51461027c57600080fd5b806379a0710c146101bf5780638da5cb5b146101e657806397314297146101f7578063b17810be1461023357600080fd5b80634511243e116100d35780634511243e146101885780635eb995141461019b5780636c4f6ba9146101ae578063715018a6146101b757600080fd5b80631a7f5bec146100fa57806329b7b3fd1461013e5780632b0d8f1814610173575b600080fd5b6101217f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101657f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610135565b610186610181366004610ada565b610285565b005b610186610196366004610ada565b610387565b6101866101a9366004610afc565b610484565b61016560045481565b610186610498565b6101217f000000000000000000000000000000000000000000000000000000000000000081565b6002546001600160a01b0316610121565b610223610205366004610ada565b6001600160a01b031660009081526020819052604090205460ff1690565b6040519015158152602001610135565b60035460045460408051928352602083019190915201610135565b61018661025c366004610b15565b6104ac565b600154610165565b610186610277366004610ada565b61065e565b61016560035481565b61028d6106d4565b6001600160a01b0381166102bc5760405162461bcd60e51b81526004016102b390610b9c565b60405180910390fd5b6001600160a01b03811660009081526020819052604090205460ff161561033b5760405162461bcd60e51b815260206004820152602d60248201527f54656c65706f727465725570677261646561626c653a2061646472657373206160448201526c1b1c9958591e481c185d5cd959609a1b60648201526084016102b3565b6001600160a01b038116600081815260208190526040808220805460ff19166001179055517f933f93e57a222e6330362af8b376d0a8725b6901e9a2fb86d00f169702b28a4c9190a250565b61038f6106d4565b6001600160a01b0381166103b55760405162461bcd60e51b81526004016102b390610b9c565b6001600160a01b03811660009081526020819052604090205460ff1661042f5760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465725570677261646561626c653a2061646472657373206e6044820152681bdd081c185d5cd95960ba1b60648201526084016102b3565b6040516001600160a01b038216907f844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c390600090a26001600160a01b03166000908152602081905260409020805460ff19169055565b61048c6106d4565b610495816106dc565b50565b6104a061087c565b6104aa60006108d6565b565b60015460405163260f846760e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634c1f08ce90602401602060405180830381865afa158015610513573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105379190610bea565b101561059e5760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201526f32b632b837b93a32b91039b2b73232b960811b60648201526084016102b3565b3360009081526020819052604090205460ff16156106175760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465725570677261646561626c653a2054656c65706f72746560448201526f1c881859191c995cdcc81c185d5cd95960821b60648201526084016102b3565b610658848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061092892505050565b50505050565b61066661087c565b6001600160a01b0381166106cb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b3565b610495816108d6565b6104aa61087c565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c07f47d46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561073c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107609190610bea565b600154909150818311156107d05760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465725570677261646561626c653a20696e76616c6964205460448201527032b632b837b93a32b9103b32b939b4b7b760791b60648201526084016102b3565b8083116108455760405162461bcd60e51b815260206004820152603f60248201527f54656c65706f727465725570677261646561626c653a206e6f7420677265617460448201527f6572207468616e2063757272656e74206d696e696d756d2076657273696f6e0060648201526084016102b3565b6001839055604051839082907fa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d90600090a3505050565b6002546001600160a01b031633146104aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b3565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b7f000000000000000000000000000000000000000000000000000000000000000083146109aa5760405162461bcd60e51b815260206004820152602a60248201527f426c6f636b4861736852656365697665723a20696e76616c696420736f757263604482015269194818da185a5b88125160b21b60648201526084016102b3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614610a455760405162461bcd60e51b815260206004820152603160248201527f426c6f636b4861736852656365697665723a20696e76616c696420736f757263604482015270329031b430b4b710383ab13634b9b432b960791b60648201526084016102b3565b60008082806020019051810190610a5c9190610c03565b91509150600354821115610ab7576003829055600481905560405181815282906001600160a01b0386169087907f0bca78aa82d7575f42e4b4b2fe04765a4b2f3661786403788ce987e065ac590d9060200160405180910390a45b5050505050565b80356001600160a01b0381168114610ad557600080fd5b919050565b600060208284031215610aec57600080fd5b610af582610abe565b9392505050565b600060208284031215610b0e57600080fd5b5035919050565b60008060008060608587031215610b2b57600080fd5b84359350610b3b60208601610abe565b9250604085013567ffffffffffffffff80821115610b5857600080fd5b818701915087601f830112610b6c57600080fd5b813581811115610b7b57600080fd5b886020828501011115610b8d57600080fd5b95989497505060200194505050565b6020808252602e908201527f54656c65706f727465725570677261646561626c653a207a65726f2054656c6560408201526d706f72746572206164647265737360901b606082015260800190565b600060208284031215610bfc57600080fd5b5051919050565b60008060408385031215610c1657600080fd5b50508051602090910151909290915056fea2646970667358221220b06ee0c2f2146639a67985128085a5a4dd28e0fefb116cabe224ed48c8b9744064736f6c63430008120033", } // BlockHashReceiverABI is the input ABI used to generate the binding from. @@ -566,6 +566,27 @@ func (_BlockHashReceiver *BlockHashReceiverTransactorSession) TransferOwnership( return _BlockHashReceiver.Contract.TransferOwnership(&_BlockHashReceiver.TransactOpts, newOwner) } +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_BlockHashReceiver *BlockHashReceiverTransactor) UnpauseTeleporterAddress(opts *bind.TransactOpts, teleporterAddress common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.contract.Transact(opts, "unpauseTeleporterAddress", teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_BlockHashReceiver *BlockHashReceiverSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UnpauseTeleporterAddress(&_BlockHashReceiver.TransactOpts, teleporterAddress) +} + +// UnpauseTeleporterAddress is a paid mutator transaction binding the contract method 0x4511243e. +// +// Solidity: function unpauseTeleporterAddress(address teleporterAddress) returns() +func (_BlockHashReceiver *BlockHashReceiverTransactorSession) UnpauseTeleporterAddress(teleporterAddress common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UnpauseTeleporterAddress(&_BlockHashReceiver.TransactOpts, teleporterAddress) +} + // UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0x5eb99514. // // Solidity: function updateMinTeleporterVersion(uint256 version) returns() @@ -1199,3 +1220,147 @@ func (_BlockHashReceiver *BlockHashReceiverFilterer) ParseTeleporterAddressPause event.Raw = log return event, nil } + +// BlockHashReceiverTeleporterAddressUnpausedIterator is returned from FilterTeleporterAddressUnpaused and is used to iterate over the raw logs and unpacked data for TeleporterAddressUnpaused events raised by the BlockHashReceiver contract. +type BlockHashReceiverTeleporterAddressUnpausedIterator struct { + Event *BlockHashReceiverTeleporterAddressUnpaused // 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 interfaces.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 *BlockHashReceiverTeleporterAddressUnpausedIterator) 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(BlockHashReceiverTeleporterAddressUnpaused) + 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(BlockHashReceiverTeleporterAddressUnpaused) + 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 *BlockHashReceiverTeleporterAddressUnpausedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BlockHashReceiverTeleporterAddressUnpausedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BlockHashReceiverTeleporterAddressUnpaused represents a TeleporterAddressUnpaused event raised by the BlockHashReceiver contract. +type BlockHashReceiverTeleporterAddressUnpaused struct { + TeleporterAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTeleporterAddressUnpaused is a free log retrieval operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_BlockHashReceiver *BlockHashReceiverFilterer) FilterTeleporterAddressUnpaused(opts *bind.FilterOpts, teleporterAddress []common.Address) (*BlockHashReceiverTeleporterAddressUnpausedIterator, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _BlockHashReceiver.contract.FilterLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + if err != nil { + return nil, err + } + return &BlockHashReceiverTeleporterAddressUnpausedIterator{contract: _BlockHashReceiver.contract, event: "TeleporterAddressUnpaused", logs: logs, sub: sub}, nil +} + +// WatchTeleporterAddressUnpaused is a free log subscription operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_BlockHashReceiver *BlockHashReceiverFilterer) WatchTeleporterAddressUnpaused(opts *bind.WatchOpts, sink chan<- *BlockHashReceiverTeleporterAddressUnpaused, teleporterAddress []common.Address) (event.Subscription, error) { + + var teleporterAddressRule []interface{} + for _, teleporterAddressItem := range teleporterAddress { + teleporterAddressRule = append(teleporterAddressRule, teleporterAddressItem) + } + + logs, sub, err := _BlockHashReceiver.contract.WatchLogs(opts, "TeleporterAddressUnpaused", teleporterAddressRule) + 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(BlockHashReceiverTeleporterAddressUnpaused) + if err := _BlockHashReceiver.contract.UnpackLog(event, "TeleporterAddressUnpaused", 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 +} + +// ParseTeleporterAddressUnpaused is a log parse operation binding the contract event 0x844e2f3154214672229235858fd029d1dfd543901c6d05931f0bc2480a2d72c3. +// +// Solidity: event TeleporterAddressUnpaused(address indexed teleporterAddress) +func (_BlockHashReceiver *BlockHashReceiverFilterer) ParseTeleporterAddressUnpaused(log types.Log) (*BlockHashReceiverTeleporterAddressUnpaused, error) { + event := new(BlockHashReceiverTeleporterAddressUnpaused) + if err := _BlockHashReceiver.contract.UnpackLog(event, "TeleporterAddressUnpaused", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go b/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go index b9e1802ec..cd54c6e2b 100644 --- a/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go +++ b/abi-bindings/go/Mocks/ExampleERC20/ExampleERC20.go @@ -32,7 +32,7 @@ var ( // ExampleERC20MetaData contains all meta data concerning the ExampleERC20 contract. var ExampleERC20MetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b506040518060400160405280600a81526020016926b7b1b5902a37b5b2b760b11b81525060405180604001604052806004815260200163045584d560e41b815250816003908162000063919062000208565b50600462000072828262000208565b50505062000093336b204fce5e3e250261100000006200009960201b60201c565b620002fc565b6001600160a01b038216620000f45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620001089190620002d4565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200018f57607f821691505b602082108103620001b057634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200015f57600081815260208120601f850160051c81016020861015620001df5750805b601f850160051c820191505b818110156200020057828155600101620001eb565b505050505050565b81516001600160401b0381111562000224576200022462000164565b6200023c816200023584546200017a565b84620001b6565b602080601f8311600181146200027457600084156200025b5750858301515b600019600386901b1c1916600185901b17855562000200565b600085815260208120601f198616915b82811015620002a55788860151825594840194600190910190840162000284565b5085821015620002c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115620002f657634e487b7160e01b600052601160045260246000fd5b92915050565b610b58806200030c6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a0712d6811610066578063a0712d68146101d0578063a457c2d7146101e3578063a9059cbb146101f6578063dd62ed3e1461020957600080fd5b806370a082311461018c57806379cc6790146101b557806395d89b41146101c857600080fd5b806323b872dd116100c857806323b872dd14610142578063313ce56714610155578063395093511461016457806342966c681461017757600080fd5b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f761021c565b6040516101049190610989565b60405180910390f35b61012061011b3660046109f3565b6102ae565b6040519015158152602001610104565b6002545b604051908152602001610104565b610120610150366004610a1d565b6102c8565b60405160128152602001610104565b6101206101723660046109f3565b6102ec565b61018a610185366004610a59565b61030e565b005b61013461019a366004610a72565b6001600160a01b031660009081526020819052604090205490565b61018a6101c33660046109f3565b61031b565b6100f7610334565b61018a6101de366004610a59565b610343565b6101206101f13660046109f3565b6103a9565b6101206102043660046109f3565b610424565b610134610217366004610a94565b610432565b60606003805461022b90610ac7565b80601f016020809104026020016040519081016040528092919081815260200182805461025790610ac7565b80156102a45780601f10610279576101008083540402835291602001916102a4565b820191906000526020600020905b81548152906001019060200180831161028757829003601f168201915b5050505050905090565b6000336102bc81858561045d565b60019150505b92915050565b6000336102d6858285610582565b6102e18585856105fc565b506001949350505050565b6000336102bc8185856102ff8383610432565b6103099190610b01565b61045d565b61031833826107a0565b50565b610326823383610582565b61033082826107a0565b5050565b60606004805461022b90610ac7565b662386f26fc1000081111561039f5760405162461bcd60e51b815260206004820152601f60248201527f4578616d706c6545524332303a206d6178206d696e742065786365656465640060448201526064015b60405180910390fd5b61031833826108ca565b600033816103b78286610432565b9050838110156104175760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610396565b6102e1828686840361045d565b6000336102bc8185856105fc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166104bf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610396565b6001600160a01b0382166105205760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610396565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b600061058e8484610432565b905060001981146105f657818110156105e95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610396565b6105f6848484840361045d565b50505050565b6001600160a01b0383166106605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610396565b6001600160a01b0382166106c25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610396565b6001600160a01b0383166000908152602081905260409020548181101561073a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610396565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36105f6565b6001600160a01b0382166108005760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610396565b6001600160a01b038216600090815260208190526040902054818110156108745760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610396565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610575565b6001600160a01b0382166109205760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610396565b80600260008282546109329190610b01565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156109b65785810183015185820160400152820161099a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146109ee57600080fd5b919050565b60008060408385031215610a0657600080fd5b610a0f836109d7565b946020939093013593505050565b600080600060608486031215610a3257600080fd5b610a3b846109d7565b9250610a49602085016109d7565b9150604084013590509250925092565b600060208284031215610a6b57600080fd5b5035919050565b600060208284031215610a8457600080fd5b610a8d826109d7565b9392505050565b60008060408385031215610aa757600080fd5b610ab0836109d7565b9150610abe602084016109d7565b90509250929050565b600181811c90821680610adb57607f821691505b602082108103610afb57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102c257634e487b7160e01b600052601160045260246000fdfea2646970667358221220d333284ea41bf1c9a508d9e246980a20146a77e38ecf29843615c78805e9024d64736f6c63430008120033", + Bin: "0x60806040523480156200001157600080fd5b506040518060400160405280600a81526020016926b7b1b5902a37b5b2b760b11b81525060405180604001604052806004815260200163045584d560e41b815250816003908162000063919062000208565b50600462000072828262000208565b50505062000093336b204fce5e3e250261100000006200009960201b60201c565b620002fc565b6001600160a01b038216620000f45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620001089190620002d4565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200018f57607f821691505b602082108103620001b057634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200015f57600081815260208120601f850160051c81016020861015620001df5750805b601f850160051c820191505b818110156200020057828155600101620001eb565b505050505050565b81516001600160401b0381111562000224576200022462000164565b6200023c816200023584546200017a565b84620001b6565b602080601f8311600181146200027457600084156200025b5750858301515b600019600386901b1c1916600185901b17855562000200565b600085815260208120601f198616915b82811015620002a55788860151825594840194600190910190840162000284565b5085821015620002c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115620002f657634e487b7160e01b600052601160045260246000fd5b92915050565b610b58806200030c6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a0712d6811610066578063a0712d68146101d0578063a457c2d7146101e3578063a9059cbb146101f6578063dd62ed3e1461020957600080fd5b806370a082311461018c57806379cc6790146101b557806395d89b41146101c857600080fd5b806323b872dd116100c857806323b872dd14610142578063313ce56714610155578063395093511461016457806342966c681461017757600080fd5b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f761021c565b6040516101049190610989565b60405180910390f35b61012061011b3660046109f3565b6102ae565b6040519015158152602001610104565b6002545b604051908152602001610104565b610120610150366004610a1d565b6102c8565b60405160128152602001610104565b6101206101723660046109f3565b6102ec565b61018a610185366004610a59565b61030e565b005b61013461019a366004610a72565b6001600160a01b031660009081526020819052604090205490565b61018a6101c33660046109f3565b61031b565b6100f7610334565b61018a6101de366004610a59565b610343565b6101206101f13660046109f3565b6103a9565b6101206102043660046109f3565b610424565b610134610217366004610a94565b610432565b60606003805461022b90610ac7565b80601f016020809104026020016040519081016040528092919081815260200182805461025790610ac7565b80156102a45780601f10610279576101008083540402835291602001916102a4565b820191906000526020600020905b81548152906001019060200180831161028757829003601f168201915b5050505050905090565b6000336102bc81858561045d565b60019150505b92915050565b6000336102d6858285610582565b6102e18585856105fc565b506001949350505050565b6000336102bc8185856102ff8383610432565b6103099190610b01565b61045d565b61031833826107a0565b50565b610326823383610582565b61033082826107a0565b5050565b60606004805461022b90610ac7565b662386f26fc1000081111561039f5760405162461bcd60e51b815260206004820152601f60248201527f4578616d706c6545524332303a206d6178206d696e742065786365656465640060448201526064015b60405180910390fd5b61031833826108ca565b600033816103b78286610432565b9050838110156104175760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610396565b6102e1828686840361045d565b6000336102bc8185856105fc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166104bf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610396565b6001600160a01b0382166105205760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610396565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b600061058e8484610432565b905060001981146105f657818110156105e95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610396565b6105f6848484840361045d565b50505050565b6001600160a01b0383166106605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610396565b6001600160a01b0382166106c25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610396565b6001600160a01b0383166000908152602081905260409020548181101561073a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610396565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36105f6565b6001600160a01b0382166108005760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610396565b6001600160a01b038216600090815260208190526040902054818110156108745760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610396565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610575565b6001600160a01b0382166109205760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610396565b80600260008282546109329190610b01565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b818110156109b65785810183015185820160400152820161099a565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146109ee57600080fd5b919050565b60008060408385031215610a0657600080fd5b610a0f836109d7565b946020939093013593505050565b600080600060608486031215610a3257600080fd5b610a3b846109d7565b9250610a49602085016109d7565b9150604084013590509250925092565b600060208284031215610a6b57600080fd5b5035919050565b600060208284031215610a8457600080fd5b610a8d826109d7565b9392505050565b60008060408385031215610aa757600080fd5b610ab0836109d7565b9150610abe602084016109d7565b90509250929050565b600181811c90821680610adb57607f821691505b602082108103610afb57634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102c257634e487b7160e01b600052601160045260246000fdfea2646970667358221220990a0b2c1220ff3d19514189157e3842e0fbd6e3ef73d29355b5f754dcf659a764736f6c63430008120033", } // ExampleERC20ABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go b/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go index d9475854a..aaa8be5d9 100644 --- a/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go +++ b/abi-bindings/go/Teleporter/TeleporterMessenger/TeleporterMessenger.go @@ -66,7 +66,7 @@ type TeleporterMessageReceipt struct { // TeleporterMessengerMetaData contains all meta data concerning the TeleporterMessenger contract. var TeleporterMessengerMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"updatedFeeInfo\",\"type\":\"tuple\"}],\"name\":\"AddFeeAmount\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"MessageExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageExecutionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"deliverer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"rewardRedeemer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"ReceiveCrossChainMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"redeemer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RelayerRewardsRedeemed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"indexed\":false,\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"name\":\"SendCrossChainMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"additionalFeeAmount\",\"type\":\"uint256\"}],\"name\":\"addFeeAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"checkRelayerRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getFeeInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getMessageHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"getNextMessageID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getReceiptAtIndex\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"getReceiptQueueSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"getRelayerRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"latestMessageIDs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"messageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID\",\"type\":\"bytes32\"}],\"name\":\"receiptQueues\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"first\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"last\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"name\":\"receiveCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"receivedFailedMessageHashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeAsset\",\"type\":\"address\"}],\"name\":\"redeemRelayerRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retryMessageExecution\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"receivedMessageID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"relayerRewardAddress\",\"type\":\"address\"}],\"internalType\":\"structTeleporterMessageReceipt[]\",\"name\":\"receipts\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"retrySendCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"requiredGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"internalType\":\"structTeleporterMessageInput\",\"name\":\"messageInput\",\"type\":\"tuple\"}],\"name\":\"sendCrossChainMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"messageIDs\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"},{\"internalType\":\"address[]\",\"name\":\"allowedRelayerAddresses\",\"type\":\"address[]\"}],\"name\":\"sendSpecifiedReceipts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"name\":\"sentMessageInfo\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"feeTokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"internalType\":\"structTeleporterFeeInfo\",\"name\":\"feeInfo\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50600160008190558055613051806100296000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063892bf412116100b8578063ccb5f8091161007c578063ccb5f80914610366578063d127dc9b14610379578063df20e8bc14610382578063e03555df14610395578063e6e67bd5146103b8578063fc2d6197146103f457600080fd5b8063892bf412146102c1578063af402850146102e1578063b771b3bc146102f4578063c473eef814610302578063c9bb11431461033b57600080fd5b80632bc8b0bf116100ff5780632bc8b0bf146101bd57806333e890fe146101d0578063624488501461021c57806366533d121461022f57806382f2c43a1461028f57600080fd5b8063191eb6981461013c57806319570c7414610162578063220c95681461017757806322296c3a1461018a57806329ec9beb1461019d575b600080fd5b61014f61014a3660046120cc565b610407565b6040519081526020015b60405180910390f35b61017561017036600461218c565b61062a565b005b61014f6101853660046121cb565b610865565b6101756101983660046121ed565b610886565b61014f6101ab36600461220a565b60036020526000908152604090205481565b61014f6101cb36600461220a565b61097b565b6102046101de3660046121cb565b60009182526007602090815260408084209284529190529020546001600160a01b031690565b6040516001600160a01b039091168152602001610159565b61014f61022a366004612223565b610992565b61028161023d3660046121cb565b60056020908152600092835260408084208252918352918190208054825180840190935260018201546001600160a01b031683526002909101549282019290925282565b60405161015992919061225d565b6102a261029d3660046121cb565b6109f0565b604080516001600160a01b039093168352602083019190915201610159565b6102d46102cf3660046121cb565b610a39565b6040516101599190612284565b6101756102ef3660046122a4565b610a6c565b6102046005600160991b0181565b61014f6103103660046122f2565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b61014f6103493660046121cb565b600660209081526000928352604080842090915290825290205481565b610175610374366004612320565b610c01565b61014f60025481565b61014f61039036600461220a565b611113565b6103a86103a33660046121cb565b61111e565b6040519015158152602001610159565b6103df6103c636600461220a565b6004602052600090815260409020805460019091015482565b60408051928352602083019190915201610159565b6101756104023660046122a4565b611148565b60006001600054146104345760405162461bcd60e51b815260040161042b90612347565b60405180910390fd5b60026000908155856001600160401b038111156104535761045361238a565b60405190808252806020026020018201604052801561049857816020015b60408051808201909152600080825260208201528152602001906001900390816104715790505b50905060005b868110156105955760008888838181106104ba576104ba6123a0565b60008d815260076020908152604080832093820295909501358083529290529290922054919250506001600160a01b0316806105475760405162461bcd60e51b815260206004820152602660248201527f54656c65706f727465724d657373656e6765723a2072656365697074206e6f7460448201526508199bdd5b9960d21b606482015260840161042b565b6040518060400160405280838152602001826001600160a01b0316815250848481518110610577576105776123a0565b602002602001018190525050508061058e906123cc565b905061049e565b506040805160c081018252898152600060208201526106199181016105bf368990038901896124bd565b815260200160008152602001868680806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040805192835260208084019091529092015250826113a2565b600160005598975050505050505050565b60016000541461064c5760405162461bcd60e51b815260040161042b90612347565b6002600055806106b65760405162461bcd60e51b815260206004820152602f60248201527f54656c65706f727465724d657373656e6765723a207a65726f2061646469746960448201526e1bdb985b0819995948185b5bdd5b9d608a1b606482015260840161042b565b6001600160a01b0382166106dc5760405162461bcd60e51b815260040161042b906124d9565b60008481526005602090815260408083208684529091529020546107125760405162461bcd60e51b815260040161042b9061252d565b60008481526005602090815260408083208684529091529020600101546001600160a01b038381169116146107af5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465724d657373656e6765723a20696e76616c69642066656560448201527f20617373657420636f6e74726163742061646472657373000000000000000000606482015260840161042b565b60006107bb83836115d4565b60008681526005602090815260408083208884529091528120600201805492935083929091906107ec908490612573565b90915550506000858152600560209081526040808320878452825291829020825160018201546001600160a01b0316815260029091015491810191909152859187917f28fe05eedf0479c9159e5b6dd2a28c93fa1a408eba22dc801fd9bc493a7fc0c2910160405180910390a350506001600055505050565b60008281526005602090815260408083208484529091529020545b92915050565b3360009081526008602090815260408083206001600160a01b0385168452909152902054806109085760405162461bcd60e51b815260206004820152602860248201527f54656c65706f727465724d657373656e6765723a206e6f2072657761726420746044820152676f2072656465656d60c01b606482015260840161042b565b3360008181526008602090815260408083206001600160a01b03871680855290835281842093909355518481529192917f3294c84e5b0f29d9803655319087207bc94f4db29f7927846944822773780b88910160405180910390a36109776001600160a01b038316338361173c565b5050565b6000818152600460205260408120610880906117a4565b60006001600054146109b65760405162461bcd60e51b815260040161042b90612347565b60026000556109e56109c783612695565b833560009081526004602052604090206109e0906117b7565b6113a2565b600160005592915050565b6000828152600560209081526040808320848452825291829020825180840190935260018101546001600160a01b031680845260029091015492909101829052905b9250929050565b60408051808201909152600080825260208201526000838152600460205260409020610a6590836118c6565b9392505050565b600160005414610a8e5760405162461bcd60e51b815260040161042b90612347565b60026000818155838152600560209081526040808320853584528252918290208251808401845281548152835180850190945260018201546001600160a01b03168452930154828201528201528051610af95760405162461bcd60e51b815260040161042b9061252d565b600082604051602001610b0c919061298d565b60408051601f1981840301815291905282518151602083012091925014610b455760405162461bcd60e51b815260040161042b906129a0565b8260000135847f0563d357b89128d5a0c37c9b06420836e35d193eaf17f7960fc88e47d1e02f57858560200151604051610b809291906129e9565b60405180910390a360405163ee5b48eb60e01b81526005600160991b019063ee5b48eb90610bb2908490600401612a6e565b6020604051808303816000875af1158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf59190612a81565b50506001600055505050565b6001805414610c225760405162461bcd60e51b815260040161042b90612a9a565b60026001556001600160a01b038116610c965760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465724d657373656e6765723a207a65726f2072656c61796560448201526f7220726577617264206164647265737360801b606482015260840161042b565b6040516306f8253560e41b815263ffffffff8316600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa158015610ce3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d0b9190810190612b3f565b9150915080610d6e5760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465724d657373656e6765723a20696e76616c69642077617260448201526870206d65737361676560b81b606482015260840161042b565b60208201516001600160a01b03163014610de55760405162461bcd60e51b815260206004820152603260248201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206f726960448201527167696e2073656e646572206164647265737360701b606482015260840161042b565b60025480610e5e576005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e569190612a81565b600281905590505b60008360400151806020019051810190610e789190612cdc565b905081816040015114610ee75760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206465736044820152701d1a5b985d1a5bdb8818da185a5b881251607a1b606482015260840161042b565b8351815160009182526007602090815260408084209284529190529020546001600160a01b031615610f725760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f727465724d657373656e6765723a206d65737361676520616c7260448201526d1958591e4819195b1a5d995c995960921b606482015260840161042b565b610f80338260a0015161198b565b610fde5760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465724d657373656e6765723a20756e617574686f72697a6560448201526832103932b630bcb2b960b91b606482015260840161042b565b8351600090815260076020908152604080832084518452909152902080546001600160a01b0319166001600160a01b03871617905560e0810151511561102a57835161102a9082611a00565b60c08101515160005b818110156110855760008360c001518281518110611053576110536123a0565b60200260200101519050611074876000015182600001518360200151611b2f565b5061107e816123cc565b9050611033565b5084516000908152600460209081526040918290208251808401909352845183526001600160a01b03891691830191909152906110c3908290611bff565b82518651604051339291907f6b013241f9192863bc66c1f1e9a01dc592c94592bfed5e1ed380808525679575906110fd908c908990612eec565b60405180910390a4505060018055505050505050565b600061088082611c5b565b60008281526007602090815260408083208484529091528120546001600160a01b03161515610a65565b60018054146111695760405162461bcd60e51b815260040161042b90612a9a565b6002600155600082815260066020908152604080832084358452909152902054806111a65760405162461bcd60e51b815260040161042b9061252d565b80826040516020016111b8919061298d565b60405160208183030381529060405280519060200120146111eb5760405162461bcd60e51b815260040161042b906129a0565b60006111fd60808401606085016121ed565b6001600160a01b03163b116112715760405162461bcd60e51b815260206004820152603460248201527f54656c65706f727465724d657373656e6765723a2064657374696e6174696f6e604482015273206164647265737320686173206e6f20636f646560601b606482015260840161042b565b60405182359084907f5ad362d54cba0e49d358be9ce586a7136d10a2533579c4460b7e48ec273083ef90600090a3600083815260066020908152604080832085358452825280832083905585916112cc9186019086016121ed565b6112d960e0860186612f10565b6040516024016112ec9493929190612f56565b60408051601f198184030181529190526020810180516001600160e01b031663643477d560e11b1790529050600061133461132d60808601606087016121ed565b5a84611c75565b9050806113975760405162461bcd60e51b815260206004820152602b60248201527f54656c65706f727465724d657373656e6765723a20726574727920657865637560448201526a1d1a5bdb8819985a5b195960aa1b606482015260840161042b565b505060018055505050565b6000806113b28460000151611c5b565b90506000604051806101000160405280838152602001336001600160a01b031681526020018660000151815260200186602001516001600160a01b0316815260200186606001518152602001866080015181526020018581526020018660a00151815250905060008160405160200161142b9190612f81565b60408051601f198184030181529181528751600090815260036020908152828220879055918901519091015191925090156114a5576040870151516001600160a01b031661148b5760405162461bcd60e51b815260040161042b906124d9565b604087015180516020909101516114a291906115d4565b90505b60408051808201825288820151516001600160a01b03908116825260208083018590528351808501855286518783012081528082018481528c516000908152600584528681208b82528452869020915182555180516001830180546001600160a01b031916919095161790935591015160029091015588519151909186917f0563d357b89128d5a0c37c9b06420836e35d193eaf17f7960fc88e47d1e02f57906115529088908690612f94565b60405180910390a360405163ee5b48eb60e01b81526005600160991b019063ee5b48eb90611584908690600401612a6e565b6020604051808303816000875af11580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c79190612a81565b5093979650505050505050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561161d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116419190612a81565b90506116586001600160a01b038516333086611c8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190612a81565b90508181116117295760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161042b565b6117338282612fa7565b95945050505050565b6040516001600160a01b03831660248201526044810182905261179f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cc7565b505050565b8054600182015460009161088091612fa7565b606060006117ce60056117c9856117a4565b611d99565b90508060000361181d576040805160008082526020820190925290611815565b60408051808201909152600080825260208201528152602001906001900390816117ee5790505b509392505050565b806001600160401b038111156118355761183561238a565b60405190808252806020026020018201604052801561187a57816020015b60408051808201909152600080825260208201528152602001906001900390816118535790505b50915060005b818110156118bf5761189184611daf565b8382815181106118a3576118a36123a0565b6020026020010181905250806118b8906123cc565b9050611880565b5050919050565b60408051808201909152600080825260208201526118e3836117a4565b821061193b5760405162461bcd60e51b815260206004820152602160248201527f5265636569707451756575653a20696e646578206f7574206f6620626f756e646044820152607360f81b606482015260840161042b565b8260020160008385600001546119519190612573565b81526020808201929092526040908101600020815180830190925280548252600101546001600160a01b0316918101919091529392505050565b6000815160000361199e57506001610880565b60005b82518110156119f657836001600160a01b03168382815181106119c6576119c66123a0565b60200260200101516001600160a01b0316036119e6576001915050610880565b6119ef816123cc565b90506119a1565b5060009392505050565b80608001515a1015611a625760405162461bcd60e51b815260206004820152602560248201527f54656c65706f727465724d657373656e6765723a20696e73756666696369656e604482015264742067617360d81b606482015260840161042b565b80606001516001600160a01b03163b600003611a82576109778282611e7a565b602081015160e0820151604051600092611aa0928692602401612fba565b60408051601f198184030181529190526020810180516001600160e01b031663643477d560e11b17905260608301516080840151919250600091611ae5919084611c75565b905080611afc57611af68484611e7a565b50505050565b825160405185907f5ad362d54cba0e49d358be9ce586a7136d10a2533579c4460b7e48ec273083ef90600090a350505050565b60008381526005602090815260408083208584528252918290208251808401845281548152835180850190945260018201546001600160a01b0316845260029091015483830152908101919091528051611b895750505050565b600084815260056020908152604080832086845282528083208381556001810180546001600160a01b031916905560020183905583820180518301516001600160a01b0387811686526008855283862092515116855292528220805491929091611bf4908490612573565b909155505050505050565b6001820180548291600285019160009182611c19836123cc565b90915550815260208082019290925260400160002082518155910151600190910180546001600160a01b0319166001600160a01b039092169190911790555050565b600081815260036020526040812054610880906001612573565b60008060008084516020860160008989f195945050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611af69085906323b872dd60e01b90608401611768565b6000611d1c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ef89092919063ffffffff16565b80519091501561179f5780806020019051810190611d3a9190612fe4565b61179f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161042b565b6000818310611da85781610a65565b5090919050565b604080518082019091526000808252602082015281546001830154819003611e195760405162461bcd60e51b815260206004820152601960248201527f5265636569707451756575653a20656d70747920717565756500000000000000604482015260640161042b565b60008181526002840160208181526040808420815180830190925280548252600180820180546001600160a01b03811685870152888852959094529490556001600160a01b031990921690559250611e72908290612573565b909255919050565b80604051602001611e8b9190612f81565b60408051601f198184030181528282528051602091820120600086815260068352838120865182529092529190205581519083907fbedbbe6103cef0a6c9ecbf6aa23da414542c42d7918bea18aab8b601b2c3a44990611eec908590612f81565b60405180910390a35050565b6060611f078484600085611f0f565b949350505050565b606082471015611f705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161042b565b600080866001600160a01b03168587604051611f8c9190612fff565b60006040518083038185875af1925050503d8060008114611fc9576040519150601f19603f3d011682016040523d82523d6000602084013e611fce565b606091505b5091509150611fdf87838387611fea565b979650505050505050565b60608315612059578251600003612052576001600160a01b0385163b6120525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161042b565b5081611f07565b611f07838381511561206e5781518083602001fd5b8060405162461bcd60e51b815260040161042b9190612a6e565b60008083601f84011261209a57600080fd5b5081356001600160401b038111156120b157600080fd5b6020830191508360208260051b8501011115610a3257600080fd5b60008060008060008086880360a08112156120e657600080fd5b8735965060208801356001600160401b038082111561210457600080fd5b6121108b838c01612088565b90985096508691506040603f198401121561212a57600080fd5b60408a01955060808a013592508083111561214457600080fd5b505061215289828a01612088565b979a9699509497509295939492505050565b6001600160a01b038116811461217957600080fd5b50565b803561218781612164565b919050565b600080600080608085870312156121a257600080fd5b843593506020850135925060408501356121bb81612164565b9396929550929360600135925050565b600080604083850312156121de57600080fd5b50508035926020909101359150565b6000602082840312156121ff57600080fd5b8135610a6581612164565b60006020828403121561221c57600080fd5b5035919050565b60006020828403121561223557600080fd5b81356001600160401b0381111561224b57600080fd5b820160e08185031215610a6557600080fd5b82815260608101610a65602083018480516001600160a01b03168252602090810151910152565b815181526020808301516001600160a01b03169082015260408101610880565b600080604083850312156122b757600080fd5b8235915060208301356001600160401b038111156122d457600080fd5b830161010081860312156122e757600080fd5b809150509250929050565b6000806040838503121561230557600080fd5b823561231081612164565b915060208301356122e781612164565b6000806040838503121561233357600080fd5b823563ffffffff8116811461231057600080fd5b60208082526023908201527f5265656e7472616e63794775617264733a2073656e646572207265656e7472616040820152626e637960e81b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016123de576123de6123b6565b5060010190565b604080519081016001600160401b03811182821017156124075761240761238a565b60405290565b60405160c081016001600160401b03811182821017156124075761240761238a565b60405161010081016001600160401b03811182821017156124075761240761238a565b604051601f8201601f191681016001600160401b038111828210171561247a5761247a61238a565b604052919050565b60006040828403121561249457600080fd5b61249c6123e5565b905081356124a981612164565b808252506020820135602082015292915050565b6000604082840312156124cf57600080fd5b610a658383612482565b60208082526034908201527f54656c65706f727465724d657373656e6765723a207a65726f2066656520617360408201527373657420636f6e7472616374206164647265737360601b606082015260800190565b60208082526026908201527f54656c65706f727465724d657373656e6765723a206d657373616765206e6f7460408201526508199bdd5b9960d21b606082015260800190565b80820180821115610880576108806123b6565b60006001600160401b0382111561259f5761259f61238a565b5060051b60200190565b600082601f8301126125ba57600080fd5b813560206125cf6125ca83612586565b612452565b82815260059290921b840181019181810190868411156125ee57600080fd5b8286015b8481101561261257803561260581612164565b83529183019183016125f2565b509695505050505050565b60006001600160401b038211156126365761263661238a565b50601f01601f191660200190565b600082601f83011261265557600080fd5b81356126636125ca8261261d565b81815284602083860101111561267857600080fd5b816020850160208301376000918101602001919091529392505050565b600060e082360312156126a757600080fd5b6126af61240d565b823581526126bf6020840161217c565b60208201526126d13660408501612482565b60408201526080830135606082015260a08301356001600160401b03808211156126fa57600080fd5b612706368387016125a9565b608084015260c085013591508082111561271f57600080fd5b5061272c36828601612644565b60a08301525092915050565b6000808335601e1984360301811261274f57600080fd5b83016020810192503590506001600160401b0381111561276e57600080fd5b8060051b3603821315610a3257600080fd5b8183526000602080850194508260005b858110156127be5781356127a381612164565b6001600160a01b031687529582019590820190600101612790565b509495945050505050565b6000808335601e198436030181126127e057600080fd5b83016020810192503590506001600160401b038111156127ff57600080fd5b8060061b3603821315610a3257600080fd5b8183526000602080850194508260005b858110156127be57813587528282013561283a81612164565b6001600160a01b0316878401526040968701969190910190600101612821565b6000808335601e1984360301811261287157600080fd5b83016020810192503590506001600160401b0381111561289057600080fd5b803603821315610a3257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006101008235845260208301356128df81612164565b6001600160a01b03166020850152604083810135908501526129036060840161217c565b6001600160a01b031660608501526080838101359085015261292860a0840184612738565b8260a087015261293b8387018284612780565b9250505061294c60c08401846127c9565b85830360c087015261295f838284612811565b9250505061297060e084018461285a565b85830360e087015261298383828461289f565b9695505050505050565b602081526000610a6560208301846128c8565b60208082526029908201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206d65736040820152680e6c2ceca40d0c2e6d60bb1b606082015260800190565b6060815260006129fc60608301856128c8565b9050610a65602083018480516001600160a01b03168252602090810151910152565b60005b83811015612a39578181015183820152602001612a21565b50506000910152565b60008151808452612a5a816020860160208601612a1e565b601f01601f19169290920160200192915050565b602081526000610a656020830184612a42565b600060208284031215612a9357600080fd5b5051919050565b60208082526025908201527f5265656e7472616e63794775617264733a207265636569766572207265656e7460408201526472616e637960d81b606082015260800190565b805161218781612164565b600082601f830112612afb57600080fd5b8151612b096125ca8261261d565b818152846020838601011115612b1e57600080fd5b611f07826020830160208701612a1e565b8051801515811461218757600080fd5b60008060408385031215612b5257600080fd5b82516001600160401b0380821115612b6957600080fd5b9084019060608287031215612b7d57600080fd5b604051606081018181108382111715612b9857612b9861238a565b604052825181526020830151612bad81612164565b6020820152604083015182811115612bc457600080fd5b612bd088828601612aea565b6040830152509350612be791505060208401612b2f565b90509250929050565b600082601f830112612c0157600080fd5b81516020612c116125ca83612586565b82815260059290921b84018101918181019086841115612c3057600080fd5b8286015b84811015612612578051612c4781612164565b8352918301918301612c34565b600082601f830112612c6557600080fd5b81516020612c756125ca83612586565b82815260069290921b84018101918181019086841115612c9457600080fd5b8286015b848110156126125760408189031215612cb15760008081fd5b612cb96123e5565b8151815284820151612cca81612164565b81860152835291830191604001612c98565b600060208284031215612cee57600080fd5b81516001600160401b0380821115612d0557600080fd5b908301906101008286031215612d1a57600080fd5b612d2261242f565b82518152612d3260208401612adf565b602082015260408301516040820152612d4d60608401612adf565b60608201526080830151608082015260a083015182811115612d6e57600080fd5b612d7a87828601612bf0565b60a08301525060c083015182811115612d9257600080fd5b612d9e87828601612c54565b60c08301525060e083015182811115612db657600080fd5b612dc287828601612aea565b60e08301525095945050505050565b600081518084526020808501945080840160005b838110156127be5781516001600160a01b031687529582019590820190600101612de5565b600081518084526020808501945080840160005b838110156127be57612e44878351805182526020908101516001600160a01b0316910152565b6040969096019590820190600101612e1e565b60006101008251845260018060a01b036020840151166020850152604083015160408501526060830151612e9660608601826001600160a01b03169052565b506080830151608085015260a08301518160a0860152612eb882860182612dd1565b91505060c083015184820360c0860152612ed28282612e0a565b91505060e083015184820360e08601526117338282612a42565b6001600160a01b0383168152604060208201819052600090611f0790830184612e57565b6000808335601e19843603018112612f2757600080fd5b8301803591506001600160401b03821115612f4157600080fd5b602001915036819003821315610a3257600080fd5b8481526001600160a01b0384166020820152606060408201819052600090612983908301848661289f565b602081526000610a656020830184612e57565b6060815260006129fc6060830185612e57565b81810381811115610880576108806123b6565b8381526001600160a01b038316602082015260606040820181905260009061173390830184612a42565b600060208284031215612ff657600080fd5b610a6582612b2f565b60008251613011818460208701612a1e565b919091019291505056fea26469706673582212201fa2681487b0d4676eb1bb553bd783424dbc4d2ceba0093810855ffd717d12c664736f6c63430008120033", + Bin: "0x608060405234801561001057600080fd5b50600160008190558055613051806100296000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063892bf412116100b8578063ccb5f8091161007c578063ccb5f80914610366578063d127dc9b14610379578063df20e8bc14610382578063e03555df14610395578063e6e67bd5146103b8578063fc2d6197146103f457600080fd5b8063892bf412146102c1578063af402850146102e1578063b771b3bc146102f4578063c473eef814610302578063c9bb11431461033b57600080fd5b80632bc8b0bf116100ff5780632bc8b0bf146101bd57806333e890fe146101d0578063624488501461021c57806366533d121461022f57806382f2c43a1461028f57600080fd5b8063191eb6981461013c57806319570c7414610162578063220c95681461017757806322296c3a1461018a57806329ec9beb1461019d575b600080fd5b61014f61014a3660046120cc565b610407565b6040519081526020015b60405180910390f35b61017561017036600461218c565b61062a565b005b61014f6101853660046121cb565b610865565b6101756101983660046121ed565b610886565b61014f6101ab36600461220a565b60036020526000908152604090205481565b61014f6101cb36600461220a565b61097b565b6102046101de3660046121cb565b60009182526007602090815260408084209284529190529020546001600160a01b031690565b6040516001600160a01b039091168152602001610159565b61014f61022a366004612223565b610992565b61028161023d3660046121cb565b60056020908152600092835260408084208252918352918190208054825180840190935260018201546001600160a01b031683526002909101549282019290925282565b60405161015992919061225d565b6102a261029d3660046121cb565b6109f0565b604080516001600160a01b039093168352602083019190915201610159565b6102d46102cf3660046121cb565b610a39565b6040516101599190612284565b6101756102ef3660046122a4565b610a6c565b6102046005600160991b0181565b61014f6103103660046122f2565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b61014f6103493660046121cb565b600660209081526000928352604080842090915290825290205481565b610175610374366004612320565b610c01565b61014f60025481565b61014f61039036600461220a565b611113565b6103a86103a33660046121cb565b61111e565b6040519015158152602001610159565b6103df6103c636600461220a565b6004602052600090815260409020805460019091015482565b60408051928352602083019190915201610159565b6101756104023660046122a4565b611148565b60006001600054146104345760405162461bcd60e51b815260040161042b90612347565b60405180910390fd5b60026000908155856001600160401b038111156104535761045361238a565b60405190808252806020026020018201604052801561049857816020015b60408051808201909152600080825260208201528152602001906001900390816104715790505b50905060005b868110156105955760008888838181106104ba576104ba6123a0565b60008d815260076020908152604080832093820295909501358083529290529290922054919250506001600160a01b0316806105475760405162461bcd60e51b815260206004820152602660248201527f54656c65706f727465724d657373656e6765723a2072656365697074206e6f7460448201526508199bdd5b9960d21b606482015260840161042b565b6040518060400160405280838152602001826001600160a01b0316815250848481518110610577576105776123a0565b602002602001018190525050508061058e906123cc565b905061049e565b506040805160c081018252898152600060208201526106199181016105bf368990038901896124bd565b815260200160008152602001868680806020026020016040519081016040528093929190818152602001838360200280828437600092018290525093855250506040805192835260208084019091529092015250826113a2565b600160005598975050505050505050565b60016000541461064c5760405162461bcd60e51b815260040161042b90612347565b6002600055806106b65760405162461bcd60e51b815260206004820152602f60248201527f54656c65706f727465724d657373656e6765723a207a65726f2061646469746960448201526e1bdb985b0819995948185b5bdd5b9d608a1b606482015260840161042b565b6001600160a01b0382166106dc5760405162461bcd60e51b815260040161042b906124d9565b60008481526005602090815260408083208684529091529020546107125760405162461bcd60e51b815260040161042b9061252d565b60008481526005602090815260408083208684529091529020600101546001600160a01b038381169116146107af5760405162461bcd60e51b815260206004820152603760248201527f54656c65706f727465724d657373656e6765723a20696e76616c69642066656560448201527f20617373657420636f6e74726163742061646472657373000000000000000000606482015260840161042b565b60006107bb83836115d4565b60008681526005602090815260408083208884529091528120600201805492935083929091906107ec908490612573565b90915550506000858152600560209081526040808320878452825291829020825160018201546001600160a01b0316815260029091015491810191909152859187917f28fe05eedf0479c9159e5b6dd2a28c93fa1a408eba22dc801fd9bc493a7fc0c2910160405180910390a350506001600055505050565b60008281526005602090815260408083208484529091529020545b92915050565b3360009081526008602090815260408083206001600160a01b0385168452909152902054806109085760405162461bcd60e51b815260206004820152602860248201527f54656c65706f727465724d657373656e6765723a206e6f2072657761726420746044820152676f2072656465656d60c01b606482015260840161042b565b3360008181526008602090815260408083206001600160a01b03871680855290835281842093909355518481529192917f3294c84e5b0f29d9803655319087207bc94f4db29f7927846944822773780b88910160405180910390a36109776001600160a01b038316338361173c565b5050565b6000818152600460205260408120610880906117a4565b60006001600054146109b65760405162461bcd60e51b815260040161042b90612347565b60026000556109e56109c783612695565b833560009081526004602052604090206109e0906117b7565b6113a2565b600160005592915050565b6000828152600560209081526040808320848452825291829020825180840190935260018101546001600160a01b031680845260029091015492909101829052905b9250929050565b60408051808201909152600080825260208201526000838152600460205260409020610a6590836118c6565b9392505050565b600160005414610a8e5760405162461bcd60e51b815260040161042b90612347565b60026000818155838152600560209081526040808320853584528252918290208251808401845281548152835180850190945260018201546001600160a01b03168452930154828201528201528051610af95760405162461bcd60e51b815260040161042b9061252d565b600082604051602001610b0c919061298d565b60408051601f1981840301815291905282518151602083012091925014610b455760405162461bcd60e51b815260040161042b906129a0565b8260000135847f0563d357b89128d5a0c37c9b06420836e35d193eaf17f7960fc88e47d1e02f57858560200151604051610b809291906129e9565b60405180910390a360405163ee5b48eb60e01b81526005600160991b019063ee5b48eb90610bb2908490600401612a6e565b6020604051808303816000875af1158015610bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf59190612a81565b50506001600055505050565b6001805414610c225760405162461bcd60e51b815260040161042b90612a9a565b60026001556001600160a01b038116610c965760405162461bcd60e51b815260206004820152603060248201527f54656c65706f727465724d657373656e6765723a207a65726f2072656c61796560448201526f7220726577617264206164647265737360801b606482015260840161042b565b6040516306f8253560e41b815263ffffffff8316600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa158015610ce3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d0b9190810190612b3f565b9150915080610d6e5760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465724d657373656e6765723a20696e76616c69642077617260448201526870206d65737361676560b81b606482015260840161042b565b60208201516001600160a01b03163014610de55760405162461bcd60e51b815260206004820152603260248201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206f726960448201527167696e2073656e646572206164647265737360701b606482015260840161042b565b60025480610e5e576005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e569190612a81565b600281905590505b60008360400151806020019051810190610e789190612cdc565b905081816040015114610ee75760405162461bcd60e51b815260206004820152603160248201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206465736044820152701d1a5b985d1a5bdb8818da185a5b881251607a1b606482015260840161042b565b8351815160009182526007602090815260408084209284529190529020546001600160a01b031615610f725760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f727465724d657373656e6765723a206d65737361676520616c7260448201526d1958591e4819195b1a5d995c995960921b606482015260840161042b565b610f80338260a0015161198b565b610fde5760405162461bcd60e51b815260206004820152602960248201527f54656c65706f727465724d657373656e6765723a20756e617574686f72697a6560448201526832103932b630bcb2b960b91b606482015260840161042b565b8351600090815260076020908152604080832084518452909152902080546001600160a01b0319166001600160a01b03871617905560e0810151511561102a57835161102a9082611a00565b60c08101515160005b818110156110855760008360c001518281518110611053576110536123a0565b60200260200101519050611074876000015182600001518360200151611b2f565b5061107e816123cc565b9050611033565b5084516000908152600460209081526040918290208251808401909352845183526001600160a01b03891691830191909152906110c3908290611bff565b82518651604051339291907f6b013241f9192863bc66c1f1e9a01dc592c94592bfed5e1ed380808525679575906110fd908c908990612eec565b60405180910390a4505060018055505050505050565b600061088082611c5b565b60008281526007602090815260408083208484529091528120546001600160a01b03161515610a65565b60018054146111695760405162461bcd60e51b815260040161042b90612a9a565b6002600155600082815260066020908152604080832084358452909152902054806111a65760405162461bcd60e51b815260040161042b9061252d565b80826040516020016111b8919061298d565b60405160208183030381529060405280519060200120146111eb5760405162461bcd60e51b815260040161042b906129a0565b60006111fd60808401606085016121ed565b6001600160a01b03163b116112715760405162461bcd60e51b815260206004820152603460248201527f54656c65706f727465724d657373656e6765723a2064657374696e6174696f6e604482015273206164647265737320686173206e6f20636f646560601b606482015260840161042b565b60405182359084907f5ad362d54cba0e49d358be9ce586a7136d10a2533579c4460b7e48ec273083ef90600090a3600083815260066020908152604080832085358452825280832083905585916112cc9186019086016121ed565b6112d960e0860186612f10565b6040516024016112ec9493929190612f56565b60408051601f198184030181529190526020810180516001600160e01b031663643477d560e11b1790529050600061133461132d60808601606087016121ed565b5a84611c75565b9050806113975760405162461bcd60e51b815260206004820152602b60248201527f54656c65706f727465724d657373656e6765723a20726574727920657865637560448201526a1d1a5bdb8819985a5b195960aa1b606482015260840161042b565b505060018055505050565b6000806113b28460000151611c5b565b90506000604051806101000160405280838152602001336001600160a01b031681526020018660000151815260200186602001516001600160a01b0316815260200186606001518152602001866080015181526020018581526020018660a00151815250905060008160405160200161142b9190612f81565b60408051601f198184030181529181528751600090815260036020908152828220879055918901519091015191925090156114a5576040870151516001600160a01b031661148b5760405162461bcd60e51b815260040161042b906124d9565b604087015180516020909101516114a291906115d4565b90505b60408051808201825288820151516001600160a01b03908116825260208083018590528351808501855286518783012081528082018481528c516000908152600584528681208b82528452869020915182555180516001830180546001600160a01b031916919095161790935591015160029091015588519151909186917f0563d357b89128d5a0c37c9b06420836e35d193eaf17f7960fc88e47d1e02f57906115529088908690612f94565b60405180910390a360405163ee5b48eb60e01b81526005600160991b019063ee5b48eb90611584908690600401612a6e565b6020604051808303816000875af11580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c79190612a81565b5093979650505050505050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa15801561161d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116419190612a81565b90506116586001600160a01b038516333086611c8f565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa15801561169f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190612a81565b90508181116117295760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b606482015260840161042b565b6117338282612fa7565b95945050505050565b6040516001600160a01b03831660248201526044810182905261179f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611cc7565b505050565b8054600182015460009161088091612fa7565b606060006117ce60056117c9856117a4565b611d99565b90508060000361181d576040805160008082526020820190925290611815565b60408051808201909152600080825260208201528152602001906001900390816117ee5790505b509392505050565b806001600160401b038111156118355761183561238a565b60405190808252806020026020018201604052801561187a57816020015b60408051808201909152600080825260208201528152602001906001900390816118535790505b50915060005b818110156118bf5761189184611daf565b8382815181106118a3576118a36123a0565b6020026020010181905250806118b8906123cc565b9050611880565b5050919050565b60408051808201909152600080825260208201526118e3836117a4565b821061193b5760405162461bcd60e51b815260206004820152602160248201527f5265636569707451756575653a20696e646578206f7574206f6620626f756e646044820152607360f81b606482015260840161042b565b8260020160008385600001546119519190612573565b81526020808201929092526040908101600020815180830190925280548252600101546001600160a01b0316918101919091529392505050565b6000815160000361199e57506001610880565b60005b82518110156119f657836001600160a01b03168382815181106119c6576119c66123a0565b60200260200101516001600160a01b0316036119e6576001915050610880565b6119ef816123cc565b90506119a1565b5060009392505050565b80608001515a1015611a625760405162461bcd60e51b815260206004820152602560248201527f54656c65706f727465724d657373656e6765723a20696e73756666696369656e604482015264742067617360d81b606482015260840161042b565b80606001516001600160a01b03163b600003611a82576109778282611e7a565b602081015160e0820151604051600092611aa0928692602401612fba565b60408051601f198184030181529190526020810180516001600160e01b031663643477d560e11b17905260608301516080840151919250600091611ae5919084611c75565b905080611afc57611af68484611e7a565b50505050565b825160405185907f5ad362d54cba0e49d358be9ce586a7136d10a2533579c4460b7e48ec273083ef90600090a350505050565b60008381526005602090815260408083208584528252918290208251808401845281548152835180850190945260018201546001600160a01b0316845260029091015483830152908101919091528051611b895750505050565b600084815260056020908152604080832086845282528083208381556001810180546001600160a01b031916905560020183905583820180518301516001600160a01b0387811686526008855283862092515116855292528220805491929091611bf4908490612573565b909155505050505050565b6001820180548291600285019160009182611c19836123cc565b90915550815260208082019290925260400160002082518155910151600190910180546001600160a01b0319166001600160a01b039092169190911790555050565b600081815260036020526040812054610880906001612573565b60008060008084516020860160008989f195945050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611af69085906323b872dd60e01b90608401611768565b6000611d1c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ef89092919063ffffffff16565b80519091501561179f5780806020019051810190611d3a9190612fe4565b61179f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161042b565b6000818310611da85781610a65565b5090919050565b604080518082019091526000808252602082015281546001830154819003611e195760405162461bcd60e51b815260206004820152601960248201527f5265636569707451756575653a20656d70747920717565756500000000000000604482015260640161042b565b60008181526002840160208181526040808420815180830190925280548252600180820180546001600160a01b03811685870152888852959094529490556001600160a01b031990921690559250611e72908290612573565b909255919050565b80604051602001611e8b9190612f81565b60408051601f198184030181528282528051602091820120600086815260068352838120865182529092529190205581519083907fbedbbe6103cef0a6c9ecbf6aa23da414542c42d7918bea18aab8b601b2c3a44990611eec908590612f81565b60405180910390a35050565b6060611f078484600085611f0f565b949350505050565b606082471015611f705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161042b565b600080866001600160a01b03168587604051611f8c9190612fff565b60006040518083038185875af1925050503d8060008114611fc9576040519150601f19603f3d011682016040523d82523d6000602084013e611fce565b606091505b5091509150611fdf87838387611fea565b979650505050505050565b60608315612059578251600003612052576001600160a01b0385163b6120525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161042b565b5081611f07565b611f07838381511561206e5781518083602001fd5b8060405162461bcd60e51b815260040161042b9190612a6e565b60008083601f84011261209a57600080fd5b5081356001600160401b038111156120b157600080fd5b6020830191508360208260051b8501011115610a3257600080fd5b60008060008060008086880360a08112156120e657600080fd5b8735965060208801356001600160401b038082111561210457600080fd5b6121108b838c01612088565b90985096508691506040603f198401121561212a57600080fd5b60408a01955060808a013592508083111561214457600080fd5b505061215289828a01612088565b979a9699509497509295939492505050565b6001600160a01b038116811461217957600080fd5b50565b803561218781612164565b919050565b600080600080608085870312156121a257600080fd5b843593506020850135925060408501356121bb81612164565b9396929550929360600135925050565b600080604083850312156121de57600080fd5b50508035926020909101359150565b6000602082840312156121ff57600080fd5b8135610a6581612164565b60006020828403121561221c57600080fd5b5035919050565b60006020828403121561223557600080fd5b81356001600160401b0381111561224b57600080fd5b820160e08185031215610a6557600080fd5b82815260608101610a65602083018480516001600160a01b03168252602090810151910152565b815181526020808301516001600160a01b03169082015260408101610880565b600080604083850312156122b757600080fd5b8235915060208301356001600160401b038111156122d457600080fd5b830161010081860312156122e757600080fd5b809150509250929050565b6000806040838503121561230557600080fd5b823561231081612164565b915060208301356122e781612164565b6000806040838503121561233357600080fd5b823563ffffffff8116811461231057600080fd5b60208082526023908201527f5265656e7472616e63794775617264733a2073656e646572207265656e7472616040820152626e637960e81b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016123de576123de6123b6565b5060010190565b604080519081016001600160401b03811182821017156124075761240761238a565b60405290565b60405160c081016001600160401b03811182821017156124075761240761238a565b60405161010081016001600160401b03811182821017156124075761240761238a565b604051601f8201601f191681016001600160401b038111828210171561247a5761247a61238a565b604052919050565b60006040828403121561249457600080fd5b61249c6123e5565b905081356124a981612164565b808252506020820135602082015292915050565b6000604082840312156124cf57600080fd5b610a658383612482565b60208082526034908201527f54656c65706f727465724d657373656e6765723a207a65726f2066656520617360408201527373657420636f6e7472616374206164647265737360601b606082015260800190565b60208082526026908201527f54656c65706f727465724d657373656e6765723a206d657373616765206e6f7460408201526508199bdd5b9960d21b606082015260800190565b80820180821115610880576108806123b6565b60006001600160401b0382111561259f5761259f61238a565b5060051b60200190565b600082601f8301126125ba57600080fd5b813560206125cf6125ca83612586565b612452565b82815260059290921b840181019181810190868411156125ee57600080fd5b8286015b8481101561261257803561260581612164565b83529183019183016125f2565b509695505050505050565b60006001600160401b038211156126365761263661238a565b50601f01601f191660200190565b600082601f83011261265557600080fd5b81356126636125ca8261261d565b81815284602083860101111561267857600080fd5b816020850160208301376000918101602001919091529392505050565b600060e082360312156126a757600080fd5b6126af61240d565b823581526126bf6020840161217c565b60208201526126d13660408501612482565b60408201526080830135606082015260a08301356001600160401b03808211156126fa57600080fd5b612706368387016125a9565b608084015260c085013591508082111561271f57600080fd5b5061272c36828601612644565b60a08301525092915050565b6000808335601e1984360301811261274f57600080fd5b83016020810192503590506001600160401b0381111561276e57600080fd5b8060051b3603821315610a3257600080fd5b8183526000602080850194508260005b858110156127be5781356127a381612164565b6001600160a01b031687529582019590820190600101612790565b509495945050505050565b6000808335601e198436030181126127e057600080fd5b83016020810192503590506001600160401b038111156127ff57600080fd5b8060061b3603821315610a3257600080fd5b8183526000602080850194508260005b858110156127be57813587528282013561283a81612164565b6001600160a01b0316878401526040968701969190910190600101612821565b6000808335601e1984360301811261287157600080fd5b83016020810192503590506001600160401b0381111561289057600080fd5b803603821315610a3257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006101008235845260208301356128df81612164565b6001600160a01b03166020850152604083810135908501526129036060840161217c565b6001600160a01b031660608501526080838101359085015261292860a0840184612738565b8260a087015261293b8387018284612780565b9250505061294c60c08401846127c9565b85830360c087015261295f838284612811565b9250505061297060e084018461285a565b85830360e087015261298383828461289f565b9695505050505050565b602081526000610a6560208301846128c8565b60208082526029908201527f54656c65706f727465724d657373656e6765723a20696e76616c6964206d65736040820152680e6c2ceca40d0c2e6d60bb1b606082015260800190565b6060815260006129fc60608301856128c8565b9050610a65602083018480516001600160a01b03168252602090810151910152565b60005b83811015612a39578181015183820152602001612a21565b50506000910152565b60008151808452612a5a816020860160208601612a1e565b601f01601f19169290920160200192915050565b602081526000610a656020830184612a42565b600060208284031215612a9357600080fd5b5051919050565b60208082526025908201527f5265656e7472616e63794775617264733a207265636569766572207265656e7460408201526472616e637960d81b606082015260800190565b805161218781612164565b600082601f830112612afb57600080fd5b8151612b096125ca8261261d565b818152846020838601011115612b1e57600080fd5b611f07826020830160208701612a1e565b8051801515811461218757600080fd5b60008060408385031215612b5257600080fd5b82516001600160401b0380821115612b6957600080fd5b9084019060608287031215612b7d57600080fd5b604051606081018181108382111715612b9857612b9861238a565b604052825181526020830151612bad81612164565b6020820152604083015182811115612bc457600080fd5b612bd088828601612aea565b6040830152509350612be791505060208401612b2f565b90509250929050565b600082601f830112612c0157600080fd5b81516020612c116125ca83612586565b82815260059290921b84018101918181019086841115612c3057600080fd5b8286015b84811015612612578051612c4781612164565b8352918301918301612c34565b600082601f830112612c6557600080fd5b81516020612c756125ca83612586565b82815260069290921b84018101918181019086841115612c9457600080fd5b8286015b848110156126125760408189031215612cb15760008081fd5b612cb96123e5565b8151815284820151612cca81612164565b81860152835291830191604001612c98565b600060208284031215612cee57600080fd5b81516001600160401b0380821115612d0557600080fd5b908301906101008286031215612d1a57600080fd5b612d2261242f565b82518152612d3260208401612adf565b602082015260408301516040820152612d4d60608401612adf565b60608201526080830151608082015260a083015182811115612d6e57600080fd5b612d7a87828601612bf0565b60a08301525060c083015182811115612d9257600080fd5b612d9e87828601612c54565b60c08301525060e083015182811115612db657600080fd5b612dc287828601612aea565b60e08301525095945050505050565b600081518084526020808501945080840160005b838110156127be5781516001600160a01b031687529582019590820190600101612de5565b600081518084526020808501945080840160005b838110156127be57612e44878351805182526020908101516001600160a01b0316910152565b6040969096019590820190600101612e1e565b60006101008251845260018060a01b036020840151166020850152604083015160408501526060830151612e9660608601826001600160a01b03169052565b506080830151608085015260a08301518160a0860152612eb882860182612dd1565b91505060c083015184820360c0860152612ed28282612e0a565b91505060e083015184820360e08601526117338282612a42565b6001600160a01b0383168152604060208201819052600090611f0790830184612e57565b6000808335601e19843603018112612f2757600080fd5b8301803591506001600160401b03821115612f4157600080fd5b602001915036819003821315610a3257600080fd5b8481526001600160a01b0384166020820152606060408201819052600090612983908301848661289f565b602081526000610a656020830184612e57565b6060815260006129fc6060830185612e57565b81810381811115610880576108806123b6565b8381526001600160a01b038316602082015260606040820181905260009061173390830184612a42565b600060208284031215612ff657600080fd5b610a6582612b2f565b60008251613011818460208701612a1e565b919091019291505056fea2646970667358221220dd55e7925adb52ee310201f60f2f40104b1f4a2d79111d6c886ee5bd10ea344364736f6c63430008120033", } // TeleporterMessengerABI is the input ABI used to generate the binding from. diff --git a/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go b/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go index ed31c15ad..880712154 100644 --- a/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go +++ b/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go @@ -38,7 +38,7 @@ type ProtocolRegistryEntry struct { // TeleporterRegistryMetaData contains all meta data concerning the TeleporterRegistry contract. var TeleporterRegistryMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"protocolAddress\",\"type\":\"address\"}],\"internalType\":\"structProtocolRegistryEntry[]\",\"name\":\"initialEntries\",\"type\":\"tuple[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"protocolAddress\",\"type\":\"address\"}],\"name\":\"AddProtocolVersion\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"oldVersion\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newVersion\",\"type\":\"uint256\"}],\"name\":\"LatestVersionUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_VERSION_INCREMENT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATORS_SOURCE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"addProtocolVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"blockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"getAddressFromVersion\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestTeleporter\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"getTeleporterFromVersion\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"protocolAddress\",\"type\":\"address\"}],\"name\":\"getVersionFromAddress\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60a06040523480156200001157600080fd5b50604051620010a5380380620010a5833981016040819052620000349162000423565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000087573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ad919062000515565b60805260005b8151811015620000ff57620000ea828281518110620000d657620000d66200052f565b60200260200101516200010760201b60201c565b80620000f6816200055b565b915050620000b3565b505062000593565b80516000036200015e5760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e60448201526064015b60405180910390fd5b80516000908152600160205260409020546001600160a01b031615620001da5760405162461bcd60e51b815260206004820152602a60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20616c72656044820152696164792065786973747360b01b606482015260840162000155565b60208101516001600160a01b0316620002485760405162461bcd60e51b815260206004820152602960248201527f54656c65706f7274657252656769737472793a207a65726f2070726f746f636f6044820152686c206164647265737360b81b606482015260840162000155565b6101f46000546200025a919062000577565b81511115620002c35760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20696e637260448201526d0cadacadce840e8dede40d0d2ced60931b606482015260840162000155565b602081810180518351600090815260018452604080822080546001600160a01b0319166001600160a01b03948516179055925190911681526002909252902054815111156200032d5780516020808301516001600160a01b03166000908152600290915260409020555b602081015181516040516001600160a01b03909216917fa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a90600090a360005481511115620003ac576000805482518083556040519192909183917f30623e953733f6474dabdfbef1103ce15ab73cdc77c6dfad0f9874d167e8a9b091a3505b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715620003ea57620003ea620003af565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200041b576200041b620003af565b604052919050565b600060208083850312156200043757600080fd5b82516001600160401b03808211156200044f57600080fd5b818501915085601f8301126200046457600080fd5b815181811115620004795762000479620003af565b62000489848260051b01620003f0565b818152848101925060069190911b830184019087821115620004aa57600080fd5b928401925b818410156200050a5760408489031215620004ca5760008081fd5b620004d4620003c5565b84518152858501516001600160a01b0381168114620004f35760008081fd5b8187015283526040939093019291840191620004af565b979650505050505050565b6000602082840312156200052857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000570576200057062000545565b5060010190565b808201808211156200058d576200058d62000545565b92915050565b608051610aef620005b66000396000818161014901526102640152610aef6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063ac473ac311610066578063ac473ac314610124578063b771b3bc1461012d578063c07f47d41461013b578063d127dc9b14610144578063d820e64f1461016b57600080fd5b80630731775d146100a3578063215abce9146100c857806341f34ed9146100db57806346f9ef49146100f05780634c1f08ce14610103575b600080fd5b6100ab600081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ab6100d63660046107ce565b610173565b6100ee6100e93660046107e7565b610184565b005b6100ab6100fe3660046107ce565b6103f9565b610116610111366004610829565b6104be565b6040519081526020016100bf565b6101166101f481565b6100ab6005600160991b0181565b61011660005481565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6100ab610566565b600061017e826103f9565b92915050565b6040516306f8253560e41b815263ffffffff8216600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa1580156101d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101f991908101906108cb565b91509150806102605760405162461bcd60e51b815260206004820152602860248201527f54656c65706f7274657252656769737472793a20696e76616c69642077617270604482015267206d65737361676560c01b60648201526084015b60405180910390fd5b81517f0000000000000000000000000000000000000000000000000000000000000000146102e45760405162461bcd60e51b815260206004820152602b60248201527f54656c65706f7274657252656769737472793a20696e76616c696420736f757260448201526a18d94818da185a5b88125160aa1b6064820152608401610257565b60208201516001600160a01b0316156103595760405162461bcd60e51b815260206004820152603160248201527f54656c65706f7274657252656769737472793a20696e76616c6964206f726967604482015270696e2073656e646572206164647265737360781b6064820152608401610257565b600080836040015180602001905181019061037491906109d3565b90925090506001600160a01b03811630146103e95760405162461bcd60e51b815260206004820152602f60248201527f54656c65706f7274657252656769737472793a20696e76616c6964206465737460448201526e696e6174696f6e206164647265737360881b6064820152608401610257565b6103f282610578565b5050505050565b60008160000361044b5760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e6044820152606401610257565b6000828152600160205260409020546001600160a01b03168061017e5760405162461bcd60e51b815260206004820152602560248201527f54656c65706f7274657252656769737472793a2076657273696f6e206e6f7420604482015264199bdd5b9960da1b6064820152608401610257565b60006001600160a01b0382166104e65760405162461bcd60e51b815260040161025790610a4f565b6001600160a01b0382166000908152600260205260408120549081900361017e5760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2070726f746f636f6c2061646460448201526d1c995cdcc81b9bdd08199bdd5b9960921b6064820152608401610257565b60006105736000546103f9565b905090565b80516000036105c95760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e6044820152606401610257565b80516000908152600160205260409020546001600160a01b0316156106435760405162461bcd60e51b815260206004820152602a60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20616c72656044820152696164792065786973747360b01b6064820152608401610257565b60208101516001600160a01b031661066d5760405162461bcd60e51b815260040161025790610a4f565b6101f460005461067d9190610a98565b815111156106e45760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20696e637260448201526d0cadacadce840e8dede40d0d2ced60931b6064820152608401610257565b602081810180518351600090815260018452604080822080546001600160a01b0319166001600160a01b039485161790559251909116815260029092529020548151111561074d5780516020808301516001600160a01b03166000908152600290915260409020555b602081015181516040516001600160a01b03909216917fa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a90600090a3600054815111156107cb576000805482518083556040519192909183917f30623e953733f6474dabdfbef1103ce15ab73cdc77c6dfad0f9874d167e8a9b091a3505b50565b6000602082840312156107e057600080fd5b5035919050565b6000602082840312156107f957600080fd5b813563ffffffff8116811461080d57600080fd5b9392505050565b6001600160a01b03811681146107cb57600080fd5b60006020828403121561083b57600080fd5b813561080d81610814565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561087f5761087f610846565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156108ae576108ae610846565b604052919050565b805180151581146108c657600080fd5b919050565b600080604083850312156108de57600080fd5b825167ffffffffffffffff808211156108f657600080fd5b908401906060828703121561090a57600080fd5b61091261085c565b8251815260208084015161092581610814565b8282015260408401518381111561093b57600080fd5b80850194505087601f85011261095057600080fd5b83518381111561096257610962610846565b610974601f8201601f19168301610885565b9350808452888282870101111561098a57600080fd5b60005b818110156109a857858101830151858201840152820161098d565b506000828286010152508260408301528195506109c68188016108b6565b9450505050509250929050565b60008082840360608112156109e757600080fd5b60408112156109f557600080fd5b506040516040810181811067ffffffffffffffff82111715610a1957610a19610846565b604052835181526020840151610a2e81610814565b60208201526040840151909250610a4481610814565b809150509250929050565b60208082526029908201527f54656c65706f7274657252656769737472793a207a65726f2070726f746f636f6040820152686c206164647265737360b81b606082015260800190565b8082018082111561017e57634e487b7160e01b600052601160045260246000fdfea264697066735822122042e323b6502c2858b7b6b9412cce846046592fe79ccd11fd951e3ccc7aa5306264736f6c63430008120033", + Bin: "0x60a06040523480156200001157600080fd5b50604051620010a5380380620010a5833981016040819052620000349162000423565b7302000000000000000000000000000000000000056001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000087573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ad919062000515565b60805260005b8151811015620000ff57620000ea828281518110620000d657620000d66200052f565b60200260200101516200010760201b60201c565b80620000f6816200055b565b915050620000b3565b505062000593565b80516000036200015e5760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e60448201526064015b60405180910390fd5b80516000908152600160205260409020546001600160a01b031615620001da5760405162461bcd60e51b815260206004820152602a60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20616c72656044820152696164792065786973747360b01b606482015260840162000155565b60208101516001600160a01b0316620002485760405162461bcd60e51b815260206004820152602960248201527f54656c65706f7274657252656769737472793a207a65726f2070726f746f636f6044820152686c206164647265737360b81b606482015260840162000155565b6101f46000546200025a919062000577565b81511115620002c35760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20696e637260448201526d0cadacadce840e8dede40d0d2ced60931b606482015260840162000155565b602081810180518351600090815260018452604080822080546001600160a01b0319166001600160a01b03948516179055925190911681526002909252902054815111156200032d5780516020808301516001600160a01b03166000908152600290915260409020555b602081015181516040516001600160a01b03909216917fa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a90600090a360005481511115620003ac576000805482518083556040519192909183917f30623e953733f6474dabdfbef1103ce15ab73cdc77c6dfad0f9874d167e8a9b091a3505b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715620003ea57620003ea620003af565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200041b576200041b620003af565b604052919050565b600060208083850312156200043757600080fd5b82516001600160401b03808211156200044f57600080fd5b818501915085601f8301126200046457600080fd5b815181811115620004795762000479620003af565b62000489848260051b01620003f0565b818152848101925060069190911b830184019087821115620004aa57600080fd5b928401925b818410156200050a5760408489031215620004ca5760008081fd5b620004d4620003c5565b84518152858501516001600160a01b0381168114620004f35760008081fd5b8187015283526040939093019291840191620004af565b979650505050505050565b6000602082840312156200052857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000570576200057062000545565b5060010190565b808201808211156200058d576200058d62000545565b92915050565b608051610aef620005b66000396000818161014901526102640152610aef6000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063ac473ac311610066578063ac473ac314610124578063b771b3bc1461012d578063c07f47d41461013b578063d127dc9b14610144578063d820e64f1461016b57600080fd5b80630731775d146100a3578063215abce9146100c857806341f34ed9146100db57806346f9ef49146100f05780634c1f08ce14610103575b600080fd5b6100ab600081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ab6100d63660046107ce565b610173565b6100ee6100e93660046107e7565b610184565b005b6100ab6100fe3660046107ce565b6103f9565b610116610111366004610829565b6104be565b6040519081526020016100bf565b6101166101f481565b6100ab6005600160991b0181565b61011660005481565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6100ab610566565b600061017e826103f9565b92915050565b6040516306f8253560e41b815263ffffffff8216600482015260009081906005600160991b0190636f82535090602401600060405180830381865afa1580156101d1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526101f991908101906108cb565b91509150806102605760405162461bcd60e51b815260206004820152602860248201527f54656c65706f7274657252656769737472793a20696e76616c69642077617270604482015267206d65737361676560c01b60648201526084015b60405180910390fd5b81517f0000000000000000000000000000000000000000000000000000000000000000146102e45760405162461bcd60e51b815260206004820152602b60248201527f54656c65706f7274657252656769737472793a20696e76616c696420736f757260448201526a18d94818da185a5b88125160aa1b6064820152608401610257565b60208201516001600160a01b0316156103595760405162461bcd60e51b815260206004820152603160248201527f54656c65706f7274657252656769737472793a20696e76616c6964206f726967604482015270696e2073656e646572206164647265737360781b6064820152608401610257565b600080836040015180602001905181019061037491906109d3565b90925090506001600160a01b03811630146103e95760405162461bcd60e51b815260206004820152602f60248201527f54656c65706f7274657252656769737472793a20696e76616c6964206465737460448201526e696e6174696f6e206164647265737360881b6064820152608401610257565b6103f282610578565b5050505050565b60008160000361044b5760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e6044820152606401610257565b6000828152600160205260409020546001600160a01b03168061017e5760405162461bcd60e51b815260206004820152602560248201527f54656c65706f7274657252656769737472793a2076657273696f6e206e6f7420604482015264199bdd5b9960da1b6064820152608401610257565b60006001600160a01b0382166104e65760405162461bcd60e51b815260040161025790610a4f565b6001600160a01b0382166000908152600260205260408120549081900361017e5760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2070726f746f636f6c2061646460448201526d1c995cdcc81b9bdd08199bdd5b9960921b6064820152608401610257565b60006105736000546103f9565b905090565b80516000036105c95760405162461bcd60e51b815260206004820181905260248201527f54656c65706f7274657252656769737472793a207a65726f2076657273696f6e6044820152606401610257565b80516000908152600160205260409020546001600160a01b0316156106435760405162461bcd60e51b815260206004820152602a60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20616c72656044820152696164792065786973747360b01b6064820152608401610257565b60208101516001600160a01b031661066d5760405162461bcd60e51b815260040161025790610a4f565b6101f460005461067d9190610a98565b815111156106e45760405162461bcd60e51b815260206004820152602e60248201527f54656c65706f7274657252656769737472793a2076657273696f6e20696e637260448201526d0cadacadce840e8dede40d0d2ced60931b6064820152608401610257565b602081810180518351600090815260018452604080822080546001600160a01b0319166001600160a01b039485161790559251909116815260029092529020548151111561074d5780516020808301516001600160a01b03166000908152600290915260409020555b602081015181516040516001600160a01b03909216917fa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a90600090a3600054815111156107cb576000805482518083556040519192909183917f30623e953733f6474dabdfbef1103ce15ab73cdc77c6dfad0f9874d167e8a9b091a3505b50565b6000602082840312156107e057600080fd5b5035919050565b6000602082840312156107f957600080fd5b813563ffffffff8116811461080d57600080fd5b9392505050565b6001600160a01b03811681146107cb57600080fd5b60006020828403121561083b57600080fd5b813561080d81610814565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561087f5761087f610846565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156108ae576108ae610846565b604052919050565b805180151581146108c657600080fd5b919050565b600080604083850312156108de57600080fd5b825167ffffffffffffffff808211156108f657600080fd5b908401906060828703121561090a57600080fd5b61091261085c565b8251815260208084015161092581610814565b8282015260408401518381111561093b57600080fd5b80850194505087601f85011261095057600080fd5b83518381111561096257610962610846565b610974601f8201601f19168301610885565b9350808452888282870101111561098a57600080fd5b60005b818110156109a857858101830151858201840152820161098d565b506000828286010152508260408301528195506109c68188016108b6565b9450505050509250929050565b60008082840360608112156109e757600080fd5b60408112156109f557600080fd5b506040516040810181811067ffffffffffffffff82111715610a1957610a19610846565b604052835181526020840151610a2e81610814565b60208201526040840151909250610a4481610814565b809150509250929050565b60208082526029908201527f54656c65706f7274657252656769737472793a207a65726f2070726f746f636f6040820152686c206164647265737360b81b606082015260800190565b8082018082111561017e57634e487b7160e01b600052601160045260246000fdfea264697066735822122058b05cc76fbe285fc20af67d7d963ae23961fd6bb1b8328fc0abbac0c04a7e8a64736f6c63430008120033", } // TeleporterRegistryABI is the input ABI used to generate the binding from. diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 9ba003da4..5607c03a7 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -5,4 +5,22 @@ libs = ['lib'] solc_version = '0.8.18' test = 'tests' -# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file +[fmt] +line_length = 100 +tab_width = 4 +bracket_spacing = false +int_types = 'preserve' +multiline_func_header = 'params_first' +quote_style = 'double' +number_underscores = 'thousands' +override_spacing = true +wrap_comments = false + +# Add the following to your VSCode settings to enable automatic formatting. +# { +# "editor.formatOnSave": true, +# "[solidity]": { +# "editor.defaultFormatter": "JuanBlanco.solidity" +# }, +# "solidity.formatter": "forge", +# } diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol index f8d6f10ca..0c9bbabd4 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/BridgeToken.sol @@ -5,7 +5,9 @@ pragma solidity 0.8.18; -import {ERC20, ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import { + ERC20, ERC20Burnable +} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; /** * @dev BridgeToken is an ERC20Burnable token contract that is associated with a specific native chain bridge and asset, and is only mintable by the bridge contract on this chain. @@ -30,18 +32,9 @@ contract BridgeToken is ERC20Burnable { string memory tokenSymbol, uint8 tokenDecimals ) ERC20(tokenName, tokenSymbol) { - require( - sourceBlockchainID != bytes32(0), - "BridgeToken: zero source chain id" - ); - require( - sourceBridge != address(0), - "BridgeToken: zero source bridge address" - ); - require( - sourceAsset != address(0), - "BridgeToken: zero source asset address" - ); + require(sourceBlockchainID != bytes32(0), "BridgeToken: zero source chain id"); + require(sourceBridge != address(0), "BridgeToken: zero source bridge address"); + require(sourceAsset != address(0), "BridgeToken: zero source asset address"); bridgeContract = msg.sender; nativeBlockchainID = sourceBlockchainID; nativeBridge = sourceBridge; diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index 461a2dd50..6e5336180 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -7,7 +7,11 @@ pragma solidity 0.8.18; import {IERC20Bridge} from "./IERC20Bridge.sol"; import {BridgeToken} from "./BridgeToken.sol"; -import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + ITeleporterMessenger, + TeleporterMessageInput, + TeleporterFeeInfo +} from "../../Teleporter/ITeleporterMessenger.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; @@ -21,11 +25,7 @@ import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard. * This implementation uses the {BridgeToken} contract to represent tokens on this chain, and uses * {ITeleporterMessenger} to send and receive messages to other chains. */ -contract ERC20Bridge is - IERC20Bridge, - ReentrancyGuard, - TeleporterOwnerUpgradeable -{ +contract ERC20Bridge is IERC20Bridge, ReentrancyGuard, TeleporterOwnerUpgradeable { using SafeERC20 for IERC20; struct WrappedTokenTransferInfo { @@ -38,8 +38,7 @@ contract ERC20Bridge is uint256 secondaryFeeAmount; } - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; + address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; bytes32 public immutable currentBlockchainID; // Tracks which bridge tokens have been submitted to be created other bridge instances. @@ -47,23 +46,37 @@ contract ERC20Bridge is // Note that the existence of a bridge token in this mapping does not ensure that it exists on // the destination bridge because the message to create the new token may not have been // successfully delivered yet. - mapping(bytes32 destinationBlockchainID => mapping(address destinationBridgeAddress => mapping(address nativeTokenContract => bool tokenCreationSubmitted))) - public submittedBridgeTokenCreations; + mapping( + bytes32 destinationBlockchainID + => mapping( + address destinationBridgeAddress + => mapping(address nativeTokenContract => bool tokenCreationSubmitted) + ) + ) public submittedBridgeTokenCreations; // Tracks the balances of native tokens sent to other bridge instances. // Bridges are not allowed to unwrap more than has been sent to them. // (destinationBlockchainID, destinationBridgeAddress) -> nativeTokenContract -> balance - mapping(bytes32 destinationBlockchainID => mapping(address destinationBridgeAddress => mapping(address nativeTokenContract => uint256 balance))) - public bridgedBalances; + mapping( + bytes32 destinationBlockchainID + => mapping( + address destinationBridgeAddress + => mapping(address nativeTokenContract => uint256 balance) + ) + ) public bridgedBalances; // Set of bridge tokens created by this bridge instance. - mapping(address bridgeToken => bool bridgeTokenExists) - public wrappedTokenContracts; + mapping(address bridgeToken => bool bridgeTokenExists) public wrappedTokenContracts; // Tracks the wrapped bridge token contract address for each native token bridged to this bridge instance. // (nativeBlockchainID, nativeBridgeAddress, nativeTokenAddress) -> bridgeTokenAddress - mapping(bytes32 nativeBlockchainID => mapping(address nativeBridgeAddress => mapping(address nativeTokenAddress => address bridgeTokenAddress))) - public nativeToWrappedTokens; + mapping( + bytes32 nativeBlockchainID + => mapping( + address nativeBridgeAddress + => mapping(address nativeTokenAddress => address bridgeTokenAddress) + ) + ) public nativeToWrappedTokens; uint256 public constant CREATE_BRIDGE_TOKENS_REQUIRED_GAS = 2_000_000; uint256 public constant MINT_BRIDGE_TOKENS_REQUIRED_GAS = 200_000; @@ -73,11 +86,10 @@ contract ERC20Bridge is * @dev Initializes the Teleporter Messenger used for sending and receiving messages, * and initializes the current chain ID. */ - constructor( - address teleporterRegistryAddress - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) { - currentBlockchainID = IWarpMessenger(WARP_PRECOMPILE_ADDRESS) - .getBlockchainID(); + constructor(address teleporterRegistryAddress) + TeleporterOwnerUpgradeable(teleporterRegistryAddress) + { + currentBlockchainID = IWarpMessenger(WARP_PRECOMPILE_ADDRESS).getBlockchainID(); } /** @@ -107,8 +119,7 @@ contract ERC20Bridge is // Neither the recipient nor the destination bridge can be the zero address. require(recipient != address(0), "ERC20Bridge: zero recipient address"); require( - destinationBridgeAddress != address(0), - "ERC20Bridge: zero destination bridge address" + destinationBridgeAddress != address(0), "ERC20Bridge: zero destination bridge address" ); // If the token to be bridged is an existing wrapped token of this bridge, @@ -126,53 +137,44 @@ contract ERC20Bridge is "ERC20Bridge: insufficient total amount" ); - return - _processWrappedTokenTransfer( - WrappedTokenTransferInfo({ - destinationBlockchainID: destinationBlockchainID, - destinationBridgeAddress: destinationBridgeAddress, - wrappedContractAddress: tokenContractAddress, - recipient: recipient, - totalAmount: totalAmount, - primaryFeeAmount: primaryFeeAmount, - secondaryFeeAmount: secondaryFeeAmount - }) - ); + return _processWrappedTokenTransfer( + WrappedTokenTransferInfo({ + destinationBlockchainID: destinationBlockchainID, + destinationBridgeAddress: destinationBridgeAddress, + wrappedContractAddress: tokenContractAddress, + recipient: recipient, + totalAmount: totalAmount, + primaryFeeAmount: primaryFeeAmount, + secondaryFeeAmount: secondaryFeeAmount + }) + ); } // Otherwise, this is a token "native" to this chain. require( - submittedBridgeTokenCreations[destinationBlockchainID][ - destinationBridgeAddress - ][tokenContractAddress], + submittedBridgeTokenCreations[destinationBlockchainID][destinationBridgeAddress][tokenContractAddress], "ERC20Bridge: invalid bridge token address" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(tokenContractAddress), - totalAmount - ); + uint256 adjustedAmount = + SafeERC20TransferFrom.safeTransferFrom(IERC20(tokenContractAddress), totalAmount); // Ensure that the adjusted amount is greater than the fee to be paid. // The secondary fee amount is not used in this case (and can assumed to be 0) since bridging // a native token to another chain only ever involves a single cross-chain message. - require( - adjustedAmount > primaryFeeAmount, - "ERC20Bridge: insufficient adjusted amount" - ); + require(adjustedAmount > primaryFeeAmount, "ERC20Bridge: insufficient adjusted amount"); - return - _processNativeTokenTransfer({ - destinationBlockchainID: destinationBlockchainID, - destinationBridgeAddress: destinationBridgeAddress, - nativeContractAddress: tokenContractAddress, - recipient: recipient, - totalAmount: adjustedAmount, - feeAmount: primaryFeeAmount - }); + return _processNativeTokenTransfer({ + destinationBlockchainID: destinationBlockchainID, + destinationBridgeAddress: destinationBridgeAddress, + nativeContractAddress: tokenContractAddress, + recipient: recipient, + totalAmount: adjustedAmount, + feeAmount: primaryFeeAmount + }); } /** @@ -193,8 +195,7 @@ contract ERC20Bridge is uint256 messageFeeAmount ) external nonReentrant { require( - destinationBridgeAddress != address(0), - "ERC20Bridge: zero destination bridge address" + destinationBridgeAddress != address(0), "ERC20Bridge: zero destination bridge address" ); ITeleporterMessenger teleporterMessenger = _getTeleporterMessenger(); @@ -202,22 +203,16 @@ contract ERC20Bridge is // allow the Teleporter contract to spend it. uint256 adjustedFeeAmount; if (messageFeeAmount > 0) { - adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(messageFeeAsset), - messageFeeAmount - ); + adjustedFeeAmount = + SafeERC20TransferFrom.safeTransferFrom(IERC20(messageFeeAsset), messageFeeAmount); IERC20(messageFeeAsset).safeIncreaseAllowance( - address(teleporterMessenger), - adjustedFeeAmount + address(teleporterMessenger), adjustedFeeAmount ); } // Create the calldata to create the bridge token on the destination chain. bytes memory messageData = encodeCreateBridgeTokenData( - address(nativeToken), - nativeToken.name(), - nativeToken.symbol(), - nativeToken.decimals() + address(nativeToken), nativeToken.name(), nativeToken.symbol(), nativeToken.decimals() ); // Send Teleporter message. @@ -225,25 +220,19 @@ contract ERC20Bridge is TeleporterMessageInput({ destinationBlockchainID: destinationBlockchainID, destinationAddress: destinationBridgeAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: messageFeeAsset, - amount: adjustedFeeAmount - }), + feeInfo: TeleporterFeeInfo({feeTokenAddress: messageFeeAsset, amount: adjustedFeeAmount}), requiredGasLimit: CREATE_BRIDGE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), message: messageData }) ); - submittedBridgeTokenCreations[destinationBlockchainID][ - destinationBridgeAddress - ][address(nativeToken)] = true; + submittedBridgeTokenCreations[destinationBlockchainID][destinationBridgeAddress][address( + nativeToken + )] = true; emit SubmitCreateBridgeToken( - destinationBlockchainID, - destinationBridgeAddress, - address(nativeToken), - messageID + destinationBlockchainID, destinationBridgeAddress, address(nativeToken), messageID ); } @@ -258,12 +247,8 @@ contract ERC20Bridge is ) public pure returns (bytes memory) { // ABI encode the Create action and corresponding parameters for the createBridgeToken // call to to be decoded and executed on the destination. - bytes memory paramsData = abi.encode( - nativeContractAddress, - nativeName, - nativeSymbol, - nativeDecimals - ); + bytes memory paramsData = + abi.encode(nativeContractAddress, nativeName, nativeSymbol, nativeDecimals); return abi.encode(BridgeAction.Create, paramsData); } @@ -277,11 +262,7 @@ contract ERC20Bridge is ) public pure returns (bytes memory) { // ABI encode the Mint action and corresponding parameters for the mintBridgeTokens // call to to be decoded and executed on the destination. - bytes memory paramsData = abi.encode( - nativeContractAddress, - recipient, - bridgeAmount - ); + bytes memory paramsData = abi.encode(nativeContractAddress, recipient, bridgeAmount); return abi.encode(BridgeAction.Mint, paramsData); } @@ -321,10 +302,7 @@ contract ERC20Bridge is bytes memory message ) internal override { // Decode the payload to recover the action and corresponding function parameters - (BridgeAction action, bytes memory actionData) = abi.decode( - message, - (BridgeAction, bytes) - ); + (BridgeAction action, bytes memory actionData) = abi.decode(message, (BridgeAction, bytes)); // Route to the appropriate function. if (action == BridgeAction.Create) { @@ -343,17 +321,10 @@ contract ERC20Bridge is nativeDecimals: nativeDecimals }); } else if (action == BridgeAction.Mint) { - ( - address nativeContractAddress, - address recipient, - uint256 amount - ) = abi.decode(actionData, (address, address, uint256)); + (address nativeContractAddress, address recipient, uint256 amount) = + abi.decode(actionData, (address, address, uint256)); _mintBridgeTokens( - originBlockchainID, - originSenderAddress, - nativeContractAddress, - recipient, - amount + originBlockchainID, originSenderAddress, nativeContractAddress, recipient, amount ); } else if (action == BridgeAction.Transfer) { ( @@ -363,10 +334,7 @@ contract ERC20Bridge is address recipient, uint256 totalAmount, uint256 secondaryFeeAmount - ) = abi.decode( - actionData, - (bytes32, address, address, address, uint256, uint256) - ); + ) = abi.decode(actionData, (bytes32, address, address, address, uint256, uint256)); _transferBridgeTokens({ sourceBlockchainID: originBlockchainID, sourceBridgeAddress: originSenderAddress, @@ -400,9 +368,8 @@ contract ERC20Bridge is ) private { // Check that the bridge token doesn't already exist. require( - nativeToWrappedTokens[nativeBlockchainID][nativeBridgeAddress][ - nativeContractAddress - ] == address(0), + nativeToWrappedTokens[nativeBlockchainID][nativeBridgeAddress][nativeContractAddress] + == address(0), "ERC20Bridge: bridge token already exists" ); @@ -418,15 +385,11 @@ contract ERC20Bridge is ); wrappedTokenContracts[bridgeTokenAddress] = true; - nativeToWrappedTokens[nativeBlockchainID][nativeBridgeAddress][ - nativeContractAddress - ] = bridgeTokenAddress; + nativeToWrappedTokens[nativeBlockchainID][nativeBridgeAddress][nativeContractAddress] = + bridgeTokenAddress; emit CreateBridgeToken( - nativeBlockchainID, - nativeBridgeAddress, - nativeContractAddress, - bridgeTokenAddress + nativeBlockchainID, nativeBridgeAddress, nativeContractAddress, bridgeTokenAddress ); } @@ -452,13 +415,9 @@ contract ERC20Bridge is // If not, one needs to be created by the delivery of a "createBridgeToken" message first // before this mint can be processed. Once the bridge token is create, this message // could then be retried to mint the tokens. - address bridgeTokenAddress = nativeToWrappedTokens[nativeBlockchainID][ - nativeBridgeAddress - ][nativeContractAddress]; - require( - bridgeTokenAddress != address(0), - "ERC20Bridge: bridge token does not exist" - ); + address bridgeTokenAddress = + nativeToWrappedTokens[nativeBlockchainID][nativeBridgeAddress][nativeContractAddress]; + require(bridgeTokenAddress != address(0), "ERC20Bridge: bridge token does not exist"); // Mint the wrapped tokens. BridgeToken(bridgeTokenAddress).mint(recipient, amount); @@ -485,22 +444,16 @@ contract ERC20Bridge is // Neither the recipient nor the destination bridge can be the zero address. require(recipient != address(0), "ERC20Bridge: zero recipient address"); require( - destinationBridgeAddress != address(0), - "ERC20Bridge: zero destination bridge address" + destinationBridgeAddress != address(0), "ERC20Bridge: zero destination bridge address" ); // Check that the bridge returning the tokens has sufficient balance to do so. - uint256 currentBalance = bridgedBalances[sourceBlockchainID][ - sourceBridgeAddress - ][nativeContractAddress]; - require( - currentBalance >= totalAmount, - "ERC20Bridge: insufficient balance" - ); + uint256 currentBalance = + bridgedBalances[sourceBlockchainID][sourceBridgeAddress][nativeContractAddress]; + require(currentBalance >= totalAmount, "ERC20Bridge: insufficient balance"); - bridgedBalances[sourceBlockchainID][sourceBridgeAddress][ - nativeContractAddress - ] = currentBalance - totalAmount; + bridgedBalances[sourceBlockchainID][sourceBridgeAddress][nativeContractAddress] = + currentBalance - totalAmount; // If the destination chain ID and bridge is this bridge instance, then release the tokens back to the recipient. // In this case, since there is no secondary Teleporter message, the secondary fee amount is not used. @@ -523,15 +476,14 @@ contract ERC20Bridge is // The tokens are already locked in this contract from when they were previously bridged. // We deduct the balance from bridge instance that sent this message, and now will increment the // balance of the destination bridge instance. - return - _processNativeTokenTransfer({ - destinationBlockchainID: destinationBlockchainID, - destinationBridgeAddress: destinationBridgeAddress, - nativeContractAddress: nativeContractAddress, - recipient: recipient, - totalAmount: totalAmount, - feeAmount: secondaryFeeAmount - }); + return _processNativeTokenTransfer({ + destinationBlockchainID: destinationBlockchainID, + destinationBridgeAddress: destinationBridgeAddress, + nativeContractAddress: nativeContractAddress, + recipient: recipient, + totalAmount: totalAmount, + feeAmount: secondaryFeeAmount + }); } /** @@ -571,32 +523,24 @@ contract ERC20Bridge is // Allow the Teleporter Messenger to spend the fee amount. if (feeAmount > 0) { IERC20(nativeContractAddress).safeIncreaseAllowance( - address(teleporterMessenger), - feeAmount + address(teleporterMessenger), feeAmount ); } // Update balances. uint256 bridgeAmount = totalAmount - feeAmount; - bridgedBalances[destinationBlockchainID][destinationBridgeAddress][ - nativeContractAddress - ] += bridgeAmount; + bridgedBalances[destinationBlockchainID][destinationBridgeAddress][nativeContractAddress] += + bridgeAmount; // Send Teleporter message. - bytes memory messageData = encodeMintBridgeTokensData( - nativeContractAddress, - recipient, - bridgeAmount - ); + bytes memory messageData = + encodeMintBridgeTokensData(nativeContractAddress, recipient, bridgeAmount); uint256 messageID = teleporterMessenger.sendCrossChainMessage( TeleporterMessageInput({ destinationBlockchainID: destinationBlockchainID, destinationAddress: destinationBridgeAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: nativeContractAddress, - amount: feeAmount - }), + feeInfo: TeleporterFeeInfo({feeTokenAddress: nativeContractAddress, amount: feeAmount}), requiredGasLimit: MINT_BRIDGE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: new address[](0), message: messageData @@ -620,9 +564,9 @@ contract ERC20Bridge is * It is the caller's responsibility to ensure that the wrapped token contract is supported by this bridge instance. * Emits a {BridgeTokens} event. */ - function _processWrappedTokenTransfer( - WrappedTokenTransferInfo memory wrappedTransferInfo - ) private { + function _processWrappedTokenTransfer(WrappedTokenTransferInfo memory wrappedTransferInfo) + private + { ITeleporterMessenger teleporterMessenger = _getTeleporterMessenger(); // If necessary, transfer the primary fee amount to this contract and approve the @@ -638,11 +582,9 @@ contract ERC20Bridge is IERC20(wrappedTransferInfo.wrappedContractAddress), wrappedTransferInfo.primaryFeeAmount ); - IERC20(wrappedTransferInfo.wrappedContractAddress) - .safeIncreaseAllowance( - address(teleporterMessenger), - adjustedPrimaryFeeAmount - ); + IERC20(wrappedTransferInfo.wrappedContractAddress).safeIncreaseAllowance( + address(teleporterMessenger), adjustedPrimaryFeeAmount + ); } // Burn the wrapped tokens to be bridged. @@ -650,11 +592,9 @@ contract ERC20Bridge is // is less than the original fee amount, the original amount is the portion that is spent out of the total // amount. We know that the burnFrom call will decrease the total supply by bridgeAmount because the // bridgeToken contract was deployed by this contract itself and does not implement "fee on burn" functionality. - uint256 bridgeAmount = wrappedTransferInfo.totalAmount - - wrappedTransferInfo.primaryFeeAmount; - BridgeToken bridgeToken = BridgeToken( - wrappedTransferInfo.wrappedContractAddress - ); + uint256 bridgeAmount = + wrappedTransferInfo.totalAmount - wrappedTransferInfo.primaryFeeAmount; + BridgeToken bridgeToken = BridgeToken(wrappedTransferInfo.wrappedContractAddress); bridgeToken.burnFrom(msg.sender, bridgeAmount); // If the destination chain ID is the native chain ID for the wrapped token, the bridge address must also match. @@ -663,8 +603,7 @@ contract ERC20Bridge is address nativeBridgeAddress = bridgeToken.nativeBridge(); if (wrappedTransferInfo.destinationBlockchainID == nativeBlockchainID) { require( - wrappedTransferInfo.destinationBridgeAddress == - nativeBridgeAddress, + wrappedTransferInfo.destinationBridgeAddress == nativeBridgeAddress, "ERC20Bridge: invalid destination bridge address" ); } @@ -673,10 +612,8 @@ contract ERC20Bridge is // The message includes the destination chain ID and bridge contract, which will differ from the native // ones in the event that the tokens are being bridge from one non-native chain to another with two hops. bytes memory messageData = encodeTransferBridgeTokensData({ - destinationBlockchainID: wrappedTransferInfo - .destinationBlockchainID, - destinationBridgeAddress: wrappedTransferInfo - .destinationBridgeAddress, + destinationBlockchainID: wrappedTransferInfo.destinationBlockchainID, + destinationBridgeAddress: wrappedTransferInfo.destinationBridgeAddress, nativeContractAddress: bridgeToken.nativeAsset(), recipient: wrappedTransferInfo.recipient, amount: bridgeAmount, @@ -698,11 +635,9 @@ contract ERC20Bridge is ); emit BridgeTokens({ tokenContractAddress: wrappedTransferInfo.wrappedContractAddress, - destinationBlockchainID: wrappedTransferInfo - .destinationBlockchainID, + destinationBlockchainID: wrappedTransferInfo.destinationBlockchainID, teleporterMessageID: messageID, - destinationBridgeAddress: wrappedTransferInfo - .destinationBridgeAddress, + destinationBridgeAddress: wrappedTransferInfo.destinationBridgeAddress, recipient: wrappedTransferInfo.recipient, amount: bridgeAmount }); diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol index 7489f6b13..e50a4aa02 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/IERC20Bridge.sol @@ -55,11 +55,7 @@ interface IERC20Bridge { /** * @dev Emitted when minting bridge tokens. */ - event MintBridgeTokens( - address indexed contractAddress, - address recipient, - uint256 amount - ); + event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); /** * @dev Transfers ERC20 tokens to another chain. diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol index 98bd67dd8..bb74f6b85 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol @@ -6,7 +6,16 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {ERC20Bridge, BridgeToken, IERC20, ERC20, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../ERC20Bridge.sol"; +import { + ERC20Bridge, + BridgeToken, + IERC20, + ERC20, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger, + ITeleporterMessenger +} from "../ERC20Bridge.sol"; import {TeleporterRegistry} from "../../../Teleporter/upgrades/TeleporterRegistry.sol"; import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; @@ -19,16 +28,13 @@ contract ERC20BridgeTest is Test { address(0x0200000000000000000000000000000000000005); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; string private constant _DEFAULT_TOKEN_NAME = "Test Token"; string private constant _DEFAULT_SYMBOL = "TSTTK"; uint8 private constant _DEFAULT_DECIMALS = 18; - address private constant _DEFAULT_RECIPIENT = - 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; ERC20Bridge public erc20Bridge; UnitTestMockERC20 public mockERC20; @@ -56,15 +62,10 @@ contract ERC20BridgeTest is Test { address bridgeTokenAddress ); - event MintBridgeTokens( - address indexed contractAddress, - address recipient, - uint256 amount - ); + event MintBridgeTokens(address indexed contractAddress, address recipient, uint256 amount); event MinTeleporterVersionUpdated( - uint256 indexed oldMinTeleporterVersion, - uint256 indexed newMinTeleporterVersion + uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion ); function setUp() public virtual { @@ -74,8 +75,7 @@ contract ERC20BridgeTest is Test { abi.encode(_MOCK_BLOCKCHAIN_ID) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + WARP_PRECOMPILE_ADDRESS, abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) ); _initMockTeleporterRegistry(); @@ -83,9 +83,7 @@ contract ERC20BridgeTest is Test { vm.expectCall( MOCK_TELEPORTER_REGISTRY_ADDRESS, abi.encodeWithSelector( - TeleporterRegistry(MOCK_TELEPORTER_REGISTRY_ADDRESS) - .latestVersion - .selector + TeleporterRegistry(MOCK_TELEPORTER_REGISTRY_ADDRESS).latestVersion.selector ) ); @@ -94,9 +92,7 @@ contract ERC20BridgeTest is Test { } function testSameBlockchainID() public { - vm.expectRevert( - _formatERC20BridgeErrorMessage("cannot bridge to same chain") - ); + vm.expectRevert(_formatERC20BridgeErrorMessage("cannot bridge to same chain")); erc20Bridge.bridgeTokens({ destinationBlockchainID: _MOCK_BLOCKCHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -111,13 +107,9 @@ contract ERC20BridgeTest is Test { function testInvalidFeeAmountsNativeTransfer() public { _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) - ); - vm.expectRevert( - _formatERC20BridgeErrorMessage("insufficient adjusted amount") + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); + vm.expectRevert(_formatERC20BridgeErrorMessage("insufficient adjusted amount")); erc20Bridge.bridgeTokens({ destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -140,9 +132,7 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - vm.expectRevert( - _formatERC20BridgeErrorMessage("insufficient total amount") - ); + vm.expectRevert(_formatERC20BridgeErrorMessage("insufficient total amount")); erc20Bridge.bridgeTokens({ destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -157,26 +147,18 @@ contract ERC20BridgeTest is Test { function testNativeTokenTransferFailure() public { _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); uint256 totalAmount = 123456; vm.mockCall( address(mockERC20), - abi.encodeCall( - IERC20.transferFrom, - (address(this), address(erc20Bridge), totalAmount) - ), + abi.encodeCall(IERC20.transferFrom, (address(this), address(erc20Bridge), totalAmount)), abi.encode(false) ); vm.expectCall( address(mockERC20), - abi.encodeCall( - IERC20.transferFrom, - (address(this), address(erc20Bridge), totalAmount) - ) + abi.encodeCall(IERC20.transferFrom, (address(this), address(erc20Bridge), totalAmount)) ); vm.expectRevert("SafeERC20: ERC20 operation did not succeed"); @@ -196,43 +178,29 @@ contract ERC20BridgeTest is Test { _setUpExpectedTransferFromCall(address(mockERC20), totalAmount); _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) - ); - - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: 0 - }), - requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - _DEFAULT_RECIPIENT, - totalAmount + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) + ); + + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: 0}), + requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: erc20Bridge.encodeMintBridgeTokensData( + address(mockERC20), _DEFAULT_RECIPIENT, totalAmount ) - }); + }); uint256 mockMessageID = 42; vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ), + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)), abi.encode(mockMessageID) ); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); vm.expectEmit(true, true, true, true, address(erc20Bridge)); @@ -262,33 +230,24 @@ contract ERC20BridgeTest is Test { _setUpExpectedTransferFromCall(address(mockERC20), totalAmount); _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); vm.mockCall( address(mockERC20), abi.encodeCall( - IERC20.allowance, - (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) + IERC20.allowance, (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) ), abi.encode(0) ); vm.mockCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount) - ), + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount)), abi.encode(false) ); vm.expectCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount) - ) + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount)) ); vm.expectRevert("SafeERC20: ERC20 operation did not succeed"); @@ -311,67 +270,46 @@ contract ERC20BridgeTest is Test { _setUpExpectedTransferFromCall(address(mockERC20), totalAmount); _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) - ); - - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: feeAmount - }), - requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - _DEFAULT_RECIPIENT, - bridgeAmount + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) + ); + + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: feeAmount}), + requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: erc20Bridge.encodeMintBridgeTokensData( + address(mockERC20), _DEFAULT_RECIPIENT, bridgeAmount ) - }); + }); vm.mockCall( address(mockERC20), abi.encodeCall( - IERC20.allowance, - (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) + IERC20.allowance, (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) ), abi.encode(0) ); vm.mockCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount) - ), + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount)), abi.encode(true) ); vm.expectCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount) - ) + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, feeAmount)) ); uint256 mockMessageID = 42; vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ), + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)), abi.encode(mockMessageID) ); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); vm.expectEmit(true, true, true, true, address(erc20Bridge)); @@ -401,80 +339,54 @@ contract ERC20BridgeTest is Test { uint256 totalAmount = 131313131313; uint256 tokenFeeOnTransferAmount = 654321; uint256 bridgeFeeAmount = 131313; - uint256 expectedBridgeAmount = totalAmount - - tokenFeeOnTransferAmount - - bridgeFeeAmount; + uint256 expectedBridgeAmount = totalAmount - tokenFeeOnTransferAmount - bridgeFeeAmount; // Mock the ERC20 being a "fee on transfer" implementation; - mockERC20.setFeeOnTransferSender( - address(this), - tokenFeeOnTransferAmount - ); + mockERC20.setFeeOnTransferSender(address(this), tokenFeeOnTransferAmount); _setUpExpectedTransferFromCall(address(mockERC20), totalAmount); _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) - ); - - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: bridgeFeeAmount - }), - requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - _DEFAULT_RECIPIENT, - expectedBridgeAmount + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) + ); + + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: bridgeFeeAmount}), + requiredGasLimit: erc20Bridge.MINT_BRIDGE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: erc20Bridge.encodeMintBridgeTokensData( + address(mockERC20), _DEFAULT_RECIPIENT, expectedBridgeAmount ) - }); + }); vm.mockCall( address(mockERC20), abi.encodeCall( - IERC20.allowance, - (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) + IERC20.allowance, (address(erc20Bridge), MOCK_TELEPORTER_MESSENGER_ADDRESS) ), abi.encode(0) ); vm.mockCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, bridgeFeeAmount) - ), + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, bridgeFeeAmount)), abi.encode(true) ); vm.expectCall( address(mockERC20), - abi.encodeCall( - IERC20.approve, - (MOCK_TELEPORTER_MESSENGER_ADDRESS, bridgeFeeAmount) - ) + abi.encodeCall(IERC20.approve, (MOCK_TELEPORTER_MESSENGER_ADDRESS, bridgeFeeAmount)) ); uint256 mockMessageID = 42; vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ), + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)), abi.encode(mockMessageID) ); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); vm.expectEmit(true, true, true, true, address(erc20Bridge)); @@ -506,22 +418,15 @@ contract ERC20BridgeTest is Test { uint256 bridgeFeeAmount = 131313; // Mock the ERC20 being a "fee on transfer" implementation; - mockERC20.setFeeOnTransferSender( - address(this), - tokenFeeOnTransferAmount - ); + mockERC20.setFeeOnTransferSender(address(this), tokenFeeOnTransferAmount); _setUpExpectedTransferFromCall(address(mockERC20), totalAmount); _setUpMockERC20ContractValues(address(mockERC20)); _submitCreateBridgeToken( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - address(mockERC20) + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, address(mockERC20) ); - vm.expectRevert( - _formatERC20BridgeErrorMessage("insufficient adjusted amount") - ); + vm.expectRevert(_formatERC20BridgeErrorMessage("insufficient adjusted amount")); erc20Bridge.bridgeTokens({ destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, destinationBridgeAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, @@ -545,19 +450,14 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - bytes memory message = erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - _DEFAULT_RECIPIENT, - amount - ); + bytes memory message = + erc20Bridge.encodeMintBridgeTokensData(address(mockERC20), _DEFAULT_RECIPIENT, amount); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); vm.expectEmit(true, true, true, true, address(erc20Bridge)); emit MintBridgeTokens(bridgeTokenAddress, _DEFAULT_RECIPIENT, amount); erc20Bridge.receiveTeleporterMessage( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - message + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, message ); // Check the values and balance of the newly created ERC20. @@ -587,36 +487,26 @@ contract ERC20BridgeTest is Test { contractNonce: 1 }); - bytes memory message1 = erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - recipient1, - amount1 - ); + bytes memory message1 = + erc20Bridge.encodeMintBridgeTokensData(address(mockERC20), recipient1, amount1); // Call mintBridgeTokens the first time, which should create the new bridge token. vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); vm.expectEmit(true, true, true, true, address(erc20Bridge)); emit MintBridgeTokens(bridgeTokenAddress, recipient1, amount1); erc20Bridge.receiveTeleporterMessage( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - message1 + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, message1 ); - bytes memory message2 = erc20Bridge.encodeMintBridgeTokensData( - address(mockERC20), - recipient2, - amount2 - ); + bytes memory message2 = + erc20Bridge.encodeMintBridgeTokensData(address(mockERC20), recipient2, amount2); // Call mintBridgeTokens the second time, which should mint additional of the existing token. vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); vm.expectEmit(true, true, true, true, address(erc20Bridge)); emit MintBridgeTokens(bridgeTokenAddress, recipient2, amount2); erc20Bridge.receiveTeleporterMessage( - _DEFAULT_OTHER_CHAIN_ID, - _DEFAULT_OTHER_BRIDGE_ADDRESS, - message2 + _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, message2 ); // Check the values and balance of the newly created ERC20. @@ -633,9 +523,7 @@ contract ERC20BridgeTest is Test { } function testZeroTeleporterRegistryAddress() public { - vm.expectRevert( - "TeleporterUpgradeable: zero teleporter registry address" - ); + vm.expectRevert("TeleporterUpgradeable: zero teleporter registry address"); new ERC20Bridge(address(0)); } @@ -643,9 +531,7 @@ contract ERC20BridgeTest is Test { vm.mockCall( MOCK_TELEPORTER_REGISTRY_ADDRESS, abi.encodeWithSelector( - TeleporterRegistry(MOCK_TELEPORTER_REGISTRY_ADDRESS) - .latestVersion - .selector + TeleporterRegistry(MOCK_TELEPORTER_REGISTRY_ADDRESS).latestVersion.selector ), abi.encode(1) ); @@ -661,32 +547,21 @@ contract ERC20BridgeTest is Test { vm.mockCall( MOCK_TELEPORTER_REGISTRY_ADDRESS, - abi.encodeWithSelector( - TeleporterRegistry.getAddressFromVersion.selector, - (1) - ), + abi.encodeWithSelector(TeleporterRegistry.getAddressFromVersion.selector, (1)), abi.encode(MOCK_TELEPORTER_MESSENGER_ADDRESS) ); vm.mockCall( MOCK_TELEPORTER_REGISTRY_ADDRESS, - abi.encodeWithSelector( - TeleporterRegistry.getLatestTeleporter.selector - ), + abi.encodeWithSelector(TeleporterRegistry.getLatestTeleporter.selector), abi.encode(ITeleporterMessenger(MOCK_TELEPORTER_MESSENGER_ADDRESS)) ); } - function _setUpExpectedTransferFromCall( - address tokenContract, - uint256 amount - ) private { + function _setUpExpectedTransferFromCall(address tokenContract, uint256 amount) private { vm.expectCall( tokenContract, - abi.encodeCall( - IERC20.transferFrom, - (address(this), address(erc20Bridge), amount) - ) + abi.encodeCall(IERC20.transferFrom, (address(this), address(erc20Bridge), amount)) ); } @@ -700,56 +575,35 @@ contract ERC20BridgeTest is Test { address nativeContractAddress ) private { ERC20 nativeToken = ERC20(nativeContractAddress); - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: destinationBlockchainID, - destinationAddress: destinationBridgeAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(0), - amount: 0 - }), - requiredGasLimit: erc20Bridge - .CREATE_BRIDGE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: erc20Bridge.encodeCreateBridgeTokenData( - nativeContractAddress, - nativeToken.name(), - nativeToken.symbol(), - nativeToken.decimals() + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: destinationBlockchainID, + destinationAddress: destinationBridgeAddress, + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(0), amount: 0}), + requiredGasLimit: erc20Bridge.CREATE_BRIDGE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: erc20Bridge.encodeCreateBridgeTokenData( + nativeContractAddress, nativeToken.name(), nativeToken.symbol(), nativeToken.decimals() ) - }); + }); uint256 mockMessageID = 456; vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ), + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)), abi.encode(mockMessageID) ); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); vm.expectEmit(true, true, true, true, address(erc20Bridge)); emit SubmitCreateBridgeToken( - destinationBlockchainID, - destinationBridgeAddress, - nativeContractAddress, - mockMessageID + destinationBlockchainID, destinationBridgeAddress, nativeContractAddress, mockMessageID ); erc20Bridge.submitCreateBridgeToken( - destinationBlockchainID, - destinationBridgeAddress, - nativeToken, - address(0), - 0 + destinationBlockchainID, destinationBridgeAddress, nativeToken, address(0), 0 ); } @@ -762,15 +616,10 @@ contract ERC20BridgeTest is Test { uint8 nativeDecimals, uint8 contractNonce ) private returns (address) { - address expectedBridgeTokenAddress = _deriveExpectedContractAddress( - address(erc20Bridge), - contractNonce - ); + address expectedBridgeTokenAddress = + _deriveExpectedContractAddress(address(erc20Bridge), contractNonce); bytes memory message = erc20Bridge.encodeCreateBridgeTokenData( - nativeContractAddress, - nativeName, - nativeSymbol, - nativeDecimals + nativeContractAddress, nativeName, nativeSymbol, nativeDecimals ); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); vm.expectEmit(true, true, true, true, address(erc20Bridge)); @@ -780,32 +629,18 @@ contract ERC20BridgeTest is Test { nativeContractAddress, expectedBridgeTokenAddress ); - erc20Bridge.receiveTeleporterMessage( - nativeBlockchainID, - nativeBridgeAddress, - message - ); + erc20Bridge.receiveTeleporterMessage(nativeBlockchainID, nativeBridgeAddress, message); return expectedBridgeTokenAddress; } function _setUpMockERC20ContractValues(address tokenContract) private { ERC20 token = ERC20(tokenContract); - vm.mockCall( - tokenContract, - abi.encodeCall(token.name, ()), - abi.encode(_DEFAULT_TOKEN_NAME) - ); + vm.mockCall(tokenContract, abi.encodeCall(token.name, ()), abi.encode(_DEFAULT_TOKEN_NAME)); vm.expectCall(tokenContract, abi.encodeCall(token.name, ())); - vm.mockCall( - tokenContract, - abi.encodeCall(token.symbol, ()), - abi.encode(_DEFAULT_SYMBOL) - ); + vm.mockCall(tokenContract, abi.encodeCall(token.symbol, ()), abi.encode(_DEFAULT_SYMBOL)); vm.expectCall(tokenContract, abi.encodeCall(token.symbol, ())); vm.mockCall( - tokenContract, - abi.encodeCall(token.decimals, ()), - abi.encode(_DEFAULT_DECIMALS) + tokenContract, abi.encodeCall(token.decimals, ()), abi.encode(_DEFAULT_DECIMALS) ); vm.expectCall(tokenContract, abi.encodeCall(token.decimals, ())); } @@ -816,26 +651,20 @@ contract ERC20BridgeTest is Test { ) private pure returns (address) { // Taken from https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed // We must use encodePacked rather than encode so that the parameters are not padded with extra zeros. - return - address( - uint160( - uint256( - keccak256( - abi.encodePacked( - bytes1(0xd6), - bytes1(0x94), - creator, - bytes1(nonce) - ) - ) - ) + return address( + uint160( + uint256( + keccak256(abi.encodePacked(bytes1(0xd6), bytes1(0x94), creator, bytes1(nonce))) ) - ); + ) + ); } - function _formatERC20BridgeErrorMessage( - string memory errorMessage - ) private pure returns (bytes memory) { + function _formatERC20BridgeErrorMessage(string memory errorMessage) + private + pure + returns (bytes memory) + { return bytes(string.concat("ERC20Bridge: ", errorMessage)); } } diff --git a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol index 9968b76f5..e79a12c8b 100644 --- a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol +++ b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol @@ -5,7 +5,11 @@ pragma solidity 0.8.18; -import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + ITeleporterMessenger, + TeleporterMessageInput, + TeleporterFeeInfo +} from "../../Teleporter/ITeleporterMessenger.sol"; import {SafeERC20TransferFrom, SafeERC20} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {TeleporterOwnerUpgradeable} from "../../Teleporter/upgrades/TeleporterOwnerUpgradeable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -15,10 +19,7 @@ import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard. * @dev ExampleCrossChainMessenger is an example contract that demonstrates how to send and receive * messages cross chain. */ -contract ExampleCrossChainMessenger is - ReentrancyGuard, - TeleporterOwnerUpgradeable -{ +contract ExampleCrossChainMessenger is ReentrancyGuard, TeleporterOwnerUpgradeable { using SafeERC20 for IERC20; // Messages sent to this contract. @@ -45,14 +46,12 @@ contract ExampleCrossChainMessenger is * @dev Emitted when a new message is received from a given chain ID. */ event ReceiveMessage( - bytes32 indexed originBlockchainID, - address indexed originSenderAddress, - string message + bytes32 indexed originBlockchainID, address indexed originSenderAddress, string message ); - constructor( - address teleporterRegistryAddress - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) {} + constructor(address teleporterRegistryAddress) + TeleporterOwnerUpgradeable(teleporterRegistryAddress) + {} /** * @dev Sends a message to another chain. @@ -71,13 +70,10 @@ contract ExampleCrossChainMessenger is // allow the Teleporter contract to spend it. uint256 adjustedFeeAmount; if (feeAmount > 0) { - adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenAddress), - feeAmount - ); + adjustedFeeAmount = + SafeERC20TransferFrom.safeTransferFrom(IERC20(feeTokenAddress), feeAmount); IERC20(feeTokenAddress).safeIncreaseAllowance( - address(teleporterMessenger), - adjustedFeeAmount + address(teleporterMessenger), adjustedFeeAmount ); } @@ -89,29 +85,27 @@ contract ExampleCrossChainMessenger is requiredGasLimit: requiredGasLimit, message: message }); - return - teleporterMessenger.sendCrossChainMessage( - TeleporterMessageInput({ - destinationBlockchainID: destinationBlockchainID, - destinationAddress: destinationAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: feeTokenAddress, - amount: adjustedFeeAmount - }), - requiredGasLimit: requiredGasLimit, - allowedRelayerAddresses: new address[](0), - message: abi.encode(message) - }) - ); + return teleporterMessenger.sendCrossChainMessage( + TeleporterMessageInput({ + destinationBlockchainID: destinationBlockchainID, + destinationAddress: destinationAddress, + feeInfo: TeleporterFeeInfo({feeTokenAddress: feeTokenAddress, amount: adjustedFeeAmount}), + requiredGasLimit: requiredGasLimit, + allowedRelayerAddresses: new address[](0), + message: abi.encode(message) + }) + ); } /** * @dev Returns the current message from another chain. * @return The sender of the message, and the message itself. */ - function getCurrentMessage( - bytes32 originBlockchainID - ) external view returns (address, string memory) { + function getCurrentMessage(bytes32 originBlockchainID) + external + view + returns (address, string memory) + { Message memory messageInfo = _messages[originBlockchainID]; return (messageInfo.sender, messageInfo.message); } @@ -128,14 +122,7 @@ contract ExampleCrossChainMessenger is ) internal override { // Store the message. string memory messageString = abi.decode(message, (string)); - _messages[originBlockchainID] = Message( - originSenderAddress, - messageString - ); - emit ReceiveMessage( - originBlockchainID, - originSenderAddress, - messageString - ); + _messages[originBlockchainID] = Message(originSenderAddress, messageString); + emit ReceiveMessage(originBlockchainID, originSenderAddress, messageString); } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol index 0b07a7283..a6c26992e 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ERC20TokenSource.sol @@ -9,7 +9,11 @@ import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard. import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {IERC20TokenSource} from "./IERC20TokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; -import {ITeleporterMessenger, TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + ITeleporterMessenger, + TeleporterMessageInput, + TeleporterFeeInfo +} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -24,8 +28,7 @@ contract ERC20TokenSource is // The address where the burned transaction fees are credited. // Defined as BLACKHOLE_ADDRESS at // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go - address public constant BURNED_TX_FEES_ADDRESS = - 0x0100000000000000000000000000000000000000; + address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -54,9 +57,8 @@ contract ERC20TokenSource is "ERC20TokenSource: zero destination blockchain ID" ); require( - destinationBlockchainID_ != - IWarpMessenger(0x0200000000000000000000000000000000000005) - .getBlockchainID(), + destinationBlockchainID_ + != IWarpMessenger(0x0200000000000000000000000000000000000005).getBlockchainID(), "ERC20TokenSource: cannot bridge with same blockchain" ); destinationBlockchainID = destinationBlockchainID_; @@ -68,8 +70,7 @@ contract ERC20TokenSource is nativeTokenDestinationAddress = nativeTokenDestinationAddress_; require( - erc20ContractAddress_ != address(0), - "ERC20TokenSource: zero ERC20 contract address" + erc20ContractAddress_ != address(0), "ERC20TokenSource: zero ERC20 contract address" ); erc20ContractAddress = erc20ContractAddress_; } @@ -98,22 +99,15 @@ contract ERC20TokenSource is // Only allow the partner contract to send messages. require( - senderAddress == nativeTokenDestinationAddress, - "ERC20TokenSource: unauthorized sender" + senderAddress == nativeTokenDestinationAddress, "ERC20TokenSource: unauthorized sender" ); // Decode the payload to recover the action and corresponding function parameters - (SourceAction action, bytes memory actionData) = abi.decode( - message, - (SourceAction, bytes) - ); + (SourceAction action, bytes memory actionData) = abi.decode(message, (SourceAction, bytes)); // Route to the appropriate function. if (action == SourceAction.Unlock) { - (address recipient, uint256 amount) = abi.decode( - actionData, - (address, uint256) - ); + (address recipient, uint256 amount) = abi.decode(actionData, (address, uint256)); _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); @@ -133,31 +127,21 @@ contract ERC20TokenSource is address[] calldata allowedRelayerAddresses ) external nonReentrant { // The recipient cannot be the zero address. - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); + require(recipient != address(0), "ERC20TokenSource: zero recipient address"); // Lock tokens in this contract. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call // to transferFrom. - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(erc20ContractAddress), - totalAmount - ); + uint256 adjustedAmount = + SafeERC20TransferFrom.safeTransferFrom(IERC20(erc20ContractAddress), totalAmount); // Ensure that the adjusted amount is greater than the fee to be paid. - require( - adjustedAmount > feeAmount, - "ERC20TokenSource: insufficient adjusted amount" - ); + require(adjustedAmount > feeAmount, "ERC20TokenSource: insufficient adjusted amount"); // Allow the Teleporter messenger to spend the fee amount. if (feeAmount > 0) { SafeERC20.safeIncreaseAllowance( - IERC20(erc20ContractAddress), - address(teleporterMessenger), - feeAmount + IERC20(erc20ContractAddress), address(teleporterMessenger), feeAmount ); } @@ -167,10 +151,7 @@ contract ERC20TokenSource is TeleporterMessageInput({ destinationBlockchainID: destinationBlockchainID, destinationAddress: nativeTokenDestinationAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: erc20ContractAddress, - amount: feeAmount - }), + feeInfo: TeleporterFeeInfo({feeTokenAddress: erc20ContractAddress, amount: feeAmount}), requiredGasLimit: MINT_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, message: abi.encode(recipient, transferAmount) @@ -189,10 +170,7 @@ contract ERC20TokenSource is * @dev Unlocks tokens to recipient. */ function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "ERC20TokenSource: zero recipient address" - ); + require(recipient != address(0), "ERC20TokenSource: zero recipient address"); // Transfer to recipient emit UnlockTokens(recipient, amount); @@ -204,11 +182,7 @@ contract ERC20TokenSource is */ function _burnTokens(uint256 amount) private { emit BurnTokens(amount); - SafeERC20.safeTransfer( - IERC20(erc20ContractAddress), - BURNED_TX_FEES_ADDRESS, - amount - ); + SafeERC20.safeTransfer(IERC20(erc20ContractAddress), BURNED_TX_FEES_ADDRESS, amount); } /** diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol index 285711acb..c33e97380 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/INativeTokenDestination.sol @@ -35,10 +35,7 @@ interface INativeTokenDestination { /** * @dev Emitted when reporting total burned tx fees to source chain. */ - event ReportTotalBurnedTxFees( - uint256 indexed teleporterMessageID, - uint256 burnAddressBalance - ); + event ReportTotalBurnedTxFees(uint256 indexed teleporterMessageID, uint256 burnAddressBalance); /** * @dev Burns native tokens on the destination contract chain, and sends a message to the source diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol index 9ba712f12..d7a88f62b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/ITokenSource.sol @@ -6,7 +6,7 @@ pragma solidity 0.8.18; /** - * @dev Interface for common functionality needed for different `TokenSource` contracts such as + * @dev Interface for common functionality needed for different `TokenSource` contracts such as * `NativeTokenSource` and `ERC20TokenSource`. */ interface ITokenSource { @@ -17,7 +17,7 @@ interface ITokenSource { Unlock, Burn } - + /** * @dev Emitted when native tokens are locked in the source contract to be transferred to the destination chain. */ @@ -37,4 +37,4 @@ interface ITokenSource { * @dev Emitted when tokens are burned on this chain. */ event BurnTokens(uint256 amount); -} \ No newline at end of file +} diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol index 3d8648619..ed4c6e8f2 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenDestination.sol @@ -11,7 +11,11 @@ import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.so import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; import {INativeTokenDestination} from "./INativeTokenDestination.sol"; import {ITokenSource} from "./ITokenSource.sol"; -import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + ITeleporterMessenger, + TeleporterFeeInfo, + TeleporterMessageInput +} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -20,17 +24,13 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // solhint-disable-next-line no-unused-import import {IAllowList} from "@subnet-evm-contracts/interfaces/IAllowList.sol"; -contract NativeTokenDestination is - ITeleporterReceiver, - INativeTokenDestination, - ReentrancyGuard -{ - // The address where the burned transaction fees are credited. - // Defined as BLACKHOLE_ADDRESS at +contract NativeTokenDestination is ITeleporterReceiver, INativeTokenDestination, ReentrancyGuard { + // The address where the burned transaction fees are credited. + // Defined as BLACKHOLE_ADDRESS at // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; - // Designated Blackhole Address for this contract. Tokens are sent here to be "burned" before - // sending an unlock message to the source chain. Different from the burned tx fee address so + // Designated Blackhole Address for this contract. Tokens are sent here to be "burned" before + // sending an unlock message to the source chain. Different from the burned tx fee address so // they can be tracked separately. address public constant BURN_FOR_TRANSFER_ADDRESS = 0x0100000000000000000000000000000000000001; @@ -64,13 +64,11 @@ contract NativeTokenDestination is teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); require( - sourceBlockchainID_ != bytes32(0), - "NativeTokenDestination: zero source blockchain ID" + sourceBlockchainID_ != bytes32(0), "NativeTokenDestination: zero source blockchain ID" ); require( - sourceBlockchainID_ != - IWarpMessenger(0x0200000000000000000000000000000000000005) - .getBlockchainID(), + sourceBlockchainID_ + != IWarpMessenger(0x0200000000000000000000000000000000000005).getBlockchainID(), "NativeTokenDestination: cannot bridge with same blockchain" ); sourceBlockchainID = sourceBlockchainID_; @@ -82,8 +80,7 @@ contract NativeTokenDestination is nativeTokenSourceAddress = nativeTokenSourceAddress_; require( - initialReserveImbalance_ != 0, - "NativeTokenDestination: zero initial reserve imbalance" + initialReserveImbalance_ != 0, "NativeTokenDestination: zero initial reserve imbalance" ); initialReserveImbalance = initialReserveImbalance_; @@ -108,24 +105,16 @@ contract NativeTokenDestination is // Only allow messages from the source chain. require( - senderBlockchainID == sourceBlockchainID, - "NativeTokenDestination: invalid source chain" + senderBlockchainID == sourceBlockchainID, "NativeTokenDestination: invalid source chain" ); // Only allow the partner contract to send messages. require( - senderAddress == nativeTokenSourceAddress, - "NativeTokenDestination: unauthorized sender" + senderAddress == nativeTokenSourceAddress, "NativeTokenDestination: unauthorized sender" ); - (address recipient, uint256 amount) = abi.decode( - message, - (address, uint256) - ); - require( - recipient != address(0), - "NativeTokenDestination: zero recipient address" - ); + (address recipient, uint256 amount) = abi.decode(message, (address, uint256)); + require(recipient != address(0), "NativeTokenDestination: zero recipient address"); require(amount != 0, "NativeTokenDestination: zero transfer value"); // If the contract has not yet been collateralized, we will deduct as many tokens @@ -134,18 +123,12 @@ contract NativeTokenDestination is uint256 adjustedAmount = amount; if (currentReserveImbalance > 0) { if (amount > currentReserveImbalance) { - emit CollateralAdded({ - amount: currentReserveImbalance, - remaining: 0 - }); + emit CollateralAdded({amount: currentReserveImbalance, remaining: 0}); adjustedAmount = amount - currentReserveImbalance; currentReserveImbalance = 0; } else { currentReserveImbalance -= amount; - emit CollateralAdded({ - amount: amount, - remaining: currentReserveImbalance - }); + emit CollateralAdded({amount: amount, remaining: currentReserveImbalance}); return; } } @@ -165,14 +148,10 @@ contract NativeTokenDestination is address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. - require( - recipient != address(0), - "NativeTokenDestination: zero recipient address" - ); + require(recipient != address(0), "NativeTokenDestination: zero recipient address"); require( - currentReserveImbalance == 0, - "NativeTokenDestination: contract undercollateralized" + currentReserveImbalance == 0, "NativeTokenDestination: contract undercollateralized" ); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token @@ -181,13 +160,10 @@ contract NativeTokenDestination is uint256 adjustedFeeAmount; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeInfo.feeTokenAddress), - feeInfo.amount + IERC20(feeInfo.feeTokenAddress), feeInfo.amount ); SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.feeTokenAddress), - address(teleporterMessenger), - adjustedFeeAmount + IERC20(feeInfo.feeTokenAddress), address(teleporterMessenger), adjustedFeeAmount ); } @@ -201,10 +177,7 @@ contract NativeTokenDestination is feeInfo: feeInfo, requiredGasLimit: TRANSFER_NATIVE_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, - message: abi.encode( - ITokenSource.SourceAction.Unlock, - abi.encode(recipient, msg.value) - ) + message: abi.encode(ITokenSource.SourceAction.Unlock, abi.encode(recipient, msg.value)) }) ); @@ -231,10 +204,7 @@ contract NativeTokenDestination is feeInfo: feeInfo, requiredGasLimit: REPORT_BURNED_TOKENS_REQUIRED_GAS, allowedRelayerAddresses: allowedRelayerAddresses, - message: abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(totalBurnedTxFees) - ) + message: abi.encode(ITokenSource.SourceAction.Burn, abi.encode(totalBurnedTxFees)) }) ); @@ -255,8 +225,8 @@ contract NativeTokenDestination is * @dev See {INativeTokenDestination-totalSupply}. */ function totalSupply() external view returns (uint256) { - uint256 burned = address(BURNED_TX_FEES_ADDRESS).balance + - address(BURN_FOR_TRANSFER_ADDRESS).balance; + uint256 burned = + address(BURNED_TX_FEES_ADDRESS).balance + address(BURN_FOR_TRANSFER_ADDRESS).balance; uint256 created = totalMinted + initialReserveImbalance; return created - burned; diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol index 75a238518..c49cae759 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/NativeTokenSource.sol @@ -10,7 +10,11 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import {INativeTokenSource} from "./INativeTokenSource.sol"; import {ITokenSource} from "./ITokenSource.sol"; -import {ITeleporterMessenger, TeleporterFeeInfo, TeleporterMessageInput} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + ITeleporterMessenger, + TeleporterFeeInfo, + TeleporterMessageInput +} from "../../Teleporter/ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../../Teleporter/ITeleporterReceiver.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; import {SafeERC20TransferFrom} from "../../Teleporter/SafeERC20TransferFrom.sol"; @@ -26,8 +30,7 @@ contract NativeTokenSource is // The address where the burned transaction fees are credited. // Defined as BLACKHOLE_ADDRESS at // https://github.com/ava-labs/subnet-evm/blob/e23ab058d039ff9c8469c89b139d21d52c4bd283/constants/constants.go - address public constant BURNED_TX_FEES_ADDRESS = - 0x0100000000000000000000000000000000000000; + address public constant BURNED_TX_FEES_ADDRESS = 0x0100000000000000000000000000000000000000; uint256 public constant MINT_NATIVE_TOKENS_REQUIRED_GAS = 100_000; // Used to keep track of tokens burned through transactions on the destination chain. They can // be reported to this contract to burn an equivalent number of tokens on this chain. @@ -54,9 +57,8 @@ contract NativeTokenSource is "NativeTokenSource: zero destination blockchain ID" ); require( - destinationBlockchainID_ != - IWarpMessenger(0x0200000000000000000000000000000000000005) - .getBlockchainID(), + destinationBlockchainID_ + != IWarpMessenger(0x0200000000000000000000000000000000000005).getBlockchainID(), "NativeTokenSource: cannot bridge with same blockchain" ); destinationBlockchainID = destinationBlockchainID_; @@ -92,22 +94,15 @@ contract NativeTokenSource is // Only allow the partner contract to send messages. require( - senderAddress == nativeTokenDestinationAddress, - "NativeTokenSource: unauthorized sender" + senderAddress == nativeTokenDestinationAddress, "NativeTokenSource: unauthorized sender" ); // Decode the payload to recover the action and corresponding function parameters - (SourceAction action, bytes memory actionData) = abi.decode( - message, - (SourceAction, bytes) - ); + (SourceAction action, bytes memory actionData) = abi.decode(message, (SourceAction, bytes)); // Route to the appropriate function. if (action == SourceAction.Unlock) { - (address recipient, uint256 amount) = abi.decode( - actionData, - (address, uint256) - ); + (address recipient, uint256 amount) = abi.decode(actionData, (address, uint256)); _unlockTokens(recipient, amount); } else if (action == SourceAction.Burn) { uint256 newBurnTotal = abi.decode(actionData, (uint256)); @@ -126,10 +121,7 @@ contract NativeTokenSource is address[] calldata allowedRelayerAddresses ) external payable nonReentrant { // The recipient cannot be the zero address. - require( - recipient != address(0), - "NativeTokenSource: zero recipient address" - ); + require(recipient != address(0), "NativeTokenSource: zero recipient address"); // Lock tokens in this bridge instance. Supports "fee/burn on transfer" ERC20 token // implementations by only bridging the actual balance increase reflected by the call @@ -137,13 +129,10 @@ contract NativeTokenSource is uint256 adjustedFeeAmount; if (feeInfo.amount > 0) { adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeInfo.feeTokenAddress), - feeInfo.amount + IERC20(feeInfo.feeTokenAddress), feeInfo.amount ); SafeERC20.safeIncreaseAllowance( - IERC20(feeInfo.feeTokenAddress), - address(teleporterMessenger), - adjustedFeeAmount + IERC20(feeInfo.feeTokenAddress), address(teleporterMessenger), adjustedFeeAmount ); } @@ -170,14 +159,8 @@ contract NativeTokenSource is * @dev Unlocks tokens to recipient. */ function _unlockTokens(address recipient, uint256 amount) private { - require( - recipient != address(0), - "NativeTokenSource: zero recipient address" - ); - require( - address(this).balance >= amount, - "NativeTokenSource: insufficient collateral" - ); + require(recipient != address(0), "NativeTokenSource: zero recipient address"); + require(address(this).balance >= amount, "NativeTokenSource: insufficient collateral"); // Transfer to recipient emit UnlockTokens(recipient, amount); diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol index 3afd106d2..d986aff04 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/ERC20TokenSourceTests.t.sol @@ -6,7 +6,15 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {ERC20TokenSource, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../ERC20TokenSource.sol"; +import { + ERC20TokenSource, + IERC20, + ITokenSource, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger, + ITeleporterMessenger +} from "../ERC20TokenSource.sol"; import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; contract ERC20TokenSourceTest is Test { @@ -16,14 +24,11 @@ contract ERC20TokenSourceTest is Test { address(0x0200000000000000000000000000000000000005); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; - address private constant _DEFAULT_RECIPIENT = - 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; @@ -47,15 +52,12 @@ contract ERC20TokenSourceTest is Test { ); vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeWithSelector( - ITeleporterMessenger.sendCrossChainMessage.selector - ), + abi.encodeWithSelector(ITeleporterMessenger.sendCrossChainMessage.selector), abi.encode(1) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + WARP_PRECOMPILE_ADDRESS, abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) ); mockERC20 = new UnitTestMockERC20(); @@ -67,14 +69,10 @@ contract ERC20TokenSourceTest is Test { ); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.allowance.selector), - abi.encode(1234) + address(mockERC20), abi.encodeWithSelector(IERC20.allowance.selector), abi.encode(1234) ); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.approve.selector), - abi.encode(true) + address(mockERC20), abi.encodeWithSelector(IERC20.approve.selector), abi.encode(true) ); } @@ -87,26 +85,21 @@ contract ERC20TokenSourceTest is Test { teleporterMessageID: 1 }); - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), - requiredGasLimit: erc20TokenSource - .MINT_NATIVE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) - }); + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: erc20TokenSource.MINT_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + }); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); erc20TokenSource.transferToDestination( @@ -121,7 +114,7 @@ contract ERC20TokenSourceTest is Test { // Give the contract some tokens to burn. erc20TokenSource.transferToDestination( _DEFAULT_RECIPIENT, - _DEFAULT_TRANSFER_AMOUNT * 2 + _DEFAULT_FEE_AMOUNT , + _DEFAULT_TRANSFER_AMOUNT * 2 + _DEFAULT_FEE_AMOUNT, _DEFAULT_FEE_AMOUNT, new address[](0) ); @@ -162,10 +155,7 @@ contract ERC20TokenSourceTest is Test { erc20TokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees)) ); assertEq(burnedTxFees, erc20TokenSource.destinationBurnedTotal()); @@ -175,10 +165,7 @@ contract ERC20TokenSourceTest is Test { erc20TokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees - 1) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees - 1)) ); assertEq(burnedTxFees, erc20TokenSource.destinationBurnedTotal()); @@ -190,22 +177,18 @@ contract ERC20TokenSourceTest is Test { erc20TokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees + additionalTxFees) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees + additionalTxFees)) ); assertEq(burnedTxFees + additionalTxFees, erc20TokenSource.destinationBurnedTotal()); - assertEq(burnedTxFees + additionalTxFees, mockERC20.balanceOf(erc20TokenSource.BURNED_TX_FEES_ADDRESS())); + assertEq( + burnedTxFees + additionalTxFees, + mockERC20.balanceOf(erc20TokenSource.BURNED_TX_FEES_ADDRESS()) + ); } function testZeroTeleporterAddress() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "zero TeleporterMessenger address" - ) - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero TeleporterMessenger address")); new ERC20TokenSource( address(0x0), @@ -216,11 +199,7 @@ contract ERC20TokenSourceTest is Test { } function testZeroDestinationChainID() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "zero destination blockchain ID" - ) - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero destination blockchain ID")); new ERC20TokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -231,11 +210,7 @@ contract ERC20TokenSourceTest is Test { } function testSameBlockchainID() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "cannot bridge with same blockchain" - ) - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("cannot bridge with same blockchain")); new ERC20TokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -246,11 +221,7 @@ contract ERC20TokenSourceTest is Test { } function testZeroDestinationContractAddress() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "zero destination contract address" - ) - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero destination contract address")); new ERC20TokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -261,11 +232,7 @@ contract ERC20TokenSourceTest is Test { } function testZeroERC20ContractAddress() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "zero ERC20 contract address" - ) - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero ERC20 contract address")); new ERC20TokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -277,9 +244,7 @@ contract ERC20TokenSourceTest is Test { function testInvalidTeleporterAddress() public { vm.expectRevert( - _formatERC20TokenSourceErrorMessage( - "unauthorized TeleporterMessenger contract" - ) + _formatERC20TokenSourceErrorMessage("unauthorized TeleporterMessenger contract") ); vm.prank(address(0x123)); @@ -294,9 +259,7 @@ contract ERC20TokenSourceTest is Test { } function testInvalidDestinationBlockchain() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage("invalid destination chain") - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("invalid destination chain")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); erc20TokenSource.receiveTeleporterMessage( @@ -310,9 +273,7 @@ contract ERC20TokenSourceTest is Test { } function testInvalidSenderContract() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage("unauthorized sender") - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("unauthorized sender")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); erc20TokenSource.receiveTeleporterMessage( @@ -326,25 +287,20 @@ contract ERC20TokenSourceTest is Test { } function testInvalidRecipientAddress() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero recipient address")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); erc20TokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, abi.encode( - ITokenSource.SourceAction.Unlock, - abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) + ITokenSource.SourceAction.Unlock, abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) ) ); } function testZeroRecipient() public { - vm.expectRevert( - _formatERC20TokenSourceErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatERC20TokenSourceErrorMessage("zero recipient address")); erc20TokenSource.transferToDestination( address(0x0), @@ -354,9 +310,11 @@ contract ERC20TokenSourceTest is Test { ); } - function _formatERC20TokenSourceErrorMessage( - string memory errorMessage - ) private pure returns (bytes memory) { + function _formatERC20TokenSourceErrorMessage(string memory errorMessage) + private + pure + returns (bytes memory) + { return bytes(string.concat("ERC20TokenSource: ", errorMessage)); } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol index 32e65b470..a78a501f0 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenDestinationTests.t.sol @@ -6,7 +6,15 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {NativeTokenDestination, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenDestination.sol"; +import { + NativeTokenDestination, + IERC20, + ITokenSource, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger, + ITeleporterMessenger +} from "../NativeTokenDestination.sol"; import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; import {INativeMinter} from "@subnet-evm-contracts/interfaces/INativeMinter.sol"; @@ -19,14 +27,11 @@ contract NativeTokenDestinationTest is Test { address(0x0200000000000000000000000000000000000001); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; - address private constant _DEFAULT_RECIPIENT = - 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; @@ -41,10 +46,7 @@ contract NativeTokenDestinationTest is Test { ); event CollateralAdded(uint256 amount, uint256 remaining); event NativeTokensMinted(address indexed recipient, uint256 amount); - event ReportTotalBurnedTxFees( - uint256 indexed teleporterMessageID, - uint256 burnAddressBalance - ); + event ReportTotalBurnedTxFees(uint256 indexed teleporterMessageID, uint256 burnAddressBalance); function setUp() public virtual { vm.mockCall( @@ -59,15 +61,12 @@ contract NativeTokenDestinationTest is Test { ); vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeWithSelector( - ITeleporterMessenger.sendCrossChainMessage.selector - ), + abi.encodeWithSelector(ITeleporterMessenger.sendCrossChainMessage.selector), abi.encode(1) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + WARP_PRECOMPILE_ADDRESS, abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) ); nativeTokenDestination = new NativeTokenDestination( @@ -79,23 +78,16 @@ contract NativeTokenDestinationTest is Test { mockERC20 = new UnitTestMockERC20(); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.allowance.selector), - abi.encode(1234) + address(mockERC20), abi.encodeWithSelector(IERC20.allowance.selector), abi.encode(1234) ); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.approve.selector), - abi.encode(true) + address(mockERC20), abi.encodeWithSelector(IERC20.approve.selector), abi.encode(true) ); } function collateralizeBridge() public { vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); - emit CollateralAdded({ - amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, - remaining: 0 - }); + emit CollateralAdded({amount: _DEFAULT_INITIAL_RESERVE_IMBALANCE, remaining: 0}); // We shouldn't mint anything here. vm.expectCall( @@ -110,7 +102,6 @@ contract NativeTokenDestinationTest is Test { _DEFAULT_OTHER_BRIDGE_ADDRESS, abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_INITIAL_RESERVE_IMBALANCE) ); - vm.stopPrank(); } function testTransferToSource() public { @@ -124,39 +115,29 @@ contract NativeTokenDestinationTest is Test { teleporterMessageID: 1 }); - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), - requiredGasLimit: nativeTokenDestination - .TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: abi.encode( - ITokenSource.SourceAction.Unlock, - abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: nativeTokenDestination.TRANSFER_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode( + ITokenSource.SourceAction.Unlock, + abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) ) - }); + }); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); - nativeTokenDestination.transferToSource{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenDestination.transferToSource{value: _DEFAULT_TRANSFER_AMOUNT}( _DEFAULT_RECIPIENT, - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } @@ -179,7 +160,10 @@ contract NativeTokenDestinationTest is Test { abi.encode(_DEFAULT_RECIPIENT, firstTransfer) ); - assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, nativeTokenDestination.currentReserveImbalance()); + assertEq( + _DEFAULT_INITIAL_RESERVE_IMBALANCE - firstTransfer, + nativeTokenDestination.currentReserveImbalance() + ); assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE, nativeTokenDestination.totalSupply()); vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); @@ -203,59 +187,43 @@ contract NativeTokenDestinationTest is Test { ); assertEq(0, nativeTokenDestination.currentReserveImbalance()); - assertEq(_DEFAULT_INITIAL_RESERVE_IMBALANCE + firstTransfer, nativeTokenDestination.totalSupply()); + assertEq( + _DEFAULT_INITIAL_RESERVE_IMBALANCE + firstTransfer, nativeTokenDestination.totalSupply() + ); } function testReportBurnedTxFees() public { - uint256 burnedFees = nativeTokenDestination - .BURNED_TX_FEES_ADDRESS() - .balance; + uint256 burnedFees = nativeTokenDestination.BURNED_TX_FEES_ADDRESS().balance; vm.expectEmit(true, true, true, true, address(nativeTokenDestination)); - emit ReportTotalBurnedTxFees({ - burnAddressBalance: burnedFees, - teleporterMessageID: 1 - }); + emit ReportTotalBurnedTxFees({burnAddressBalance: burnedFees, teleporterMessageID: 1}); - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), - requiredGasLimit: nativeTokenDestination - .REPORT_BURNED_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedFees) - ) - }); + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: nativeTokenDestination.REPORT_BURNED_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedFees)) + }); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); nativeTokenDestination.reportTotalBurnedTxFees( - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } function testZeroTeleporterAddress() public { vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "zero TeleporterMessenger address" - ) + _formatNativeTokenDestinationErrorMessage("zero TeleporterMessenger address") ); new NativeTokenDestination( @@ -267,11 +235,7 @@ contract NativeTokenDestinationTest is Test { } function testZeroSourceChainID() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "zero source blockchain ID" - ) - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source blockchain ID")); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -283,9 +247,7 @@ contract NativeTokenDestinationTest is Test { function testSameBlockchainID() public { vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "cannot bridge with same blockchain" - ) + _formatNativeTokenDestinationErrorMessage("cannot bridge with same blockchain") ); new NativeTokenDestination( @@ -297,11 +259,7 @@ contract NativeTokenDestinationTest is Test { } function testZeroSourceContractAddress() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "zero source contract address" - ) - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero source contract address")); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -312,11 +270,7 @@ contract NativeTokenDestinationTest is Test { } function testZeroInitialReserveImbalance() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "zero initial reserve imbalance" - ) - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero initial reserve imbalance")); new NativeTokenDestination( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -328,9 +282,7 @@ contract NativeTokenDestinationTest is Test { function testInvalidTeleporterAddress() public { vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "unauthorized TeleporterMessenger contract" - ) + _formatNativeTokenDestinationErrorMessage("unauthorized TeleporterMessenger contract") ); vm.prank(address(0x123)); @@ -342,9 +294,7 @@ contract NativeTokenDestinationTest is Test { } function testInvalidSourceBlockchain() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage("invalid source chain") - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("invalid source chain")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -355,9 +305,7 @@ contract NativeTokenDestinationTest is Test { } function testInvalidSenderContract() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage("unauthorized sender") - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("unauthorized sender")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -368,9 +316,7 @@ contract NativeTokenDestinationTest is Test { } function testInvalidRecipientAddress() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero recipient address")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -381,9 +327,7 @@ contract NativeTokenDestinationTest is Test { } function testInvalidTransferAmount() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage("zero transfer value") - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero transfer value")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenDestination.receiveTeleporterMessage( @@ -395,44 +339,30 @@ contract NativeTokenDestinationTest is Test { function testZeroRecipient() public { collateralizeBridge(); - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("zero recipient address")); - nativeTokenDestination.transferToSource{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenDestination.transferToSource{value: _DEFAULT_TRANSFER_AMOUNT}( address(0x0), - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } function testUncollateralizedBridge() public { - vm.expectRevert( - _formatNativeTokenDestinationErrorMessage( - "contract undercollateralized" - ) - ); + vm.expectRevert(_formatNativeTokenDestinationErrorMessage("contract undercollateralized")); - nativeTokenDestination.transferToSource{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenDestination.transferToSource{value: _DEFAULT_TRANSFER_AMOUNT}( _DEFAULT_RECIPIENT, - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } - function _formatNativeTokenDestinationErrorMessage( - string memory errorMessage - ) private pure returns (bytes memory) { + function _formatNativeTokenDestinationErrorMessage(string memory errorMessage) + private + pure + returns (bytes memory) + { return bytes(string.concat("NativeTokenDestination: ", errorMessage)); } } diff --git a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol index 0091ca6f0..1a531603b 100644 --- a/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol +++ b/contracts/src/CrossChainApplications/NativeTokenBridge/tests/NativeTokenSourceTests.t.sol @@ -6,7 +6,15 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {NativeTokenSource, IERC20, ITokenSource, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, ITeleporterMessenger} from "../NativeTokenSource.sol"; +import { + NativeTokenSource, + IERC20, + ITokenSource, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger, + ITeleporterMessenger +} from "../NativeTokenSource.sol"; import {UnitTestMockERC20} from "../../../Mocks/UnitTestMockERC20.sol"; contract NativeTokenSourceTest is Test { @@ -16,14 +24,11 @@ contract NativeTokenSourceTest is Test { address(0x0200000000000000000000000000000000000005); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); bytes32 private constant _DEFAULT_OTHER_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); address private constant _DEFAULT_OTHER_BRIDGE_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; uint256 private constant _DEFAULT_INITIAL_RESERVE_IMBALANCE = 1000000000; - address private constant _DEFAULT_RECIPIENT = - 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; + address private constant _DEFAULT_RECIPIENT = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; uint256 private constant _DEFAULT_TRANSFER_AMOUNT = 1e18; uint256 private constant _DEFAULT_FEE_AMOUNT = 123456; @@ -47,15 +52,12 @@ contract NativeTokenSourceTest is Test { ); vm.mockCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeWithSelector( - ITeleporterMessenger.sendCrossChainMessage.selector - ), + abi.encodeWithSelector(ITeleporterMessenger.sendCrossChainMessage.selector), abi.encode(1) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) + WARP_PRECOMPILE_ADDRESS, abi.encodeWithSelector(IWarpMessenger.getBlockchainID.selector) ); nativeTokenSource = new NativeTokenSource( @@ -66,14 +68,10 @@ contract NativeTokenSourceTest is Test { mockERC20 = new UnitTestMockERC20(); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.allowance.selector), - abi.encode(1234) + address(mockERC20), abi.encodeWithSelector(IERC20.allowance.selector), abi.encode(1234) ); vm.mockCall( - address(mockERC20), - abi.encodeWithSelector(IERC20.approve.selector), - abi.encode(true) + address(mockERC20), abi.encodeWithSelector(IERC20.approve.selector), abi.encode(true) ); } @@ -86,50 +84,35 @@ contract NativeTokenSourceTest is Test { teleporterMessageID: 1 }); - TeleporterMessageInput - memory expectedMessageInput = TeleporterMessageInput({ - destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, - destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), - requiredGasLimit: nativeTokenSource - .MINT_NATIVE_TOKENS_REQUIRED_GAS(), - allowedRelayerAddresses: new address[](0), - message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) - }); + TeleporterMessageInput memory expectedMessageInput = TeleporterMessageInput({ + destinationBlockchainID: _DEFAULT_OTHER_CHAIN_ID, + destinationAddress: _DEFAULT_OTHER_BRIDGE_ADDRESS, + feeInfo: TeleporterFeeInfo({ + feeTokenAddress: address(mockERC20), + amount: _DEFAULT_FEE_AMOUNT + }), + requiredGasLimit: nativeTokenSource.MINT_NATIVE_TOKENS_REQUIRED_GAS(), + allowedRelayerAddresses: new address[](0), + message: abi.encode(_DEFAULT_RECIPIENT, _DEFAULT_TRANSFER_AMOUNT) + }); vm.expectCall( MOCK_TELEPORTER_MESSENGER_ADDRESS, - abi.encodeCall( - ITeleporterMessenger.sendCrossChainMessage, - (expectedMessageInput) - ) + abi.encodeCall(ITeleporterMessenger.sendCrossChainMessage, (expectedMessageInput)) ); - nativeTokenSource.transferToDestination{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenSource.transferToDestination{value: _DEFAULT_TRANSFER_AMOUNT}( _DEFAULT_RECIPIENT, - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } function testUnlock() public { // Give the contract some tokens to burn. - nativeTokenSource.transferToDestination{ - value: _DEFAULT_TRANSFER_AMOUNT * 2 - }( + nativeTokenSource.transferToDestination{value: _DEFAULT_TRANSFER_AMOUNT * 2}( _DEFAULT_RECIPIENT, - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); @@ -151,14 +134,9 @@ contract NativeTokenSourceTest is Test { function testBurnedTxFees() public { // Give the contract some tokens to burn. - nativeTokenSource.transferToDestination{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenSource.transferToDestination{value: _DEFAULT_TRANSFER_AMOUNT}( _DEFAULT_RECIPIENT, - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); @@ -173,10 +151,7 @@ contract NativeTokenSourceTest is Test { nativeTokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees)) ); assertEq(burnedTxFees, nativeTokenSource.destinationBurnedTotal()); @@ -186,10 +161,7 @@ contract NativeTokenSourceTest is Test { nativeTokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees - 1) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees - 1)) ); assertEq(burnedTxFees, nativeTokenSource.destinationBurnedTotal()); @@ -201,22 +173,17 @@ contract NativeTokenSourceTest is Test { nativeTokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, - abi.encode( - ITokenSource.SourceAction.Burn, - abi.encode(burnedTxFees + additionalTxFees) - ) + abi.encode(ITokenSource.SourceAction.Burn, abi.encode(burnedTxFees + additionalTxFees)) ); assertEq(burnedTxFees + additionalTxFees, nativeTokenSource.destinationBurnedTotal()); - assertEq(burnedTxFees + additionalTxFees, nativeTokenSource.BURNED_TX_FEES_ADDRESS().balance); + assertEq( + burnedTxFees + additionalTxFees, nativeTokenSource.BURNED_TX_FEES_ADDRESS().balance + ); } function testZeroTeleporterAddress() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage( - "zero TeleporterMessenger address" - ) - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("zero TeleporterMessenger address")); new NativeTokenSource( address(0x0), @@ -226,11 +193,7 @@ contract NativeTokenSourceTest is Test { } function testZeroDestinationChainID() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage( - "zero destination blockchain ID" - ) - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("zero destination blockchain ID")); new NativeTokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -240,11 +203,7 @@ contract NativeTokenSourceTest is Test { } function testSameBlockchainID() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage( - "cannot bridge with same blockchain" - ) - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("cannot bridge with same blockchain")); new NativeTokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -254,11 +213,7 @@ contract NativeTokenSourceTest is Test { } function testZeroDestinationContractAddress() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage( - "zero destination contract address" - ) - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("zero destination contract address")); new NativeTokenSource( MOCK_TELEPORTER_MESSENGER_ADDRESS, @@ -269,9 +224,7 @@ contract NativeTokenSourceTest is Test { function testInvalidTeleporterAddress() public { vm.expectRevert( - _formatNativeTokenSourceErrorMessage( - "unauthorized TeleporterMessenger contract" - ) + _formatNativeTokenSourceErrorMessage("unauthorized TeleporterMessenger contract") ); vm.prank(address(0x123)); @@ -286,9 +239,7 @@ contract NativeTokenSourceTest is Test { } function testInvalidDestinationBlockchain() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage("invalid destination chain") - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("invalid destination chain")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenSource.receiveTeleporterMessage( @@ -302,9 +253,7 @@ contract NativeTokenSourceTest is Test { } function testInvalidSenderContract() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage("unauthorized sender") - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("unauthorized sender")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenSource.receiveTeleporterMessage( @@ -318,43 +267,31 @@ contract NativeTokenSourceTest is Test { } function testInvalidRecipientAddress() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("zero recipient address")); vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, _DEFAULT_OTHER_BRIDGE_ADDRESS, abi.encode( - ITokenSource.SourceAction.Unlock, - abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) + ITokenSource.SourceAction.Unlock, abi.encode(address(0x0), _DEFAULT_TRANSFER_AMOUNT) ) ); } function testZeroRecipient() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage("zero recipient address") - ); + vm.expectRevert(_formatNativeTokenSourceErrorMessage("zero recipient address")); - nativeTokenSource.transferToDestination{ - value: _DEFAULT_TRANSFER_AMOUNT - }( + nativeTokenSource.transferToDestination{value: _DEFAULT_TRANSFER_AMOUNT}( address(0x0), - TeleporterFeeInfo({ - feeTokenAddress: address(mockERC20), - amount: _DEFAULT_FEE_AMOUNT - }), + TeleporterFeeInfo({feeTokenAddress: address(mockERC20), amount: _DEFAULT_FEE_AMOUNT}), new address[](0) ); } function testInsufficientCollateral() public { - vm.expectRevert( - _formatNativeTokenSourceErrorMessage("insufficient collateral") - ); - + vm.expectRevert(_formatNativeTokenSourceErrorMessage("insufficient collateral")); + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); nativeTokenSource.receiveTeleporterMessage( _DEFAULT_OTHER_CHAIN_ID, @@ -366,9 +303,11 @@ contract NativeTokenSourceTest is Test { ); } - function _formatNativeTokenSourceErrorMessage( - string memory errorMessage - ) private pure returns (bytes memory) { + function _formatNativeTokenSourceErrorMessage(string memory errorMessage) + private + pure + returns (bytes memory) + { return bytes(string.concat("NativeTokenSource: ", errorMessage)); } } diff --git a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol index 93550a5fd..8efea4225 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol @@ -5,7 +5,9 @@ pragma solidity 0.8.18; -import {TeleporterMessageInput, TeleporterFeeInfo} from "../../Teleporter/ITeleporterMessenger.sol"; +import { + TeleporterMessageInput, TeleporterFeeInfo +} from "../../Teleporter/ITeleporterMessenger.sol"; import {TeleporterRegistry} from "../../Teleporter/upgrades/TeleporterRegistry.sol"; /** @@ -52,25 +54,16 @@ contract BlockHashPublisher { // The originBlockchainID and originSenderAddress arguments of the target function are provided by Warp/Teleporter. bytes memory messageData = abi.encode(blockHeight, blockHash); - emit PublishBlockHash( - destinationBlockchainID, - destinationAddress, - blockHeight, - blockHash + emit PublishBlockHash(destinationBlockchainID, destinationAddress, blockHeight, blockHash); + return teleporterRegistry.getLatestTeleporter().sendCrossChainMessage( + TeleporterMessageInput({ + destinationBlockchainID: destinationBlockchainID, + destinationAddress: destinationAddress, + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(0), amount: 0}), + requiredGasLimit: RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT, + allowedRelayerAddresses: new address[](0), + message: messageData + }) ); - return - teleporterRegistry.getLatestTeleporter().sendCrossChainMessage( - TeleporterMessageInput({ - destinationBlockchainID: destinationBlockchainID, - destinationAddress: destinationAddress, - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(0), - amount: 0 - }), - requiredGasLimit: RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT, - allowedRelayerAddresses: new address[](0), - message: messageData - }) - ); } } diff --git a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol index a4e327ed4..c49dde823 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol @@ -62,28 +62,19 @@ contract BlockHashReceiver is TeleporterOwnerUpgradeable { bytes memory message ) internal override { require( - originBlockchainID == sourceBlockchainID, - "BlockHashReceiver: invalid source chain ID" + originBlockchainID == sourceBlockchainID, "BlockHashReceiver: invalid source chain ID" ); require( originSenderAddress == sourcePublisherContractAddress, "BlockHashReceiver: invalid source chain publisher" ); - (uint256 blockHeight, bytes32 blockHash) = abi.decode( - message, - (uint256, bytes32) - ); + (uint256 blockHeight, bytes32 blockHash) = abi.decode(message, (uint256, bytes32)); if (blockHeight > latestBlockHeight) { latestBlockHeight = blockHeight; latestBlockHash = blockHash; - emit ReceiveBlockHash( - originBlockchainID, - originSenderAddress, - blockHeight, - blockHash - ); + emit ReceiveBlockHash(originBlockchainID, originSenderAddress, blockHeight, blockHash); } } } diff --git a/contracts/src/Mocks/ExampleERC20.sol b/contracts/src/Mocks/ExampleERC20.sol index a851bebf0..a8b521a3b 100644 --- a/contracts/src/Mocks/ExampleERC20.sol +++ b/contracts/src/Mocks/ExampleERC20.sol @@ -5,7 +5,9 @@ pragma solidity 0.8.18; -import {ERC20Burnable, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import { + ERC20Burnable, ERC20 +} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; contract ExampleERC20 is ERC20Burnable { string private constant _TOKEN_NAME = "Mock Token"; diff --git a/contracts/src/Mocks/UnitTestMockERC20.sol b/contracts/src/Mocks/UnitTestMockERC20.sol index 9217604a6..b72a3ea1b 100644 --- a/contracts/src/Mocks/UnitTestMockERC20.sol +++ b/contracts/src/Mocks/UnitTestMockERC20.sol @@ -20,11 +20,7 @@ contract UnitTestMockERC20 { // The mock allows anyone to call transferFrom to increment the balance of the // receipt address. Neither the call or sender need to have sufficient balances to send, // we just increment the balance the of the recipient. - function transferFrom( - address from, - address to, - uint256 amount - ) public returns (bool) { + function transferFrom(address from, address to, uint256 amount) public returns (bool) { uint256 feeAmount = feeOnTransferSenders[from]; mockBalances[to] += (amount - feeAmount); return true; @@ -33,10 +29,7 @@ contract UnitTestMockERC20 { // The mock allows anyone to call transferFrom to increment the balance of the // receipt address. Neither the caller or sender need to have sufficient balances to send, // we just increment the balance the of the recipient. - function transfer( - address to, - uint256 amount - ) public returns (bool) { + function transfer(address to, uint256 amount) public returns (bool) { uint256 feeAmount = feeOnTransferSenders[msg.sender]; mockBalances[to] += (amount - feeAmount); return true; diff --git a/contracts/src/Teleporter/ITeleporterMessenger.sol b/contracts/src/Teleporter/ITeleporterMessenger.sol index 3bc8d0750..882729624 100644 --- a/contracts/src/Teleporter/ITeleporterMessenger.sol +++ b/contracts/src/Teleporter/ITeleporterMessenger.sol @@ -77,9 +77,7 @@ interface ITeleporterMessenger { * but message execution fails. Failed messages can then be retried with `retryMessageExecution` */ event MessageExecutionFailed( - bytes32 indexed originBlockchainID, - uint256 indexed messageID, - TeleporterMessage message + bytes32 indexed originBlockchainID, uint256 indexed messageID, TeleporterMessage message ); /** @@ -89,10 +87,7 @@ interface ITeleporterMessenger { * * Each message received can be executed successfully at most once. */ - event MessageExecuted( - bytes32 indexed originBlockchainID, - uint256 indexed messageID - ); + event MessageExecuted(bytes32 indexed originBlockchainID, uint256 indexed messageID); /** * @dev Emitted when a TeleporterMessage is successfully received. @@ -108,19 +103,15 @@ interface ITeleporterMessenger { /** * @dev Emitted when an account redeems accumulated relayer rewards. */ - event RelayerRewardsRedeemed( - address indexed redeemer, - address indexed asset, - uint256 amount - ); + event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); /** * @dev Called by transactions to initiate the sending of a cross-chain message. * @return The message ID of the newly sent message. */ - function sendCrossChainMessage( - TeleporterMessageInput calldata messageInput - ) external returns (uint256); + function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) + external + returns (uint256); /** * @dev Called by transactions to retry the sending of a cross-chain message. @@ -157,10 +148,7 @@ interface ITeleporterMessenger { * The message specified by `messageIndex` must be provided at that index in the access list storage slots of the transaction, * and is verified in the precompile predicate. */ - function receiveCrossChainMessage( - uint32 messageIndex, - address relayerRewardAddress - ) external; + function receiveCrossChainMessage(uint32 messageIndex, address relayerRewardAddress) external; /** * @dev Retries the execution of a previously delivered message by verifying the payload matches @@ -252,9 +240,7 @@ interface ITeleporterMessenger { * @dev Gets the number of receipts that are waiting to be sent to the given origin chain ID. * @return Size of the given queue. */ - function getReceiptQueueSize( - bytes32 originBlockchainID - ) external view returns (uint256); + function getReceiptQueueSize(bytes32 originBlockchainID) external view returns (uint256); /** * @dev Gets the receipt at the given index in the queue for the given origin chain ID. diff --git a/contracts/src/Teleporter/ReceiptQueue.sol b/contracts/src/Teleporter/ReceiptQueue.sol index 166848c80..3ea31ec95 100644 --- a/contracts/src/Teleporter/ReceiptQueue.sol +++ b/contracts/src/Teleporter/ReceiptQueue.sol @@ -47,9 +47,10 @@ library ReceiptQueue { * Requirements: * - The queue must be non-empty. */ - function dequeue( - TeleporterMessageReceiptQueue storage queue - ) internal returns (TeleporterMessageReceipt memory result) { + function dequeue(TeleporterMessageReceiptQueue storage queue) + internal + returns (TeleporterMessageReceipt memory result) + { uint256 first_ = queue.first; require(queue.last != first_, "ReceiptQueue: empty queue"); result = queue.data[first_]; @@ -60,9 +61,10 @@ library ReceiptQueue { /** * @dev Returns the outstanding receipts for the given chain ID that should be included in the next message sent. */ - function getOutstandingReceiptsToSend( - TeleporterMessageReceiptQueue storage queue - ) internal returns (TeleporterMessageReceipt[] memory result) { + function getOutstandingReceiptsToSend(TeleporterMessageReceiptQueue storage queue) + internal + returns (TeleporterMessageReceipt[] memory result) + { // Calculate the result size as the minimum of the number of receipts and maximum batch size. uint256 resultSize = Math.min(_MAXIMUM_RECEIPT_COUNT, size(queue)); if (resultSize == 0) { @@ -78,9 +80,7 @@ library ReceiptQueue { /** * @dev Returns the number of outstanding receipts in the queue. */ - function size( - TeleporterMessageReceiptQueue storage queue - ) internal view returns (uint256) { + function size(TeleporterMessageReceiptQueue storage queue) internal view returns (uint256) { return queue.last - queue.first; } diff --git a/contracts/src/Teleporter/ReentrancyGuards.sol b/contracts/src/Teleporter/ReentrancyGuards.sol index b4455496e..da6ea28e6 100644 --- a/contracts/src/Teleporter/ReentrancyGuards.sol +++ b/contracts/src/Teleporter/ReentrancyGuards.sol @@ -27,10 +27,7 @@ abstract contract ReentrancyGuards { // This modifier should be used for messenger sender functions that have external calls and do not want to allow // recursive calls with other sender functions. modifier senderNonReentrant() { - require( - _sendEntered == _NOT_ENTERED, - "ReentrancyGuards: sender reentrancy" - ); + require(_sendEntered == _NOT_ENTERED, "ReentrancyGuards: sender reentrancy"); _sendEntered = _ENTERED; _; _sendEntered = _NOT_ENTERED; @@ -40,10 +37,7 @@ abstract contract ReentrancyGuards { // This modifier should be used for messenger receiver functions that have external calls and do not want to allow // recursive calls with other receiver functions. modifier receiverNonReentrant() { - require( - _receiveEntered == _NOT_ENTERED, - "ReentrancyGuards: receiver reentrancy" - ); + require(_receiveEntered == _NOT_ENTERED, "ReentrancyGuards: receiver reentrancy"); _receiveEntered = _ENTERED; _; _receiveEntered = _NOT_ENTERED; diff --git a/contracts/src/Teleporter/SafeERC20TransferFrom.sol b/contracts/src/Teleporter/SafeERC20TransferFrom.sol index 717a58621..d18c75e8f 100644 --- a/contracts/src/Teleporter/SafeERC20TransferFrom.sol +++ b/contracts/src/Teleporter/SafeERC20TransferFrom.sol @@ -28,18 +28,12 @@ library SafeERC20TransferFrom { * increase. Designed for safely handling ERC20 "fee on transfer" and "burn on transfer" implementations. */ // solhint-disable private-vars-leading-underscore - function safeTransferFrom( - IERC20 erc20, - uint256 amount - ) internal returns (uint256) { + function safeTransferFrom(IERC20 erc20, uint256 amount) internal returns (uint256) { uint256 balanceBefore = erc20.balanceOf(address(this)); erc20.safeTransferFrom(msg.sender, address(this), amount); uint256 balanceAfter = erc20.balanceOf(address(this)); - require( - balanceAfter > balanceBefore, - "SafeERC20TransferFrom: balance not increased" - ); + require(balanceAfter > balanceBefore, "SafeERC20TransferFrom: balance not increased"); return balanceAfter - balanceBefore; } diff --git a/contracts/src/Teleporter/TeleporterMessenger.sol b/contracts/src/Teleporter/TeleporterMessenger.sol index b6abe185d..970ec35f8 100644 --- a/contracts/src/Teleporter/TeleporterMessenger.sol +++ b/contracts/src/Teleporter/TeleporterMessenger.sol @@ -8,7 +8,13 @@ pragma solidity 0.8.18; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {WarpMessage, IWarpMessenger} from "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; -import {TeleporterMessageReceipt, TeleporterMessageInput, TeleporterMessage, TeleporterFeeInfo, ITeleporterMessenger} from "./ITeleporterMessenger.sol"; +import { + TeleporterMessageReceipt, + TeleporterMessageInput, + TeleporterMessage, + TeleporterFeeInfo, + ITeleporterMessenger +} from "./ITeleporterMessenger.sol"; import {ReceiptQueue} from "./ReceiptQueue.sol"; import {SafeERC20TransferFrom} from "./SafeERC20TransferFrom.sol"; import {ITeleporterReceiver} from "./ITeleporterReceiver.sol"; @@ -43,8 +49,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Tracks the latest message ID used for a given destination chain. // Key is the destination blockchain ID, and the value is the last message ID used for that chain. // Note that the first message ID used for each chain will be 1 (not 0). - mapping(bytes32 destinationBlockchainID => uint256 messageID) - public latestMessageIDs; + mapping(bytes32 destinationBlockchainID => uint256 messageID) public latestMessageIDs; // Tracks the outstanding receipts to send back to a given chain in subsequent messages sent to that chain. // Key is the blockchain ID of the other chain, and the value is a queue of pending receipts for messages @@ -56,28 +61,32 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // with a receipt. The messages are tracked per chain and keyed by message ID. // The first key is the blockchain ID of the destination chain, the second key is the message ID, and the value is the info // for the uniquely identified message. - mapping(bytes32 destinationBlockchainID => mapping(uint256 messageID => SentMessageInfo messageInfo)) - public sentMessageInfo; + mapping( + bytes32 destinationBlockchainID => mapping(uint256 messageID => SentMessageInfo messageInfo) + ) public sentMessageInfo; // Tracks the hash of messages that have been received but whose execution has never succeeded. // Enables retrying of failed messages with higher gas limits. Message execution is guaranteed to // succeed at most once. The first key is the blockchain ID of the sending chain, the second key is the message ID, and // the value is the hash of the uniquely identified message whose execution failed. - mapping(bytes32 sourceBlockchainID => mapping(uint256 messageID => bytes32 messageHash)) - public receivedFailedMessageHashes; + mapping(bytes32 sourceBlockchainID => mapping(uint256 messageID => bytes32 messageHash)) public + receivedFailedMessageHashes; // Tracks the relayer reward address for each message delivered from a given chain. // Note that these values are also used to determine if a given message has been delivered or not. // The first key is the blockchain ID, the second key is the message ID, and the value is the reward address // provided by the deliverer of the uniquely identified message. - mapping(bytes32 sourceBlockchainID => mapping(uint256 messageID => address relayerRewardAddress)) - internal _relayerRewardAddresses; + mapping( + bytes32 sourceBlockchainID => mapping(uint256 messageID => address relayerRewardAddress) + ) internal _relayerRewardAddresses; // Tracks the reward amounts for a given asset able to be redeemed by a given relayer. // The first key is the relayer reward address, the second key is the fee token contract address, // and the value is the amount of the asset redeemable by the relayer. - mapping(address relayerRewardAddress => mapping(address feeTokenContract => uint256 redeemableRewardAmount)) - internal _relayerRewardAmounts; + mapping( + address relayerRewardAddress + => mapping(address feeTokenContract => uint256 redeemableRewardAmount) + ) internal _relayerRewardAmounts; /** * @dev See {ITeleporterMessenger-sendCrossChainMessage} @@ -87,18 +96,18 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { * * Emits a {SendCrossChainMessage} event when message successfully gets sent. */ - function sendCrossChainMessage( - TeleporterMessageInput calldata messageInput - ) external senderNonReentrant returns (uint256) { + function sendCrossChainMessage(TeleporterMessageInput calldata messageInput) + external + senderNonReentrant + returns (uint256) + { // Get the outstanding receipts for messages that have been previously received // from the destination chain but not yet acknowledged, and attach the receipts // to the Teleporter message to be sent. - return - _sendTeleporterMessage( - messageInput, - receiptQueues[messageInput.destinationBlockchainID] - .getOutstandingReceiptsToSend() - ); + return _sendTeleporterMessage( + messageInput, + receiptQueues[messageInput.destinationBlockchainID].getOutstandingReceiptsToSend() + ); } /** @@ -115,13 +124,11 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { TeleporterMessage calldata message ) external senderNonReentrant { // Get the previously sent message hash. - SentMessageInfo memory existingMessageInfo = sentMessageInfo[ - destinationBlockchainID - ][message.messageID]; + SentMessageInfo memory existingMessageInfo = + sentMessageInfo[destinationBlockchainID][message.messageID]; // If the message hash is zero, the message was never sent. require( - existingMessageInfo.messageHash != bytes32(0), - "TeleporterMessenger: message not found" + existingMessageInfo.messageHash != bytes32(0), "TeleporterMessenger: message not found" ); // Check that the hash of the provided message matches the one that was originally submitted. @@ -134,10 +141,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Emit and make state variable changes before external calls when possible, // though this function is protected by sender reentrancy guard. emit SendCrossChainMessage( - destinationBlockchainID, - message.messageID, - message, - existingMessageInfo.feeInfo + destinationBlockchainID, message.messageID, message, existingMessageInfo.feeInfo ); // Resubmit the message to the warp precompile now that we know @@ -162,23 +166,18 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { uint256 additionalFeeAmount ) external senderNonReentrant { // The additional fee amount must be non-zero. - require( - additionalFeeAmount > 0, - "TeleporterMessenger: zero additional fee amount" - ); + require(additionalFeeAmount > 0, "TeleporterMessenger: zero additional fee amount"); // Do not allow adding a fee asset with contract address zero. require( - feeTokenAddress != address(0), - "TeleporterMessenger: zero fee asset contract address" + feeTokenAddress != address(0), "TeleporterMessenger: zero fee asset contract address" ); // If a receipt has been received for this message, its hash and fee information // will be cleared from state. At this point, you can not add to its fee. This is also the // case if the given message never existed. require( - sentMessageInfo[destinationBlockchainID][messageID].messageHash != - bytes32(0), + sentMessageInfo[destinationBlockchainID][messageID].messageHash != bytes32(0), "TeleporterMessenger: message not found" ); @@ -188,22 +187,17 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // the previously submitted asset type as a defensive measure to avoid having users accidentally confuse // which asset they are paying. require( - sentMessageInfo[destinationBlockchainID][messageID] - .feeInfo - .feeTokenAddress == feeTokenAddress, + sentMessageInfo[destinationBlockchainID][messageID].feeInfo.feeTokenAddress + == feeTokenAddress, "TeleporterMessenger: invalid fee asset contract address" ); // Transfer the additional fee amount to this Teleporter instance. - uint256 adjustedAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(feeTokenAddress), - additionalFeeAmount - ); + uint256 adjustedAmount = + SafeERC20TransferFrom.safeTransferFrom(IERC20(feeTokenAddress), additionalFeeAmount); // Store the updated fee amount, and emit it as an event. - sentMessageInfo[destinationBlockchainID][messageID] - .feeInfo - .amount += adjustedAmount; + sentMessageInfo[destinationBlockchainID][messageID].feeInfo.amount += adjustedAmount; emit AddFeeAmount( destinationBlockchainID, @@ -233,14 +227,13 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // The relayer reward address is not allowed to be the zero address because it is how the // contract tracks whether or not a message has been delivered. require( - relayerRewardAddress != address(0), - "TeleporterMessenger: zero relayer reward address" + relayerRewardAddress != address(0), "TeleporterMessenger: zero relayer reward address" ); // Verify and parse the cross chain message included in the transaction access list // using the warp message precompile. - (WarpMessage memory warpMessage, bool success) = WARP_MESSENGER - .getVerifiedWarpMessage(messageIndex); + (WarpMessage memory warpMessage, bool success) = + WARP_MESSENGER.getVerifiedWarpMessage(messageIndex); require(success, "TeleporterMessenger: invalid warp message"); // Only allow for messages to be received from the same address as this teleporter contract. @@ -260,10 +253,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { } // Parse the payload of the message. - TeleporterMessage memory teleporterMessage = abi.decode( - warpMessage.payload, - (TeleporterMessage) - ); + TeleporterMessage memory teleporterMessage = + abi.decode(warpMessage.payload, (TeleporterMessage)); // Require that the message was intended for this blockchain. require( @@ -273,51 +264,38 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Require that the message has not been delivered previously. require( - !_messageReceived( - warpMessage.sourceChainID, - teleporterMessage.messageID - ), + !_messageReceived(warpMessage.sourceChainID, teleporterMessage.messageID), "TeleporterMessenger: message already delivered" ); // Check that the caller is allowed to deliver this message. require( - _checkIsAllowedRelayer( - msg.sender, - teleporterMessage.allowedRelayerAddresses - ), + _checkIsAllowedRelayer(msg.sender, teleporterMessage.allowedRelayerAddresses), "TeleporterMessenger: unauthorized relayer" ); // Store the relayer reward address provided, effectively marking the message as received. - _relayerRewardAddresses[warpMessage.sourceChainID][ - teleporterMessage.messageID - ] = relayerRewardAddress; + _relayerRewardAddresses[warpMessage.sourceChainID][teleporterMessage.messageID] = + relayerRewardAddress; // Execute the message. if (teleporterMessage.message.length > 0) { - _handleInitialMessageExecution( - warpMessage.sourceChainID, - teleporterMessage - ); + _handleInitialMessageExecution(warpMessage.sourceChainID, teleporterMessage); } // Process the receipts that were included in the teleporter message by paying the // fee for the messages are reward to the given relayers. uint256 length = teleporterMessage.receipts.length; for (uint256 i; i < length; ++i) { - TeleporterMessageReceipt memory receipt = teleporterMessage - .receipts[i]; + TeleporterMessageReceipt memory receipt = teleporterMessage.receipts[i]; _markReceipt( - warpMessage.sourceChainID, - receipt.receivedMessageID, - receipt.relayerRewardAddress + warpMessage.sourceChainID, receipt.receivedMessageID, receipt.relayerRewardAddress ); } // Store the receipt of this message delivery. - ReceiptQueue.TeleporterMessageReceiptQueue - storage receiptsQueue = receiptQueues[warpMessage.sourceChainID]; + ReceiptQueue.TeleporterMessageReceiptQueue storage receiptsQueue = + receiptQueues[warpMessage.sourceChainID]; receiptsQueue.enqueue( TeleporterMessageReceipt({ @@ -355,13 +333,9 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { TeleporterMessage calldata message ) external receiverNonReentrant { // Check that the hash of the payload provided matches the hash of the payload that previously failed to execute. - bytes32 failedMessageHash = receivedFailedMessageHashes[ - originBlockchainID - ][message.messageID]; - require( - failedMessageHash != bytes32(0), - "TeleporterMessenger: message not found" - ); + bytes32 failedMessageHash = + receivedFailedMessageHashes[originBlockchainID][message.messageID]; + require(failedMessageHash != bytes32(0), "TeleporterMessenger: message not found"); require( keccak256(abi.encode(message)) == failedMessageHash, "TeleporterMessenger: invalid message hash" @@ -394,11 +368,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // the relayer should still receive their reward even if the message execution takes more gas than expected. // Require that the call be successful such that in the failure case this transaction reverts and the // message can be retried again if desired. - bool success = _tryExecuteMessage( - message.destinationAddress, - gasleft(), - payload - ); + bool success = _tryExecuteMessage(message.destinationAddress, gasleft(), payload); require(success, "TeleporterMessenger: retry execution failed"); } @@ -426,20 +396,15 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { address[] calldata allowedRelayerAddresses ) external senderNonReentrant returns (uint256) { // Iterate through the specified message IDs and create teleporter receipts to send back. - TeleporterMessageReceipt[] - memory receiptsToSend = new TeleporterMessageReceipt[]( + TeleporterMessageReceipt[] memory receiptsToSend = new TeleporterMessageReceipt[]( messageIDs.length ); for (uint256 i; i < messageIDs.length; ++i) { uint256 receivedMessageID = messageIDs[i]; // Get the relayer reward address for the message. - address relayerRewardAddress = _relayerRewardAddresses[ - originBlockchainID - ][receivedMessageID]; - require( - relayerRewardAddress != address(0), - "TeleporterMessenger: receipt not found" - ); + address relayerRewardAddress = + _relayerRewardAddresses[originBlockchainID][receivedMessageID]; + require(relayerRewardAddress != address(0), "TeleporterMessenger: receipt not found"); receiptsToSend[i] = TeleporterMessageReceipt({ receivedMessageID: receivedMessageID, @@ -447,18 +412,17 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { }); } - return - _sendTeleporterMessage( - TeleporterMessageInput({ - destinationBlockchainID: originBlockchainID, - destinationAddress: address(0), - feeInfo: feeInfo, - requiredGasLimit: uint256(0), - allowedRelayerAddresses: allowedRelayerAddresses, - message: new bytes(0) - }), - receiptsToSend - ); + return _sendTeleporterMessage( + TeleporterMessageInput({ + destinationBlockchainID: originBlockchainID, + destinationAddress: address(0), + feeInfo: feeInfo, + requiredGasLimit: uint256(0), + allowedRelayerAddresses: allowedRelayerAddresses, + message: new bytes(0) + }), + receiptsToSend + ); } /** @@ -531,27 +495,22 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 destinationBlockchainID, uint256 messageID ) external view returns (address, uint256) { - TeleporterFeeInfo memory feeInfo = sentMessageInfo[ - destinationBlockchainID - ][messageID].feeInfo; + TeleporterFeeInfo memory feeInfo = + sentMessageInfo[destinationBlockchainID][messageID].feeInfo; return (feeInfo.feeTokenAddress, feeInfo.amount); } /** * @dev Returns the next message ID to be used to send a message to the given blockchain ID. */ - function getNextMessageID( - bytes32 destinationBlockchainID - ) external view returns (uint256) { + function getNextMessageID(bytes32 destinationBlockchainID) external view returns (uint256) { return _getNextMessageID(destinationBlockchainID); } /** * @dev See {ITeleporterMessenger-getReceiptQueueSize} */ - function getReceiptQueueSize( - bytes32 originBlockchainID - ) external view returns (uint256) { + function getReceiptQueueSize(bytes32 originBlockchainID) external view returns (uint256) { return receiptQueues[originBlockchainID].size(); } @@ -573,9 +532,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 originBlockchainID, uint256 messageID ) internal view returns (bool) { - return - _relayerRewardAddresses[originBlockchainID][messageID] != - address(0); + return _relayerRewardAddresses[originBlockchainID][messageID] != address(0); } /** @@ -611,9 +568,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { TeleporterMessageReceipt[] memory receipts ) private returns (uint256) { // Get the message ID to use for this message. - uint256 messageID = _getNextMessageID( - messageInput.destinationBlockchainID - ); + uint256 messageID = _getNextMessageID(messageInput.destinationBlockchainID); // Construct and serialize the message. TeleporterMessage memory teleporterMessage = TeleporterMessage({ @@ -644,8 +599,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { ); adjustedFeeAmount = SafeERC20TransferFrom.safeTransferFrom( - IERC20(messageInput.feeInfo.feeTokenAddress), - messageInput.feeInfo.amount + IERC20(messageInput.feeInfo.feeTokenAddress), messageInput.feeInfo.amount ); } @@ -655,18 +609,13 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { feeTokenAddress: messageInput.feeInfo.feeTokenAddress, amount: adjustedFeeAmount }); - sentMessageInfo[messageInput.destinationBlockchainID][ - messageID - ] = SentMessageInfo({ + sentMessageInfo[messageInput.destinationBlockchainID][messageID] = SentMessageInfo({ messageHash: keccak256(teleporterMessageBytes), feeInfo: adjustedFeeInfo }); emit SendCrossChainMessage( - messageInput.destinationBlockchainID, - messageID, - teleporterMessage, - adjustedFeeInfo + messageInput.destinationBlockchainID, messageID, teleporterMessage, adjustedFeeInfo ); // Submit the message to the AWM precompile. @@ -687,9 +636,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { address relayerRewardAddress ) private { // Get the information about the sent message to be marked as received. - SentMessageInfo memory messageInfo = sentMessageInfo[ - destinationBlockchainID - ][messageID]; + SentMessageInfo memory messageInfo = sentMessageInfo[destinationBlockchainID][messageID]; // If the message hash does not exist, it could be the case that the receipt was already // received for this message (it's possible for receipts to be sent more than once) @@ -704,9 +651,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Increment the fee/reward amount owed to the relayer for having delivered // the message identified in this receipt. - _relayerRewardAmounts[relayerRewardAddress][ - messageInfo.feeInfo.feeTokenAddress - ] += messageInfo.feeInfo.amount; + _relayerRewardAmounts[relayerRewardAddress][messageInfo.feeInfo.feeTokenAddress] += + messageInfo.feeInfo.amount; } /** @@ -731,10 +677,7 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // its execution succeeds, such that the relayer can claim their fee reward. However, if the message // execution fails, the message hash will be stored in state such that anyone can try to provide more // gas to successfully execute the message. - require( - gasleft() >= message.requiredGasLimit, - "TeleporterMessenger: insufficient gas" - ); + require(gasleft() >= message.requiredGasLimit, "TeleporterMessenger: insufficient gas"); // The destination address must have fully initialized contract code in order for the message // to call it. If the destination address does not have code, store the message as a failed @@ -754,11 +697,8 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { // Call the destination address of the message with the formatted call data. Only provide the required // gas limit to the sub-call so that the end application cannot consume an arbitrary amount of gas. - bool success = _tryExecuteMessage( - message.destinationAddress, - message.requiredGasLimit, - payload - ); + bool success = + _tryExecuteMessage(message.destinationAddress, message.requiredGasLimit, payload); // If the execution failed, store a hash of the message in state such that its // execution can be retried again in the future with a higher gas limit (paid by whoever @@ -785,15 +725,16 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bool success; // solhint-disable-next-line no-inline-assembly assembly { - success := call( - gasLimit, // gas provided to the call - target, // call target - 0, // zero value - add(payload, 0x20), // input data - 0x20 needs to be added to an array because the first 32-byte slot contains the array length (0x20 in hex is 32 in decimal). - mload(payload), // input data size - mload returns mem[p..(p+32)], which is the first 32-byte slot of the array. In this case, the array length. - 0, // output - 0 // output size - ) + success := + call( + gasLimit, // gas provided to the call + target, // call target + 0, // zero value + add(payload, 0x20), // input data - 0x20 needs to be added to an array because the first 32-byte slot contains the array length (0x20 in hex is 32 in decimal). + mload(payload), // input data size - mload returns mem[p..(p+32)], which is the first 32-byte slot of the array. In this case, the array length. + 0, // output + 0 // output size + ) } return success; } @@ -806,24 +747,17 @@ contract TeleporterMessenger is ITeleporterMessenger, ReentrancyGuards { bytes32 originBlockchainID, TeleporterMessage memory message ) private { - receivedFailedMessageHashes[originBlockchainID][ - message.messageID - ] = keccak256(abi.encode(message)); + receivedFailedMessageHashes[originBlockchainID][message.messageID] = + keccak256(abi.encode(message)); // Emit a failed execution event for anyone monitoring unsuccessful messages to retry. - emit MessageExecutionFailed( - originBlockchainID, - message.messageID, - message - ); + emit MessageExecutionFailed(originBlockchainID, message.messageID, message); } /** * @dev Returns the next message ID to be used to send a message to the given `originBlockchainID`. */ - function _getNextMessageID( - bytes32 originBlockchainID - ) private view returns (uint256) { + function _getNextMessageID(bytes32 originBlockchainID) private view returns (uint256) { return latestMessageIDs[originBlockchainID] + 1; } } diff --git a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol index 6186d65c6..f4edf8e57 100644 --- a/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol +++ b/contracts/src/Teleporter/tests/AddFeeAmountTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterFeeInfo, TeleporterMessageReceipt, IERC20} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterFeeInfo, + TeleporterMessageReceipt, + IERC20 +} from "./TeleporterMessengerTest.t.sol"; contract AddFeeAmountTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -18,10 +23,7 @@ contract AddFeeAmountTest is TeleporterMessengerTest { function testSuccess() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Add to the fee uint256 additionalFeeAmount = 131313; @@ -30,32 +32,22 @@ contract AddFeeAmountTest is TeleporterMessengerTest { address(_mockFeeAsset), abi.encodeCall( IERC20.transferFrom, - ( - address(this), - address(teleporterMessenger), - additionalFeeAmount - ) + (address(this), address(teleporterMessenger), additionalFeeAmount) ) ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit AddFeeAmount( DEFAULT_DESTINATION_CHAIN_ID, messageID, - TeleporterFeeInfo({ - feeTokenAddress: address(_mockFeeAsset), - amount: totalFeeAmount - }) + TeleporterFeeInfo({feeTokenAddress: address(_mockFeeAsset), amount: totalFeeAmount}) ); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - address(_mockFeeAsset), - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, address(_mockFeeAsset), additionalFeeAmount ); // Get the fee info to make sure it is properly updated. - (address actualFeeAsset, uint256 actualFeeAmount) = teleporterMessenger - .getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); + (address actualFeeAsset, uint256 actualFeeAmount) = + teleporterMessenger.getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); assertEq(actualFeeAsset, address(_mockFeeAsset)); assertEq(actualFeeAmount, totalFeeAmount); } @@ -66,120 +58,78 @@ contract AddFeeAmountTest is TeleporterMessengerTest { uint256 fakeMessageID = 13; vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - fakeMessageID, - address(_mockFeeAsset), - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID, address(_mockFeeAsset), additionalFeeAmount ); } function testMessageAlreadyDelivered() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Now mock receiving a message back from that subnet with a receipt of the above message. address relayerRewardAddress = 0xA66884fAdC0D4d7B7eedcF61Eb863Ff413bB6234; - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](1); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](1); receipts[0] = TeleporterMessageReceipt({ receivedMessageID: messageID, relayerRewardAddress: relayerRewardAddress }); - _receiveTestMessage( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - relayerRewardAddress, - receipts - ); + _receiveTestMessage(DEFAULT_DESTINATION_CHAIN_ID, messageID, relayerRewardAddress, receipts); // Now try to add to the fee of the message. Should revert since the message receipt was received already. uint256 additionalFeeAmount = 131313; vm.expectRevert(_formatTeleporterErrorMessage("message not found")); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - address(_mockFeeAsset), - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, address(_mockFeeAsset), additionalFeeAmount ); } function testInvalidAmount() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Expect revert when adding 0 additional amount. uint256 additionalFeeAmount = 0; - vm.expectRevert( - _formatTeleporterErrorMessage("zero additional fee amount") - ); + vm.expectRevert(_formatTeleporterErrorMessage("zero additional fee amount")); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - address(_mockFeeAsset), - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, address(_mockFeeAsset), additionalFeeAmount ); } function testMismatchFeeAsset() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Expect revert when using a different fee asset than originally used. uint256 additionalFeeAmount = 131313; address differentFeeAsset = 0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664; - vm.expectRevert( - _formatTeleporterErrorMessage("invalid fee asset contract address") - ); + vm.expectRevert(_formatTeleporterErrorMessage("invalid fee asset contract address")); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - differentFeeAsset, - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, differentFeeAsset, additionalFeeAmount ); } function testInvalidFeeAsset() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Expect revert when using an invalid fee asset. uint256 additionalFeeAmount = 131313; address invalidFeeAsset = address(0); - vm.expectRevert( - _formatTeleporterErrorMessage("zero fee asset contract address") - ); + vm.expectRevert(_formatTeleporterErrorMessage("zero fee asset contract address")); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - invalidFeeAsset, - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, invalidFeeAsset, additionalFeeAmount ); } function testInsufficientBalance() public { // First submit a message with a small fee uint256 originalFeeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - originalFeeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, originalFeeAmount); // Add to the fee, but mock the ERC20 contract returning an error from transferFrom uint256 additionalFeeAmount = 131313; @@ -187,32 +137,21 @@ contract AddFeeAmountTest is TeleporterMessengerTest { address(_mockFeeAsset), abi.encodeCall( IERC20.transferFrom, - ( - address(this), - address(teleporterMessenger), - additionalFeeAmount - ) + (address(this), address(teleporterMessenger), additionalFeeAmount) ) ); vm.mockCall( address(_mockFeeAsset), abi.encodeCall( IERC20.transferFrom, - ( - address(this), - address(teleporterMessenger), - additionalFeeAmount - ) + (address(this), address(teleporterMessenger), additionalFeeAmount) ), abi.encode(false) ); vm.expectRevert("SafeERC20: ERC20 operation did not succeed"); teleporterMessenger.addFeeAmount( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - address(_mockFeeAsset), - additionalFeeAmount + DEFAULT_DESTINATION_CHAIN_ID, messageID, address(_mockFeeAsset), additionalFeeAmount ); } } diff --git a/contracts/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol b/contracts/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol index a7b4a3dda..bfe5ff039 100644 --- a/contracts/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol +++ b/contracts/src/Teleporter/tests/CheckAllowedRelayerTests.t.sol @@ -25,10 +25,9 @@ contract CheckIsAllowedRelayerTest is TeleporterMessenger, Test { relayerAddresses[2] = 0xfFfFfFFffFB57Dd9A4ddcD02f88A98D0Eb6c2598; address[] memory allowedRelayers = new address[](0); - for (uint256 i = 0; i < relayerAddresses.length; i++) - assertTrue( - _checkIsAllowedRelayer(relayerAddresses[i], allowedRelayers) - ); + for (uint256 i = 0; i < relayerAddresses.length; i++) { + assertTrue(_checkIsAllowedRelayer(relayerAddresses[i], allowedRelayers)); + } } function testUnauthorizedRelayer() public { diff --git a/contracts/src/Teleporter/tests/GetFeeInfoTests.t.sol b/contracts/src/Teleporter/tests/GetFeeInfoTests.t.sol index 8ff6e0e5d..3a7ca7239 100644 --- a/contracts/src/Teleporter/tests/GetFeeInfoTests.t.sol +++ b/contracts/src/Teleporter/tests/GetFeeInfoTests.t.sol @@ -18,14 +18,11 @@ contract GetFeeInfoTest is TeleporterMessengerTest { function testSuccess() public { // First submit a message with a fee uint256 feeAmount = 1687435413; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - feeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, feeAmount); // Get the fee info to make sure it is correct. - (address actualFeeAsset, uint256 actualFeeAmount) = teleporterMessenger - .getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); + (address actualFeeAsset, uint256 actualFeeAmount) = + teleporterMessenger.getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); assertEq(actualFeeAsset, address(_mockFeeAsset)); assertEq(actualFeeAmount, feeAmount); } @@ -36,15 +33,12 @@ contract GetFeeInfoTest is TeleporterMessengerTest { uint256 feeAmount = 1687435413; uint256 tokenTransferFee = 35413; _mockFeeAsset.setFeeOnTransferSender(address(this), tokenTransferFee); - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - feeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, feeAmount); // Get the fee info to make sure it is correct, including the fee amount being less than // the amount specified when submitting the message due to the "fee on token transfer". - (address actualFeeAsset, uint256 actualFeeAmount) = teleporterMessenger - .getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); + (address actualFeeAsset, uint256 actualFeeAmount) = + teleporterMessenger.getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); assertEq(actualFeeAsset, address(_mockFeeAsset)); assertEq(actualFeeAmount, feeAmount - tokenTransferFee); } @@ -52,29 +46,20 @@ contract GetFeeInfoTest is TeleporterMessengerTest { function testAfterReceipt() public { // First submit a message with a small fee uint256 feeAmount = 10; - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - feeAmount - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, feeAmount); // Now mock receiving a message back from that subnet with a receipt of the above message. address relayerRewardAddress = 0xA66884fAdC0D4d7B7eedcF61Eb863Ff413bB6234; - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](1); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](1); receipts[0] = TeleporterMessageReceipt({ receivedMessageID: messageID, relayerRewardAddress: relayerRewardAddress }); - _receiveTestMessage( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - relayerRewardAddress, - receipts - ); + _receiveTestMessage(DEFAULT_DESTINATION_CHAIN_ID, messageID, relayerRewardAddress, receipts); // Now, if we get the fee info for the message it should be reported as zero since the receipt has already been received. - (address actualFeeAsset, uint256 actualFeeAmount) = teleporterMessenger - .getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); + (address actualFeeAsset, uint256 actualFeeAmount) = + teleporterMessenger.getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, messageID); assertEq(actualFeeAsset, address(0)); assertEq(actualFeeAmount, 0); } @@ -83,8 +68,8 @@ contract GetFeeInfoTest is TeleporterMessengerTest { uint256 fakeMessageID = 4646; // Get the fee info to make sure it is zero since the message doesn't exist. - (address actualFeeAsset, uint256 actualFeeAmount) = teleporterMessenger - .getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID); + (address actualFeeAsset, uint256 actualFeeAmount) = + teleporterMessenger.getFeeInfo(DEFAULT_DESTINATION_CHAIN_ID, fakeMessageID); assertEq(actualFeeAsset, address(0)); assertEq(actualFeeAmount, 0); } diff --git a/contracts/src/Teleporter/tests/GetMessageHashTests.t.sol b/contracts/src/Teleporter/tests/GetMessageHashTests.t.sol index a7f4cc44b..f27190030 100644 --- a/contracts/src/Teleporter/tests/GetMessageHashTests.t.sol +++ b/contracts/src/Teleporter/tests/GetMessageHashTests.t.sol @@ -5,7 +5,11 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt +} from "./TeleporterMessengerTest.t.sol"; contract GetMessageHashTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -17,9 +21,7 @@ contract GetMessageHashTest is TeleporterMessengerTest { function testSuccess() public { // Submit a message - uint256 messageID = _sendTestMessageWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID - ); + uint256 messageID = _sendTestMessageWithNoFee(DEFAULT_DESTINATION_CHAIN_ID); TeleporterMessage memory expectedMessage = TeleporterMessage({ messageID: messageID, senderAddress: address(this), @@ -34,51 +36,31 @@ contract GetMessageHashTest is TeleporterMessengerTest { bytes32 expectedMessageHash = keccak256(expectedMessageBytes); // Get its stored hash - bytes32 actualMessageHash = teleporterMessenger.getMessageHash( - DEFAULT_DESTINATION_CHAIN_ID, - messageID - ); + bytes32 actualMessageHash = + teleporterMessenger.getMessageHash(DEFAULT_DESTINATION_CHAIN_ID, messageID); assertEq(actualMessageHash, expectedMessageHash); } function testMessageDoesNotExist() public { - assertEq( - teleporterMessenger.getMessageHash( - DEFAULT_DESTINATION_CHAIN_ID, - 42 - ), - bytes32(0) - ); + assertEq(teleporterMessenger.getMessageHash(DEFAULT_DESTINATION_CHAIN_ID, 42), bytes32(0)); } function testMessageAlreadyReceived() public { // Submit a message - uint256 messageID = _sendTestMessageWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID - ); + uint256 messageID = _sendTestMessageWithNoFee(DEFAULT_DESTINATION_CHAIN_ID); // Now mock receiving a message back from that subnet with a receipt of the above message. address relayerRewardAddress = 0xA66884fAdC0D4d7B7eedcF61Eb863Ff413bB6234; - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](1); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](1); receipts[0] = TeleporterMessageReceipt({ receivedMessageID: messageID, relayerRewardAddress: relayerRewardAddress }); - _receiveTestMessage( - DEFAULT_DESTINATION_CHAIN_ID, - messageID, - relayerRewardAddress, - receipts - ); + _receiveTestMessage(DEFAULT_DESTINATION_CHAIN_ID, messageID, relayerRewardAddress, receipts); // Now the message hash should be cleared. assertEq( - teleporterMessenger.getMessageHash( - DEFAULT_DESTINATION_CHAIN_ID, - messageID - ), - bytes32(0) + teleporterMessenger.getMessageHash(DEFAULT_DESTINATION_CHAIN_ID, messageID), bytes32(0) ); } } diff --git a/contracts/src/Teleporter/tests/GetNextMessageIdTests.t.sol b/contracts/src/Teleporter/tests/GetNextMessageIdTests.t.sol index 0241276c9..50d440908 100644 --- a/contracts/src/Teleporter/tests/GetNextMessageIdTests.t.sol +++ b/contracts/src/Teleporter/tests/GetNextMessageIdTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger +} from "./TeleporterMessengerTest.t.sol"; contract GetNextMessageIDTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -16,17 +21,15 @@ contract GetNextMessageIDTest is TeleporterMessengerTest { } function testFirstMessageID() public { - bytes32 blockchainID = bytes32( - hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); + bytes32 blockchainID = + bytes32(hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff"); assertEq(teleporterMessenger.getNextMessageID(blockchainID), 1); } function testSecondMessageID() public { - bytes32 blockchainID = bytes32( - hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); + bytes32 blockchainID = + bytes32(hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff"); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -36,10 +39,7 @@ contract GetNextMessageIDTest is TeleporterMessengerTest { TeleporterMessageInput memory messageInput = TeleporterMessageInput({ destinationBlockchainID: blockchainID, destinationAddress: address(0), - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(0), - amount: uint256(0) - }), + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(0), amount: uint256(0)}), requiredGasLimit: 1e6, allowedRelayerAddresses: new address[](0), message: new bytes(0) @@ -53,12 +53,10 @@ contract GetNextMessageIDTest is TeleporterMessengerTest { } function testOtherDestinationSubnetID() public { - bytes32 blockchainID = bytes32( - hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); - bytes32 otherBlockchainID = bytes32( - hex"00000000556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); + bytes32 blockchainID = + bytes32(hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff"); + bytes32 otherBlockchainID = + bytes32(hex"00000000556677889900aabbccddeeff11223344556677889900aabbccddeeff"); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -68,10 +66,7 @@ contract GetNextMessageIDTest is TeleporterMessengerTest { TeleporterMessageInput memory messageInput = TeleporterMessageInput({ destinationBlockchainID: blockchainID, destinationAddress: address(0), - feeInfo: TeleporterFeeInfo({ - feeTokenAddress: address(0), - amount: uint256(0) - }), + feeInfo: TeleporterFeeInfo({feeTokenAddress: address(0), amount: uint256(0)}), requiredGasLimit: 1e6, allowedRelayerAddresses: new address[](0), message: new bytes(0) diff --git a/contracts/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol b/contracts/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol index 1f2cbbff5..e8901a693 100644 --- a/contracts/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol +++ b/contracts/src/Teleporter/tests/GetOutstandingReceiptsToSendTests.t.sol @@ -5,7 +5,14 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageInput, TeleporterFeeInfo, TeleporterMessageReceipt, IWarpMessenger} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageInput, + TeleporterFeeInfo, + TeleporterMessageReceipt, + IWarpMessenger +} from "./TeleporterMessengerTest.t.sol"; contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -23,26 +30,18 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { function testSuccess() public { // Assemble mock receipt information that we will expect to be // included in a subsequent message sent to another chain. - TeleporterMessageReceipt[] - memory expectedReceipts = new TeleporterMessageReceipt[](3); + TeleporterMessageReceipt[] memory expectedReceipts = new TeleporterMessageReceipt[](3); - expectedReceipts[0] = TeleporterMessageReceipt( - 13, - 0xF1DFE63909C027Ed814Dd92C5a3644590abf4850 - ); - expectedReceipts[1] = TeleporterMessageReceipt( - 42, - 0x52A258ED593C793251a89bfd36caE158EE9fC4F8 - ); - expectedReceipts[2] = TeleporterMessageReceipt( - 94, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); + expectedReceipts[0] = + TeleporterMessageReceipt(13, 0xF1DFE63909C027Ed814Dd92C5a3644590abf4850); + expectedReceipts[1] = + TeleporterMessageReceipt(42, 0x52A258ED593C793251a89bfd36caE158EE9fC4F8); + expectedReceipts[2] = + TeleporterMessageReceipt(94, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); // Mock receiving each of the messages corresponding to the receipts. - bytes32 blockchainID = bytes32( - hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); + bytes32 blockchainID = + bytes32(hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff"); for (uint256 i = 0; i < expectedReceipts.length; i++) { _receiveTestMessage( blockchainID, @@ -54,10 +53,7 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { // Now that we have "received" 3 mock messages, when we send a message back to the // other chain, we should expect to see the 3 receipts included in the message metadata. - TeleporterMessage memory expectedMessage = _createMockTeleporterMessage( - 1, - hex"deadbeef" - ); + TeleporterMessage memory expectedMessage = _createMockTeleporterMessage(1, hex"deadbeef"); expectedMessage.receipts = expectedReceipts; expectedMessage.destinationBlockchainID = blockchainID; TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo(address(0), 0); @@ -79,10 +75,7 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { // Expect the exact message to be passed to the precompile. vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(expectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(expectedMessage))) ); // Expect the SendCrossChainMessage event to be emitted. @@ -98,18 +91,12 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { assertEq(teleporterMessenger.sendCrossChainMessage(messageInput), 1); // Submit another message to be sent to check that it does not contain any more receipts. - TeleporterMessage - memory nextExpectedMessage = _createMockTeleporterMessage( - 2, - hex"deadbeef" - ); + TeleporterMessage memory nextExpectedMessage = + _createMockTeleporterMessage(2, hex"deadbeef"); nextExpectedMessage.destinationBlockchainID = blockchainID; vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(nextExpectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(nextExpectedMessage))) ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit SendCrossChainMessage( @@ -129,44 +116,27 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { function testExceedsLimit() public { // Assemble mock receipt information that we will expect to be // included in a subsequent message sent to another chain. - TeleporterMessageReceipt[] - memory expectedReceiptsBatch1 = new TeleporterMessageReceipt[](5); // the limit of receipts per message is 5. - expectedReceiptsBatch1[0] = TeleporterMessageReceipt( - 13, - 0xF1DFE63909C027Ed814Dd92C5a3644590abf4850 - ); - expectedReceiptsBatch1[1] = TeleporterMessageReceipt( - 42, - 0x52A258ED593C793251a89bfd36caE158EE9fC4F8 - ); - expectedReceiptsBatch1[2] = TeleporterMessageReceipt( - 94, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); - expectedReceiptsBatch1[3] = TeleporterMessageReceipt( - 3, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); - expectedReceiptsBatch1[4] = TeleporterMessageReceipt( - 53, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); - - TeleporterMessageReceipt[] - memory expectedReceiptsBatch2 = new TeleporterMessageReceipt[](2); // the limit of receipts per message is 5. - expectedReceiptsBatch2[0] = TeleporterMessageReceipt( - 75, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); - expectedReceiptsBatch2[1] = TeleporterMessageReceipt( - 80, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ); + TeleporterMessageReceipt[] memory expectedReceiptsBatch1 = new TeleporterMessageReceipt[](5); // the limit of receipts per message is 5. + expectedReceiptsBatch1[0] = + TeleporterMessageReceipt(13, 0xF1DFE63909C027Ed814Dd92C5a3644590abf4850); + expectedReceiptsBatch1[1] = + TeleporterMessageReceipt(42, 0x52A258ED593C793251a89bfd36caE158EE9fC4F8); + expectedReceiptsBatch1[2] = + TeleporterMessageReceipt(94, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); + expectedReceiptsBatch1[3] = + TeleporterMessageReceipt(3, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); + expectedReceiptsBatch1[4] = + TeleporterMessageReceipt(53, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); + + TeleporterMessageReceipt[] memory expectedReceiptsBatch2 = new TeleporterMessageReceipt[](2); // the limit of receipts per message is 5. + expectedReceiptsBatch2[0] = + TeleporterMessageReceipt(75, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); + expectedReceiptsBatch2[1] = + TeleporterMessageReceipt(80, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542); // Mock receiving each of the messages corresponding to the receipts. - bytes32 blockchainID = bytes32( - hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff" - ); + bytes32 blockchainID = + bytes32(hex"11223344556677889900aabbccddeeff11223344556677889900aabbccddeeff"); for (uint256 i = 0; i < expectedReceiptsBatch1.length; i++) { _receiveTestMessage( blockchainID, @@ -187,10 +157,7 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { // Now that we have "received" 7 mock messages, when we send a message back to the // other chain, we should expect to see the 5 receipts included in the message metadata because // that is the max receipt batch size limit. - TeleporterMessage memory expectedMessage = _createMockTeleporterMessage( - 1, - hex"deadbeef" - ); + TeleporterMessage memory expectedMessage = _createMockTeleporterMessage(1, hex"deadbeef"); expectedMessage.receipts = expectedReceiptsBatch1; expectedMessage.destinationBlockchainID = blockchainID; TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo(address(0), 0); @@ -212,10 +179,7 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { // Expect the exact message to be passed to the precompile. vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(expectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(expectedMessage))) ); // Expect the SendCrossChainMessage event to be emitted. @@ -231,19 +195,13 @@ contract GetOutstandingReceiptsToSendTest is TeleporterMessengerTest { assertEq(teleporterMessenger.sendCrossChainMessage(messageInput), 1); // Submit another message to be sent to check that it contains the remaining 2 receipts to be sent. - TeleporterMessage - memory nextExpectedMessage = _createMockTeleporterMessage( - 2, - hex"deadbeef" - ); + TeleporterMessage memory nextExpectedMessage = + _createMockTeleporterMessage(2, hex"deadbeef"); nextExpectedMessage.receipts = expectedReceiptsBatch2; nextExpectedMessage.destinationBlockchainID = blockchainID; vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(nextExpectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(nextExpectedMessage))) ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit SendCrossChainMessage( diff --git a/contracts/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol b/contracts/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol index ce04fec6a..5ccb30f58 100644 --- a/contracts/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol +++ b/contracts/src/Teleporter/tests/GetRelayerRewardAddressTests.t.sol @@ -19,10 +19,7 @@ contract GetRelayerRewardAddressTest is TeleporterMessengerTest { // Before receiving the message, it returns the 0 address. uint256 mockMessageID = 8; assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_DESTINATION_CHAIN_ID, - mockMessageID - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_DESTINATION_CHAIN_ID, mockMessageID), address(0) ); @@ -37,10 +34,7 @@ contract GetRelayerRewardAddressTest is TeleporterMessengerTest { // Now it has the relayer reward address. assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_DESTINATION_CHAIN_ID, - mockMessageID - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_DESTINATION_CHAIN_ID, mockMessageID), relayerRewardAddress ); } diff --git a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol index 766cffe66..452b34ef0 100644 --- a/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/HandleInitialMessageExecutionTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt, WarpMessage} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt, + WarpMessage +} from "./TeleporterMessengerTest.t.sol"; import {ITeleporterMessenger} from "../ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../ITeleporterReceiver.sol"; @@ -31,26 +36,14 @@ contract SampleMessageReceiver is ITeleporterReceiver { ) external { require(msg.sender == teleporterContract, "unauthorized"); // Decode the payload to recover the action and corresponding function parameters - (SampleMessageReceiverAction action, bytes memory actionData) = abi - .decode(message, (SampleMessageReceiverAction, bytes)); + (SampleMessageReceiverAction action, bytes memory actionData) = + abi.decode(message, (SampleMessageReceiverAction, bytes)); if (action == SampleMessageReceiverAction.Receive) { - (string memory messageString, bool succeed) = abi.decode( - actionData, - (string, bool) - ); - _receiveMessage( - originBlockchainID, - originSenderAddress, - messageString, - succeed - ); + (string memory messageString, bool succeed) = abi.decode(actionData, (string, bool)); + _receiveMessage(originBlockchainID, originSenderAddress, messageString, succeed); } else if (action == SampleMessageReceiverAction.ReceiveRecursive) { string memory messageString = abi.decode(actionData, (string)); - _receiveMessageRecursive( - originBlockchainID, - originSenderAddress, - messageString - ); + _receiveMessageRecursive(originBlockchainID, originSenderAddress, messageString); } else { revert("invalid action"); } @@ -77,9 +70,7 @@ contract SampleMessageReceiver is ITeleporterReceiver { string memory message ) internal { require(msg.sender == teleporterContract, "unauthorized"); - ITeleporterMessenger messenger = ITeleporterMessenger( - teleporterContract - ); + ITeleporterMessenger messenger = ITeleporterMessenger(teleporterContract); messenger.receiveCrossChainMessage(0, address(42)); latestMessage = message; latestMessageSenderSubnetID = originBlockchainID; @@ -111,25 +102,17 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { requiredGasLimit: DEFAULT_REQUIRED_GAS_LIMIT, allowedRelayerAddresses: new address[](0), receipts: new TeleporterMessageReceipt[](0), - message: abi.encode( - SampleMessageReceiverAction.Receive, - abi.encode(messageString, true) - ) + message: abi.encode(SampleMessageReceiverAction.Receive, abi.encode(messageString, true)) }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message and check that message execution was successful. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); - emit MessageExecuted( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID - ); + emit MessageExecuted(DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit ReceiveCrossChainMessage( warpMessage.sourceChainID, @@ -138,25 +121,15 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); // Check that the message had the proper affect on the destination contract. assertEq(destinationContract.latestMessage(), messageString); - assertEq( - destinationContract.latestMessageSenderSubnetID(), - DEFAULT_ORIGIN_CHAIN_ID - ); - assertEq( - destinationContract.latestMessageSenderAddress(), - address(this) - ); + assertEq(destinationContract.latestMessageSenderSubnetID(), DEFAULT_ORIGIN_CHAIN_ID); + assertEq(destinationContract.latestMessageSenderAddress(), address(this)); assertEq( teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID ), DEFAULT_RELAYER_REWARD_ADDRESS ); @@ -171,31 +144,21 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { destinationBlockchainID: DEFAULT_DESTINATION_CHAIN_ID, destinationAddress: address(destinationContract), requiredGasLimit: uint256( - bytes32( - hex"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - ) // UINT256_MAX + bytes32(hex"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") // UINT256_MAX ), allowedRelayerAddresses: new address[](0), receipts: new TeleporterMessageReceipt[](0), - message: abi.encode( - SampleMessageReceiverAction.Receive, - abi.encode(messageString, true) - ) + message: abi.encode(SampleMessageReceiverAction.Receive, abi.encode(messageString, true)) }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. vm.expectRevert(_formatTeleporterErrorMessage("insufficient gas")); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); } function testCannotReceiveMessageRecursively() public { @@ -209,15 +172,10 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { requiredGasLimit: DEFAULT_REQUIRED_GAS_LIMIT, allowedRelayerAddresses: new address[](0), receipts: new TeleporterMessageReceipt[](0), - message: abi.encode( - SampleMessageReceiverAction.ReceiveRecursive, - abi.encode(messageString) - ) + message: abi.encode(SampleMessageReceiverAction.ReceiveRecursive, abi.encode(messageString)) }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -227,9 +185,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { // still successfully delivered. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit MessageExecutionFailed( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID, - messageToReceive + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID, messageToReceive ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit ReceiveCrossChainMessage( @@ -239,10 +195,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); // Check that the message hash was stored in state and the message did not have any affect on the destination. assertEq(destinationContract.latestMessage(), ""); @@ -250,18 +203,12 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { assertEq(destinationContract.latestMessageSenderAddress(), address(0)); assertEq( teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert( - _formatTeleporterErrorMessage("retry execution failed") - ); - teleporterMessenger.retryMessageExecution( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive - ); + vm.expectRevert(_formatTeleporterErrorMessage("retry execution failed")); + teleporterMessenger.retryMessageExecution(DEFAULT_ORIGIN_CHAIN_ID, messageToReceive); } function testStoreHashOfFailedMessageExecution() public { @@ -275,15 +222,10 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { requiredGasLimit: DEFAULT_REQUIRED_GAS_LIMIT, allowedRelayerAddresses: new address[](0), receipts: new TeleporterMessageReceipt[](0), - message: abi.encode( - SampleMessageReceiverAction.Receive, - abi.encode(messageString, false) - ) + message: abi.encode(SampleMessageReceiverAction.Receive, abi.encode(messageString, false)) }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -291,9 +233,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { // Receive the message. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit MessageExecutionFailed( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID, - messageToReceive + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID, messageToReceive ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit ReceiveCrossChainMessage( @@ -303,10 +243,7 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); // Check that the message hash was stored in state and the message did not have any affect on the destination. assertEq(destinationContract.latestMessage(), ""); @@ -314,17 +251,11 @@ contract HandleInitialMessageExecutionTest is TeleporterMessengerTest { assertEq(destinationContract.latestMessageSenderAddress(), address(0)); assertEq( teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID ), DEFAULT_RELAYER_REWARD_ADDRESS ); - vm.expectRevert( - _formatTeleporterErrorMessage("retry execution failed") - ); - teleporterMessenger.retryMessageExecution( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive - ); + vm.expectRevert(_formatTeleporterErrorMessage("retry execution failed")); + teleporterMessenger.retryMessageExecution(DEFAULT_ORIGIN_CHAIN_ID, messageToReceive); } } diff --git a/contracts/src/Teleporter/tests/MarkReceiptTests.t.sol b/contracts/src/Teleporter/tests/MarkReceiptTests.t.sol index ba3f4a2d5..ec46bda4d 100644 --- a/contracts/src/Teleporter/tests/MarkReceiptTests.t.sol +++ b/contracts/src/Teleporter/tests/MarkReceiptTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessageReceipt, TeleporterMessage, WarpMessage} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessageReceipt, + TeleporterMessage, + WarpMessage +} from "./TeleporterMessengerTest.t.sol"; contract MarkReceiptTest is TeleporterMessengerTest { struct FeeRewardInfo { @@ -26,33 +31,19 @@ contract MarkReceiptTest is TeleporterMessengerTest { function testCheckRelayersUponReceipt() public { // Submit a few mock messages to be sent. FeeRewardInfo[3] memory feeRewardInfos = [ - FeeRewardInfo( - 1111111111111111, - 0x52A258ED593C793251a89bfd36caE158EE9fC4F8 - ), - FeeRewardInfo( - 2222222222222222, - 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6 - ), - FeeRewardInfo( - 3333333333333333, - 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542 - ) + FeeRewardInfo(1111111111111111, 0x52A258ED593C793251a89bfd36caE158EE9fC4F8), + FeeRewardInfo(2222222222222222, 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6), + FeeRewardInfo(3333333333333333, 0xdc00AB1cF6942cE0891eF1AC5ff686833Fa0C542) ]; for (uint256 i = 0; i < feeRewardInfos.length; i++) { assertEq( - _sendTestMessageWithFee( - DEFAULT_ORIGIN_CHAIN_ID, - feeRewardInfos[i].feeAmount - ), - i + 1 + _sendTestMessageWithFee(DEFAULT_ORIGIN_CHAIN_ID, feeRewardInfos[i].feeAmount), i + 1 ); } // Mock receiving a message with the 3 receipts from the mock messages sent above. - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[]( + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[]( feeRewardInfos.length ); for (uint256 i = 0; i < receipts.length; i++) { @@ -61,32 +52,22 @@ contract MarkReceiptTest is TeleporterMessengerTest { relayerRewardAddress: feeRewardInfos[i].relayerRewardAddress }); } - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); messageToReceive.receipts = receipts; - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the mock message. address expectedRelayerRewardAddress = 0x93753a9eA4C9D6eeed9f64eA92E97ce1f5FBAeDe; - teleporterMessenger.receiveCrossChainMessage( - 0, - expectedRelayerRewardAddress - ); + teleporterMessenger.receiveCrossChainMessage(0, expectedRelayerRewardAddress); // Check that the relayers have redeemable balances for (uint256 i = 0; i < feeRewardInfos.length; i++) { assertEq( teleporterMessenger.checkRelayerRewardAmount( - feeRewardInfos[i].relayerRewardAddress, - address(_mockFeeAsset) + feeRewardInfos[i].relayerRewardAddress, address(_mockFeeAsset) ), feeRewardInfos[i].feeAmount ); @@ -94,25 +75,14 @@ contract MarkReceiptTest is TeleporterMessengerTest { // Check that the message received is considered delivered, and that the relayer reward address is stored. assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - 1 - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_ORIGIN_CHAIN_ID, 1), expectedRelayerRewardAddress ); - assertTrue( - teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1) - ); + assertTrue(teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1)); // Check that the message hashes for the message receipts we received have been cleared. for (uint256 i = 0; i < receipts.length; i++) { - assertEq( - teleporterMessenger.getMessageHash( - DEFAULT_ORIGIN_CHAIN_ID, - i + 1 - ), - bytes32(0) - ); + assertEq(teleporterMessenger.getMessageHash(DEFAULT_ORIGIN_CHAIN_ID, i + 1), bytes32(0)); } } @@ -121,113 +91,71 @@ contract MarkReceiptTest is TeleporterMessengerTest { assertEq(_sendTestMessageWithNoFee(DEFAULT_ORIGIN_CHAIN_ID), 1); // Mock receiving a message with the a receipts of the mock message sent above. - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](1); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](1); receipts[0] = TeleporterMessageReceipt({ receivedMessageID: 1, relayerRewardAddress: DEFAULT_RELAYER_REWARD_ADDRESS }); - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); messageToReceive.receipts = receipts; - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the mock message. address expectedRelayerRewardAddress = 0x2F20537C2F5c57231866DE9D0CE33d0681a200D4; - teleporterMessenger.receiveCrossChainMessage( - 0, - expectedRelayerRewardAddress - ); + teleporterMessenger.receiveCrossChainMessage(0, expectedRelayerRewardAddress); // Check that the message received is considered delivered, and that the relayer reward address is stored. assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - 1 - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_ORIGIN_CHAIN_ID, 1), expectedRelayerRewardAddress ); - assertTrue( - teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1) - ); + assertTrue(teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1)); } function testDuplicateReceiptAllowed() public { // Submit a mock message to be sent. - FeeRewardInfo memory feeRewardInfo = FeeRewardInfo( - 1111111111111111, - 0x52A258ED593C793251a89bfd36caE158EE9fC4F8 - ); - assertEq( - _sendTestMessageWithFee( - DEFAULT_ORIGIN_CHAIN_ID, - feeRewardInfo.feeAmount - ), - 1 - ); + FeeRewardInfo memory feeRewardInfo = + FeeRewardInfo(1111111111111111, 0x52A258ED593C793251a89bfd36caE158EE9fC4F8); + assertEq(_sendTestMessageWithFee(DEFAULT_ORIGIN_CHAIN_ID, feeRewardInfo.feeAmount), 1); // Mock receiving a message with the 2 receipts for the same mock message above. - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](2); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](2); TeleporterMessageReceipt memory receipt = TeleporterMessageReceipt({ receivedMessageID: 1, relayerRewardAddress: feeRewardInfo.relayerRewardAddress }); receipts[0] = receipt; receipts[1] = receipt; - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); messageToReceive.receipts = receipts; - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the mock message. address expectedRelayerRewardAddress = 0x6DAEF0D63ea44C801b655Fd97fe3804B9bFCC097; - teleporterMessenger.receiveCrossChainMessage( - 0, - expectedRelayerRewardAddress - ); + teleporterMessenger.receiveCrossChainMessage(0, expectedRelayerRewardAddress); // Check that the relayer redeemable balances was only added once. assertEq( teleporterMessenger.checkRelayerRewardAmount( - feeRewardInfo.relayerRewardAddress, - address(_mockFeeAsset) + feeRewardInfo.relayerRewardAddress, address(_mockFeeAsset) ), feeRewardInfo.feeAmount ); // Check that the message received is considered delivered, and that the relayer reward address is stored. assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - 1 - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_ORIGIN_CHAIN_ID, 1), expectedRelayerRewardAddress ); - assertTrue( - teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1) - ); + assertTrue(teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1)); // Check that the message hashes for the message receipts we received have been cleared. - assertEq( - teleporterMessenger.getMessageHash(DEFAULT_ORIGIN_CHAIN_ID, 1), - bytes32(0) - ); + assertEq(teleporterMessenger.getMessageHash(DEFAULT_ORIGIN_CHAIN_ID, 1), bytes32(0)); } } diff --git a/contracts/src/Teleporter/tests/MessageReceivedTests.t.sol b/contracts/src/Teleporter/tests/MessageReceivedTests.t.sol index 97e57ee71..4bafc2f44 100644 --- a/contracts/src/Teleporter/tests/MessageReceivedTests.t.sol +++ b/contracts/src/Teleporter/tests/MessageReceivedTests.t.sol @@ -19,28 +19,13 @@ contract MessageReceivedTest is TeleporterMessengerTest { // Mock receiving a message from another subnet. address relayerRewardAddress = 0xA66884fAdC0D4d7B7eedcF61Eb863Ff413bB6234; _receiveTestMessage( - DEFAULT_DESTINATION_CHAIN_ID, - 1, - relayerRewardAddress, - new TeleporterMessageReceipt[](0) + DEFAULT_DESTINATION_CHAIN_ID, 1, relayerRewardAddress, new TeleporterMessageReceipt[](0) ); - assertEq( - teleporterMessenger.messageReceived( - DEFAULT_DESTINATION_CHAIN_ID, - 1 - ), - true - ); + assertEq(teleporterMessenger.messageReceived(DEFAULT_DESTINATION_CHAIN_ID, 1), true); } function testUnreceivedMessage() public { - assertEq( - teleporterMessenger.messageReceived( - DEFAULT_DESTINATION_CHAIN_ID, - 1 - ), - false - ); + assertEq(teleporterMessenger.messageReceived(DEFAULT_DESTINATION_CHAIN_ID, 1), false); } } diff --git a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol index 4f4657b3c..0bc83e6cd 100644 --- a/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiptsQueueTests.t.sol @@ -14,24 +14,22 @@ contract ReceiptQueueTest is Test { // The state of the contract gets reset before each // test is run, with the `setUp()` function being called // each time after deployment. + ReceiptQueue.TeleporterMessageReceiptQueue private _queue; // Add 3 elements to the queue. - TeleporterMessageReceipt private _receipt1 = - TeleporterMessageReceipt({ - receivedMessageID: 543, - relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b - }); - TeleporterMessageReceipt private _receipt2 = - TeleporterMessageReceipt({ - receivedMessageID: 684384, - relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b - }); - TeleporterMessageReceipt private _receipt3 = - TeleporterMessageReceipt({ - receivedMessageID: 654351, - relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 - }); + TeleporterMessageReceipt private _receipt1 = TeleporterMessageReceipt({ + receivedMessageID: 543, + relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b + }); + TeleporterMessageReceipt private _receipt2 = TeleporterMessageReceipt({ + receivedMessageID: 684384, + relayerRewardAddress: 0x10eB43ef5982628728E3E4bb9F78834f67Fbb40b + }); + TeleporterMessageReceipt private _receipt3 = TeleporterMessageReceipt({ + receivedMessageID: 654351, + relayerRewardAddress: 0xcC8E718045817AebA89592C72Ae1C9917f5D0894 + }); function testEnqueueDequeueSuccess() public { // Check the initial size is zero. @@ -117,9 +115,11 @@ contract ReceiptQueueTest is Test { assertEq(result.relayerRewardAddress, address(0)); } - function _formatReceiptQueueErrorMessage( - string memory errorMessage - ) private pure returns (bytes memory) { + function _formatReceiptQueueErrorMessage(string memory errorMessage) + private + pure + returns (bytes memory) + { return bytes(string.concat("ReceiptQueue: ", errorMessage)); } } diff --git a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol index 5906a953b..48dabfa46 100644 --- a/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/ReceiveCrossChainMessageTests.t.sol @@ -5,7 +5,13 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt, WarpMessage, IWarpMessenger} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt, + WarpMessage, + IWarpMessenger +} from "./TeleporterMessengerTest.t.sol"; // Tests of the logic in receiveCrossChainMessage. // Tests of the execution and receipts helper methods are split out into independent @@ -39,19 +45,14 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: DEFAULT_MESSAGE_PAYLOAD }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Check receipt queue size - assertEq( - teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), - 0 - ); + assertEq(teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 0); // Receive the message. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); @@ -62,29 +63,21 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); // Check receipt queue size - assertEq( - teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), - 1 - ); + assertEq(teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 1); // Check receipt queue contents - TeleporterMessageReceipt memory receipt = teleporterMessenger - .getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 0); + TeleporterMessageReceipt memory receipt = + teleporterMessenger.getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 0); assertEq(receipt.receivedMessageID, 1); assertEq(receipt.relayerRewardAddress, DEFAULT_RELAYER_REWARD_ADDRESS); // Receive at a different index messageToReceive.messageID = 2; - warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); _setUpSuccessGetVerifiedWarpMessageMock(3, warpMessage); // Receive the message. @@ -96,32 +89,20 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 3, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(3, DEFAULT_RELAYER_REWARD_ADDRESS); // Check receipt queue size - assertEq( - teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), - 2 - ); + assertEq(teleporterMessenger.getReceiptQueueSize(DEFAULT_ORIGIN_CHAIN_ID), 2); // Check receipt queue contents - receipt = teleporterMessenger.getReceiptAtIndex( - DEFAULT_ORIGIN_CHAIN_ID, - 1 - ); + receipt = teleporterMessenger.getReceiptAtIndex(DEFAULT_ORIGIN_CHAIN_ID, 1); assertEq(receipt.receivedMessageID, 2); assertEq(receipt.relayerRewardAddress, DEFAULT_RELAYER_REWARD_ADDRESS); } function testNoValidMessage() public { // Mock the call to the warp precompile to get the message failing. - WarpMessage memory emptyMessage = _createDefaultWarpMessage( - bytes32(0), - new bytes(0) - ); + WarpMessage memory emptyMessage = _createDefaultWarpMessage(bytes32(0), new bytes(0)); vm.mockCall( WARP_PRECOMPILE_ADDRESS, @@ -129,8 +110,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encode(emptyMessage, false) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (0)) + WARP_PRECOMPILE_ADDRESS, abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (0)) ); vm.expectRevert(_formatTeleporterErrorMessage("invalid warp message")); @@ -143,8 +123,7 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { abi.encode(emptyMessage, false) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (3)) + WARP_PRECOMPILE_ADDRESS, abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (3)) ); vm.expectRevert(_formatTeleporterErrorMessage("invalid warp message")); @@ -153,64 +132,39 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { function testInvalidOriginSenderAddress() public { // Construct the test message to be received. - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); - - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); + + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); address invalidSenderAddress = 0xb73aD7e0FF026a805D1f1186EAB89E41bf01835D; warpMessage.originSenderAddress = invalidSenderAddress; // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert( - _formatTeleporterErrorMessage("invalid origin sender address") - ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + vm.expectRevert(_formatTeleporterErrorMessage("invalid origin sender address")); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); } function testInvalidDestinationBlockchainID() public { // Construct the test message to be received. - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); - bytes32 invalidDestinationBlockchainID = bytes32( - hex"deadbeefcafebabedeadbeefcafebabedeadbeefcafebabedeadbeefcafebabe" - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); + bytes32 invalidDestinationBlockchainID = + bytes32(hex"deadbeefcafebabedeadbeefcafebabedeadbeefcafebabedeadbeefcafebabe"); messageToReceive.destinationBlockchainID = invalidDestinationBlockchainID; - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); - vm.expectRevert( - _formatTeleporterErrorMessage("invalid destination chain ID") - ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + vm.expectRevert(_formatTeleporterErrorMessage("invalid destination chain ID")); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); } function testInvalidRelayerAddress() public { - vm.expectRevert( - _formatTeleporterErrorMessage("zero relayer reward address") - ); + vm.expectRevert(_formatTeleporterErrorMessage("zero relayer reward address")); teleporterMessenger.receiveCrossChainMessage(0, address(0)); } @@ -219,13 +173,8 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { testSuccess(); // Check you can't deliver it again. - vm.expectRevert( - _formatTeleporterErrorMessage("message already delivered") - ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + vm.expectRevert(_formatTeleporterErrorMessage("message already delivered")); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); } function testUnauthorizedRelayer() public { @@ -245,20 +194,15 @@ contract ReceiveCrossChainMessagedTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: DEFAULT_MESSAGE_PAYLOAD }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); // Receive the message. vm.expectRevert(_formatTeleporterErrorMessage("unauthorized relayer")); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); } function testMessageSentToEOADoesNotExecute() public { diff --git a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol index bdad22d92..112949bb1 100644 --- a/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol +++ b/contracts/src/Teleporter/tests/RedeemRelayerRewardsTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt, WarpMessage} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt, + WarpMessage +} from "./TeleporterMessengerTest.t.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract RedeemRelayerRewardsTest is TeleporterMessengerTest { @@ -27,25 +32,21 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { } function testRedemptionFails() public { - FeeRewardInfo memory feeRewardInfo = FeeRewardInfo( - 2222222222222222, - 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6 - ); + FeeRewardInfo memory feeRewardInfo = + FeeRewardInfo(2222222222222222, 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6); _setUpRelayerRewards(feeRewardInfo); vm.mockCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transfer, - (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) + IERC20.transfer, (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) ), abi.encode(false) ); vm.expectCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transfer, - (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) + IERC20.transfer, (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) ) ); vm.prank(feeRewardInfo.relayerRewardAddress); @@ -55,40 +56,33 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { // Check that the relayer still has redeemable balance since the transfer failed. assertEq( teleporterMessenger.checkRelayerRewardAmount( - feeRewardInfo.relayerRewardAddress, - address(_mockFeeAsset) + feeRewardInfo.relayerRewardAddress, address(_mockFeeAsset) ), feeRewardInfo.feeAmount ); } function testRedemptionSucceeds() public { - FeeRewardInfo memory feeRewardInfo = FeeRewardInfo( - 2222222222222222, - 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6 - ); + FeeRewardInfo memory feeRewardInfo = + FeeRewardInfo(2222222222222222, 0xeF6ed43EB8Ff15E336D64d1468947cA1046824E6); _setUpRelayerRewards(feeRewardInfo); vm.mockCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transfer, - (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) + IERC20.transfer, (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) ), abi.encode(true) ); vm.expectCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transfer, - (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) + IERC20.transfer, (feeRewardInfo.relayerRewardAddress, feeRewardInfo.feeAmount) ) ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit RelayerRewardsRedeemed( - feeRewardInfo.relayerRewardAddress, - address(_mockFeeAsset), - feeRewardInfo.feeAmount + feeRewardInfo.relayerRewardAddress, address(_mockFeeAsset), feeRewardInfo.feeAmount ); vm.prank(feeRewardInfo.relayerRewardAddress); teleporterMessenger.redeemRelayerRewards(address(_mockFeeAsset)); @@ -96,8 +90,7 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { // Check that the relayer redeemable balance is now 0. assertEq( teleporterMessenger.checkRelayerRewardAmount( - feeRewardInfo.relayerRewardAddress, - address(_mockFeeAsset) + feeRewardInfo.relayerRewardAddress, address(_mockFeeAsset) ), 0 ); @@ -107,28 +100,19 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { // receiving back a message with receipt of that message such that the relayer // is able to redeem the reward. function _setUpRelayerRewards(FeeRewardInfo memory feeRewardInfo) private { - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_ORIGIN_CHAIN_ID, - feeRewardInfo.feeAmount - ); + uint256 messageID = + _sendTestMessageWithFee(DEFAULT_ORIGIN_CHAIN_ID, feeRewardInfo.feeAmount); - TeleporterMessageReceipt[] - memory receipts = new TeleporterMessageReceipt[](1); + TeleporterMessageReceipt[] memory receipts = new TeleporterMessageReceipt[](1); receipts[0] = TeleporterMessageReceipt({ receivedMessageID: messageID, relayerRewardAddress: feeRewardInfo.relayerRewardAddress }); - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 1, - new bytes(0) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(1, new bytes(0)); messageToReceive.receipts = receipts; - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -142,30 +126,21 @@ contract RedeemRelayerRewardsTest is TeleporterMessengerTest { expectedRelayerRewardAddress, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - expectedRelayerRewardAddress - ); + teleporterMessenger.receiveCrossChainMessage(0, expectedRelayerRewardAddress); // Check that the relayer has redeemable balance assertEq( teleporterMessenger.checkRelayerRewardAmount( - feeRewardInfo.relayerRewardAddress, - address(_mockFeeAsset) + feeRewardInfo.relayerRewardAddress, address(_mockFeeAsset) ), feeRewardInfo.feeAmount ); // Check that the message received is considered delivered, and that the relayer reward address is stored. assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - 1 - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_ORIGIN_CHAIN_ID, 1), expectedRelayerRewardAddress ); - assertTrue( - teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1) - ); + assertTrue(teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, 1)); } } diff --git a/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol b/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol index 27a91ce29..23153e0cf 100644 --- a/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol +++ b/contracts/src/Teleporter/tests/ReentrancyGuardsTests.t.sol @@ -37,38 +37,26 @@ contract ReentrancyGuardsTests is Test { // We also need to check that we fail if a send function calls a receive function, // and then calls send function again - bytes memory receiveMsg = abi.encodeCall( - SampleMessenger.receiveAndCall, - (sendMsg) - ); + bytes memory receiveMsg = abi.encodeCall(SampleMessenger.receiveAndCall, (sendMsg)); vm.expectRevert("send failed"); _sampleMessenger.sendAndCall(receiveMsg); } function testRecursiveReceiveFails() public { // First we check when a receive function calls another receive function, which should fail. - bytes memory receiveMsg = abi.encodeCall( - SampleMessenger.receiveMessage, - () - ); + bytes memory receiveMsg = abi.encodeCall(SampleMessenger.receiveMessage, ()); vm.expectRevert("receive failed"); _sampleMessenger.receiveAndCall(receiveMsg); // We also need to check that we fail if a receive function calls a send function, // and then calls receive function again - bytes memory sendMsg = abi.encodeCall( - SampleMessenger.sendAndCall, - (receiveMsg) - ); + bytes memory sendMsg = abi.encodeCall(SampleMessenger.sendAndCall, (receiveMsg)); vm.expectRevert("receive failed"); _sampleMessenger.receiveAndCall(sendMsg); } function testSendCallsReceiveSuccess() public { - bytes memory message = abi.encodeCall( - SampleMessenger.receiveMessage, - () - ); + bytes memory message = abi.encodeCall(SampleMessenger.receiveMessage, ()); _sampleMessenger.sendAndCall(message); assertEq(_sampleMessenger.nonce(), 2); } @@ -107,7 +95,7 @@ contract SampleMessenger is ReentrancyGuards { nonce++; if (message.length > 0) { // solhint-disable-next-line avoid-low-level-calls - (bool success, ) = address(this).call(message); + (bool success,) = address(this).call(message); require(success, "send failed"); } } @@ -125,7 +113,7 @@ contract SampleMessenger is ReentrancyGuards { nonce++; if (message.length > 0) { // solhint-disable-next-line avoid-low-level-calls - (bool success, ) = address(this).call(message); + (bool success,) = address(this).call(message); require(success, "receive failed"); } } diff --git a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol index 1361a8346..3360c73d5 100644 --- a/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol +++ b/contracts/src/Teleporter/tests/RetryMessageExecutionTests.t.sol @@ -5,7 +5,12 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt, WarpMessage} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt, + WarpMessage +} from "./TeleporterMessengerTest.t.sol"; import {ITeleporterMessenger} from "../ITeleporterMessenger.sol"; import {ITeleporterReceiver} from "../ITeleporterReceiver.sol"; @@ -34,8 +39,8 @@ contract FlakyMessageReceiver is ITeleporterReceiver { ) external { require(msg.sender == teleporterContract, "unauthorized"); // Decode the payload to recover the action and corresponding function parameters - (FlakyMessageReceiverAction action, bytes memory actionData) = abi - .decode(messageBytes, (FlakyMessageReceiverAction, bytes)); + (FlakyMessageReceiverAction action, bytes memory actionData) = + abi.decode(messageBytes, (FlakyMessageReceiverAction, bytes)); if (action == FlakyMessageReceiverAction.ReceiveMessage) { string memory message = abi.decode(actionData, (string)); _receiveMessage(originBlockchainID, originSenderAddress, message); @@ -69,9 +74,7 @@ contract FlakyMessageReceiver is ITeleporterReceiver { require(msg.sender == teleporterContract, "unauthorized"); require(block.number % 2 != 0, "even block number"); - ITeleporterMessenger messenger = ITeleporterMessenger( - teleporterContract - ); + ITeleporterMessenger messenger = ITeleporterMessenger(teleporterContract); messenger.receiveCrossChainMessage(0, address(42)); latestMessage = message; latestMessageSenderSubnetID = originBlockchainID; @@ -98,16 +101,11 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { function testExecutionFailsAgain() public { // First submit a message whose execution fails. - ( - bytes32 originBlockchainID, - TeleporterMessage memory message, - - ) = _receiveFailedMessage(false); + (bytes32 originBlockchainID, TeleporterMessage memory message,) = + _receiveFailedMessage(false); // Now retry it in another block with an even timestamp so that it fails again. - vm.expectRevert( - _formatTeleporterErrorMessage("retry execution failed") - ); + vm.expectRevert(_formatTeleporterErrorMessage("retry execution failed")); teleporterMessenger.retryMessageExecution(originBlockchainID, message); } @@ -125,19 +123,13 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { }); vm.expectRevert(_formatTeleporterErrorMessage("message not found")); - teleporterMessenger.retryMessageExecution( - DEFAULT_ORIGIN_CHAIN_ID, - fakeMessage - ); + teleporterMessenger.retryMessageExecution(DEFAULT_ORIGIN_CHAIN_ID, fakeMessage); } function testInvalidMessageHash() public { // First submit a message whose execution fails. - ( - bytes32 originBlockchainID, - TeleporterMessage memory message, - - ) = _receiveFailedMessage(false); + (bytes32 originBlockchainID, TeleporterMessage memory message,) = + _receiveFailedMessage(false); // Alter the message before retrying it. message.message = "altered message"; @@ -147,10 +139,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { function testCanNotRetryAgainAfterSuccess() public { // Successfully retry a message execution. - ( - bytes32 originBlockchainID, - TeleporterMessage memory message - ) = _successfullyRetryMessage(); + (bytes32 originBlockchainID, TeleporterMessage memory message) = _successfullyRetryMessage(); // Now try again and make sure it's been cleared from state vm.expectRevert(_formatTeleporterErrorMessage("message not found")); @@ -159,11 +148,8 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { function testCanNotReceiveMessageWhileRetrying() public { // First submit a message whose execution fails. - ( - bytes32 originBlockchainID, - TeleporterMessage memory message, - - ) = _receiveFailedMessage(false); + (bytes32 originBlockchainID, TeleporterMessage memory message,) = + _receiveFailedMessage(false); // Now retry it within a block with an odd timestamp. // It should still fail because it tries to re-enter the teleporter contract. @@ -172,11 +158,8 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { } function testEOAFailsThenRetrySucceeds() public { - ( - bytes32 originBlockchainID, - address destinationAddress, - TeleporterMessage memory message - ) = _receiveMessageSentToEOA(); + (bytes32 originBlockchainID, address destinationAddress, TeleporterMessage memory message) = + _receiveMessageSentToEOA(); // Now mock a contract being deployed to the destination address. It will still return no // data from the method being called, but code (with non-zero length) exists at the address. @@ -187,23 +170,18 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { } function testEOAFailsAgainOnRetry() public { - ( - bytes32 originBlockchainID, - , - TeleporterMessage memory message - ) = _receiveMessageSentToEOA(); + (bytes32 originBlockchainID,, TeleporterMessage memory message) = _receiveMessageSentToEOA(); // Retrying the message execution should revert since there is still no contract deployed // to the destination address. - vm.expectRevert( - _formatTeleporterErrorMessage("destination address has no code") - ); + vm.expectRevert(_formatTeleporterErrorMessage("destination address has no code")); teleporterMessenger.retryMessageExecution(originBlockchainID, message); } - function _receiveFailedMessage( - bool retryReceive - ) internal returns (bytes32, TeleporterMessage memory, string memory) { + function _receiveFailedMessage(bool retryReceive) + internal + returns (bytes32, TeleporterMessage memory, string memory) + { // Construct the mock message to be received. string memory messageString = "Testing successful message"; FlakyMessageReceiverAction action; @@ -222,10 +200,8 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { receipts: new TeleporterMessageReceipt[](0), message: abi.encode(action, abi.encode(messageString)) }); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // Mock the call to the warp precompile to get the message. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -235,9 +211,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { vm.roll(12); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit MessageExecutionFailed( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID, - messageToReceive + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID, messageToReceive ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit ReceiveCrossChainMessage( @@ -247,10 +221,7 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); // Check that the message execution didn't have any effect, but // the message was marked as marked as delivered. @@ -259,31 +230,21 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { assertEq(destinationContract.latestMessageSenderAddress(), address(0)); assertEq( teleporterMessenger.getRelayerRewardAddress( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID ), DEFAULT_RELAYER_REWARD_ADDRESS ); assertTrue( - teleporterMessenger.messageReceived( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID - ) + teleporterMessenger.messageReceived(DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID) ); return (DEFAULT_ORIGIN_CHAIN_ID, messageToReceive, messageString); } - function _successfullyRetryMessage() - internal - returns (bytes32, TeleporterMessage memory) - { + function _successfullyRetryMessage() internal returns (bytes32, TeleporterMessage memory) { // First submit a message whose execution fails. - ( - bytes32 originBlockchainID, - TeleporterMessage memory message, - string memory messageString - ) = _receiveFailedMessage(false); + (bytes32 originBlockchainID, TeleporterMessage memory message, string memory messageString) + = _receiveFailedMessage(false); // Now retry the message execution in a block with an odd height, which should succeed. vm.roll(13); @@ -293,14 +254,8 @@ contract RetryMessageExecutionTest is TeleporterMessengerTest { // Check that the message had the proper affect on the destination contract. assertEq(destinationContract.latestMessage(), messageString); - assertEq( - destinationContract.latestMessageSenderSubnetID(), - originBlockchainID - ); - assertEq( - destinationContract.latestMessageSenderAddress(), - address(this) - ); + assertEq(destinationContract.latestMessageSenderSubnetID(), originBlockchainID); + assertEq(destinationContract.latestMessageSenderAddress(), address(this)); return (originBlockchainID, message); } diff --git a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol index 73dd98f95..f07ef7fc3 100644 --- a/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/RetrySendCrossChainMessageTests.t.sol @@ -5,7 +5,11 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt +} from "./TeleporterMessengerTest.t.sol"; contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -17,10 +21,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { function testSuccess() public { // Send a message - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - 654456 - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, 654456); TeleporterMessage memory expectedMessage = TeleporterMessage({ messageID: messageID, senderAddress: address(this), @@ -34,8 +35,7 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { // Retry it teleporterMessenger.retrySendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - expectedMessage + DEFAULT_DESTINATION_CHAIN_ID, expectedMessage ); } @@ -51,18 +51,12 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { message: new bytes(0) }); vm.expectRevert(_formatTeleporterErrorMessage("message not found")); - teleporterMessenger.retrySendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - fakeMessage - ); + teleporterMessenger.retrySendCrossChainMessage(DEFAULT_DESTINATION_CHAIN_ID, fakeMessage); } function testInvalidMessageHash() public { // Send a message, then try to alter it's contents. - uint256 messageID = _sendTestMessageWithFee( - DEFAULT_DESTINATION_CHAIN_ID, - 654456 - ); + uint256 messageID = _sendTestMessageWithFee(DEFAULT_DESTINATION_CHAIN_ID, 654456); TeleporterMessage memory alteredMessage = TeleporterMessage({ messageID: messageID, senderAddress: address(this), @@ -76,9 +70,6 @@ contract RetrySendCrossChainMessageTest is TeleporterMessengerTest { // Retry it - should fail. vm.expectRevert(_formatTeleporterErrorMessage("invalid message hash")); - teleporterMessenger.retrySendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - alteredMessage - ); + teleporterMessenger.retrySendCrossChainMessage(DEFAULT_DESTINATION_CHAIN_ID, alteredMessage); } } diff --git a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol index 9ab50cd34..4b65e4087 100644 --- a/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol +++ b/contracts/src/Teleporter/tests/SendCrossChainMessageTests.t.sol @@ -5,7 +5,14 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterFeeInfo, TeleporterMessageInput, IWarpMessenger, IERC20} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterFeeInfo, + TeleporterMessageInput, + IWarpMessenger, + IERC20 +} from "./TeleporterMessengerTest.t.sol"; contract SendCrossChainMessageTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -17,10 +24,7 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { function testSendMessageNoFee() public { // Arrange - TeleporterMessage memory expectedMessage = _createMockTeleporterMessage( - 1, - hex"deadbeef" - ); + TeleporterMessage memory expectedMessage = _createMockTeleporterMessage(1, hex"deadbeef"); TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo(address(0), 0); TeleporterMessageInput memory messageInput = TeleporterMessageInput({ destinationBlockchainID: DEFAULT_DESTINATION_CHAIN_ID, @@ -41,10 +45,7 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { // Expect the exact message to be passed to the precompile. vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(expectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(expectedMessage))) ); // Expect the SendCrossChainMessage event to be emitted. @@ -57,31 +58,23 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { ); // Act - uint256 messageID = teleporterMessenger.sendCrossChainMessage( - messageInput - ); + uint256 messageID = teleporterMessenger.sendCrossChainMessage(messageInput); // Assert assertEq(messageID, 1); // Check receipt queue - uint256 queueSize = teleporterMessenger.getReceiptQueueSize( - messageInput.destinationBlockchainID - ); + uint256 queueSize = + teleporterMessenger.getReceiptQueueSize(messageInput.destinationBlockchainID); assertEq(queueSize, 0); } function testSendMessageWithFee() public { // Arrange // Construct the message to submit. - TeleporterMessage memory expectedMessage = _createMockTeleporterMessage( - 1, - hex"deadbeef" - ); - TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo( - address(_mockFeeAsset), - 13131313131313131313 - ); + TeleporterMessage memory expectedMessage = _createMockTeleporterMessage(1, hex"deadbeef"); + TeleporterFeeInfo memory feeInfo = + TeleporterFeeInfo(address(_mockFeeAsset), 13131313131313131313); TeleporterMessageInput memory messageInput = TeleporterMessageInput({ destinationBlockchainID: DEFAULT_DESTINATION_CHAIN_ID, destinationAddress: expectedMessage.destinationAddress, @@ -101,10 +94,7 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { // Expect the exact message to be passed to the precompile. vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.sendWarpMessage, - (abi.encode(expectedMessage)) - ) + abi.encodeCall(IWarpMessenger.sendWarpMessage, (abi.encode(expectedMessage))) ); // Expect the SendCrossChainMessage event to be emitted. @@ -121,18 +111,12 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { messageInput.feeInfo.feeTokenAddress, abi.encodeCall( IERC20.transferFrom, - ( - address(this), - address(teleporterMessenger), - messageInput.feeInfo.amount - ) + (address(this), address(teleporterMessenger), messageInput.feeInfo.amount) ) ); // Act - uint256 messageID = teleporterMessenger.sendCrossChainMessage( - messageInput - ); + uint256 messageID = teleporterMessenger.sendCrossChainMessage(messageInput); // Assert assertEq(messageID, 1); @@ -174,16 +158,14 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { vm.mockCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transferFrom, - (address(this), address(teleporterMessenger), feeAmount) + IERC20.transferFrom, (address(this), address(teleporterMessenger), feeAmount) ), abi.encode(false) ); vm.expectCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transferFrom, - (address(this), address(teleporterMessenger), feeAmount) + IERC20.transferFrom, (address(this), address(teleporterMessenger), feeAmount) ) ); vm.expectRevert("SafeERC20: ERC20 operation did not succeed"); @@ -202,9 +184,7 @@ contract SendCrossChainMessageTest is TeleporterMessengerTest { message: new bytes(0) }); - vm.expectRevert( - _formatTeleporterErrorMessage("zero fee asset contract address") - ); + vm.expectRevert(_formatTeleporterErrorMessage("zero fee asset contract address")); teleporterMessenger.sendCrossChainMessage(messageInput); } } diff --git a/contracts/src/Teleporter/tests/SendSpecifiedReceiptsTests.t.sol b/contracts/src/Teleporter/tests/SendSpecifiedReceiptsTests.t.sol index 0dd092d08..a27014bd0 100644 --- a/contracts/src/Teleporter/tests/SendSpecifiedReceiptsTests.t.sol +++ b/contracts/src/Teleporter/tests/SendSpecifiedReceiptsTests.t.sol @@ -5,7 +5,14 @@ pragma solidity 0.8.18; -import {TeleporterMessengerTest, TeleporterMessage, TeleporterMessageReceipt, TeleporterFeeInfo, IWarpMessenger, IERC20} from "./TeleporterMessengerTest.t.sol"; +import { + TeleporterMessengerTest, + TeleporterMessage, + TeleporterMessageReceipt, + TeleporterFeeInfo, + IWarpMessenger, + IERC20 +} from "./TeleporterMessengerTest.t.sol"; contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { // The state of the contract gets reset before each @@ -23,8 +30,7 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { 0xb85e0651385876C3E3A1fF81ABf410ecf12f52f4 ]; - TeleporterMessageReceipt[] - memory expectedReceipts = new TeleporterMessageReceipt[](3); + TeleporterMessageReceipt[] memory expectedReceipts = new TeleporterMessageReceipt[](3); for (uint256 i = 0; i < relayerRewardAddresses.length; i++) { _receiveTestMessage( DEFAULT_DESTINATION_CHAIN_ID, @@ -51,26 +57,15 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { }); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo(address(0), 0); - emit SendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - 1, - expectedMessage, - feeInfo - ); - uint256 outboundMessageID = _sendTestMessageWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID - ); + emit SendCrossChainMessage(DEFAULT_DESTINATION_CHAIN_ID, 1, expectedMessage, feeInfo); + uint256 outboundMessageID = _sendTestMessageWithNoFee(DEFAULT_DESTINATION_CHAIN_ID); assertEq(outboundMessageID, 1); assertEq( - teleporterMessenger.getRelayerRewardAddress( - DEFAULT_DESTINATION_CHAIN_ID, - 1 - ), + teleporterMessenger.getRelayerRewardAddress(DEFAULT_DESTINATION_CHAIN_ID, 1), relayerRewardAddresses[0] ); - TeleporterMessageReceipt[] - memory newExpectedReceipts = new TeleporterMessageReceipt[](2); + TeleporterMessageReceipt[] memory newExpectedReceipts = new TeleporterMessageReceipt[](2); newExpectedReceipts[0] = TeleporterMessageReceipt({ receivedMessageID: 3, relayerRewardAddress: relayerRewardAddresses[2] @@ -97,17 +92,10 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { receiptIDs[1] = 1; vm.expectEmit(true, true, true, true, address(teleporterMessenger)); - emit SendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - 2, - newExpectedMessage, - feeInfo - ); + emit SendCrossChainMessage(DEFAULT_DESTINATION_CHAIN_ID, 2, newExpectedMessage, feeInfo); - outboundMessageID = _sendSpecifiedReceiptsWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID, - receiptIDs - ); + outboundMessageID = + _sendSpecifiedReceiptsWithNoFee(DEFAULT_DESTINATION_CHAIN_ID, receiptIDs); assertEq(outboundMessageID, 2); } @@ -122,13 +110,11 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { ); // Mock sending a message to that chain, which should include the 2 copies of the same receipt. - TeleporterMessageReceipt - memory expectedReceipt = TeleporterMessageReceipt({ - receivedMessageID: 1, - relayerRewardAddress: DEFAULT_RELAYER_REWARD_ADDRESS - }); - TeleporterMessageReceipt[] - memory expectedReceipts = new TeleporterMessageReceipt[](2); + TeleporterMessageReceipt memory expectedReceipt = TeleporterMessageReceipt({ + receivedMessageID: 1, + relayerRewardAddress: DEFAULT_RELAYER_REWARD_ADDRESS + }); + TeleporterMessageReceipt[] memory expectedReceipts = new TeleporterMessageReceipt[](2); expectedReceipts[0] = expectedReceipt; expectedReceipts[1] = expectedReceipt; TeleporterMessage memory expectedMessage = TeleporterMessage({ @@ -149,16 +135,11 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { // Test sendSpecifiedReceipts when there are duplicate message IDs in the input. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit SendCrossChainMessage( - DEFAULT_DESTINATION_CHAIN_ID, - 1, - expectedMessage, - TeleporterFeeInfo(address(0), 0) + DEFAULT_DESTINATION_CHAIN_ID, 1, expectedMessage, TeleporterFeeInfo(address(0), 0) ); - uint256 outboundMessageID = _sendSpecifiedReceiptsWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID, - messageIDs - ); + uint256 outboundMessageID = + _sendSpecifiedReceiptsWithNoFee(DEFAULT_DESTINATION_CHAIN_ID, messageIDs); assertEq(outboundMessageID, 1); } @@ -176,10 +157,7 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { // Try to send a receipt for an unreceived message from that chain - should fail. vm.expectRevert(_formatTeleporterErrorMessage("receipt not found")); - _sendSpecifiedReceiptsWithNoFee( - DEFAULT_DESTINATION_CHAIN_ID, - missingIDs - ); + _sendSpecifiedReceiptsWithNoFee(DEFAULT_DESTINATION_CHAIN_ID, missingIDs); } function _sendSpecifiedReceiptsWithFee( @@ -197,43 +175,34 @@ contract SendSpecifiedReceiptsTest is TeleporterMessengerTest { vm.mockCall( feeAddress, abi.encodeCall( - IERC20.transferFrom, - (address(this), address(teleporterMessenger), feeAmount) + IERC20.transferFrom, (address(this), address(teleporterMessenger), feeAmount) ), abi.encode(true) ); } - TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo({ - feeTokenAddress: feeAddress, - amount: feeAmount - }); + TeleporterFeeInfo memory feeInfo = + TeleporterFeeInfo({feeTokenAddress: feeAddress, amount: feeAmount}); if (feeAmount > 0) { // Expect the ERC20 contract transferFrom method to be called to transfer the fee. vm.expectCall( feeAddress, abi.encodeCall( - IERC20.transferFrom, - (address(this), address(teleporterMessenger), feeAmount) + IERC20.transferFrom, (address(this), address(teleporterMessenger), feeAmount) ) ); } - return - teleporterMessenger.sendSpecifiedReceipts( - blockchainID, - messageIDs, - feeInfo, - new address[](0) - ); + return teleporterMessenger.sendSpecifiedReceipts( + blockchainID, messageIDs, feeInfo, new address[](0) + ); } function _sendSpecifiedReceiptsWithNoFee( bytes32 blockchainID, uint256[] memory messageIDs ) private returns (uint256) { - return - _sendSpecifiedReceiptsWithFee(blockchainID, messageIDs, address(0), 0); + return _sendSpecifiedReceiptsWithFee(blockchainID, messageIDs, address(0), 0); } } diff --git a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol index 10c748f29..cbfad9700 100644 --- a/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol +++ b/contracts/src/Teleporter/tests/TeleporterMessengerTest.t.sol @@ -6,7 +6,15 @@ pragma solidity 0.8.18; import {Test} from "forge-std/Test.sol"; -import {TeleporterMessenger, TeleporterMessage, TeleporterMessageReceipt, TeleporterMessageInput, TeleporterFeeInfo, IWarpMessenger, WarpMessage} from "../TeleporterMessenger.sol"; +import { + TeleporterMessenger, + TeleporterMessage, + TeleporterMessageReceipt, + TeleporterMessageInput, + TeleporterFeeInfo, + IWarpMessenger, + WarpMessage +} from "../TeleporterMessenger.sol"; import {UnitTestMockERC20} from "../../Mocks/UnitTestMockERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -17,18 +25,12 @@ contract TeleporterMessengerTest is Test { TeleporterMessenger public teleporterMessenger; bytes32 public constant DEFAULT_ORIGIN_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); bytes32 public constant DEFAULT_DESTINATION_CHAIN_ID = - bytes32( - hex"1234567812345678123456781234567812345678123456781234567812345678" - ); - address public constant DEFAULT_DESTINATION_ADDRESS = - 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + bytes32(hex"1234567812345678123456781234567812345678123456781234567812345678"); + address public constant DEFAULT_DESTINATION_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; uint256 public constant DEFAULT_REQUIRED_GAS_LIMIT = 1e6; - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; + address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; address public constant DEFAULT_RELAYER_REWARD_ADDRESS = 0xa4CEE7d1aF6aDdDD33E3b1cC680AB84fdf1b6d1d; @@ -56,15 +58,10 @@ contract TeleporterMessengerTest is Test { ); event MessageExecutionFailed( - bytes32 indexed originBlockchainID, - uint256 indexed messageID, - TeleporterMessage message + bytes32 indexed originBlockchainID, uint256 indexed messageID, TeleporterMessage message ); - event MessageExecuted( - bytes32 indexed originBlockchainID, - uint256 indexed messageID - ); + event MessageExecuted(bytes32 indexed originBlockchainID, uint256 indexed messageID); event FailedFeePayment( bytes32 indexed destinationBlockchainID, @@ -74,11 +71,7 @@ contract TeleporterMessengerTest is Test { address relayerRewardAddress ); - event RelayerRewardsRedeemed( - address indexed redeemer, - address indexed asset, - uint256 amount - ); + event RelayerRewardsRedeemed(address indexed redeemer, address indexed asset, uint256 amount); function setUp() public virtual { vm.mockCall( @@ -96,16 +89,11 @@ contract TeleporterMessengerTest is Test { } function testEmptyReceiptQueue() public { - assertEq( - teleporterMessenger.getReceiptQueueSize( - DEFAULT_DESTINATION_CHAIN_ID - ), - 0 - ); + assertEq(teleporterMessenger.getReceiptQueueSize(DEFAULT_DESTINATION_CHAIN_ID), 0); vm.expectRevert("ReceiptQueue: index out of bounds"); - TeleporterMessageReceipt memory receipt = teleporterMessenger - .getReceiptAtIndex(DEFAULT_DESTINATION_CHAIN_ID, 0); + TeleporterMessageReceipt memory receipt = + teleporterMessenger.getReceiptAtIndex(DEFAULT_DESTINATION_CHAIN_ID, 0); assertEq(receipt.receivedMessageID, 0); assertEq(receipt.relayerRewardAddress, address(0)); } @@ -128,10 +116,8 @@ contract TeleporterMessengerTest is Test { if (feeAmount > 0) { feeAsset = address(_mockFeeAsset); } - TeleporterFeeInfo memory feeInfo = TeleporterFeeInfo({ - feeTokenAddress: feeAsset, - amount: feeAmount - }); + TeleporterFeeInfo memory feeInfo = + TeleporterFeeInfo({feeTokenAddress: feeAsset, amount: feeAmount}); TeleporterMessageInput memory messageInput = TeleporterMessageInput({ destinationBlockchainID: blockchainID, @@ -147,8 +133,7 @@ contract TeleporterMessengerTest is Test { vm.expectCall( address(_mockFeeAsset), abi.encodeCall( - IERC20.transferFrom, - (address(this), address(teleporterMessenger), feeAmount) + IERC20.transferFrom, (address(this), address(teleporterMessenger), feeAmount) ) ); } @@ -156,9 +141,7 @@ contract TeleporterMessengerTest is Test { return teleporterMessenger.sendCrossChainMessage(messageInput); } - function _sendTestMessageWithNoFee( - bytes32 blockchainID - ) internal returns (uint256) { + function _sendTestMessageWithNoFee(bytes32 blockchainID) internal returns (uint256) { return _sendTestMessageWithFee(blockchainID, 0); } @@ -172,8 +155,7 @@ contract TeleporterMessengerTest is Test { abi.encode(warpMessage, true) ); vm.expectCall( - WARP_PRECOMPILE_ADDRESS, - abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (index)) + WARP_PRECOMPILE_ADDRESS, abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (index)) ); } @@ -184,19 +166,14 @@ contract TeleporterMessengerTest is Test { TeleporterMessageReceipt[] memory receipts ) internal { // Construct the test message to be received. - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - messageID, - new bytes(0) - ); + TeleporterMessage memory messageToReceive = + _createMockTeleporterMessage(messageID, new bytes(0)); messageToReceive.receipts = receipts; // Both the sender and destination address should be the teleporter contract address, // mocking as if the universal deployer pattern was used. - WarpMessage memory warpMessage = _createDefaultWarpMessage( - originBlockchainID, - abi.encode(messageToReceive) - ); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(originBlockchainID, abi.encode(messageToReceive)); // We have to mock the precompile call so that it doesn't revert in the tests. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -223,15 +200,9 @@ contract TeleporterMessengerTest is Test { // Construct the test message to be received. By default, the destination // address will be the DEFAULT_DESTINATION_ADDRESS. - TeleporterMessage - memory messageToReceive = _createMockTeleporterMessage( - 13, - messageData - ); - WarpMessage memory warpMessage = _createDefaultWarpMessage( - DEFAULT_ORIGIN_CHAIN_ID, - abi.encode(messageToReceive) - ); + TeleporterMessage memory messageToReceive = _createMockTeleporterMessage(13, messageData); + WarpMessage memory warpMessage = + _createDefaultWarpMessage(DEFAULT_ORIGIN_CHAIN_ID, abi.encode(messageToReceive)); // We have to mock the precompile call so that it doesn't revert in the tests. _setUpSuccessGetVerifiedWarpMessageMock(0, warpMessage); @@ -243,9 +214,7 @@ contract TeleporterMessengerTest is Test { // Receive the message - which should fail execution. vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit MessageExecutionFailed( - DEFAULT_ORIGIN_CHAIN_ID, - messageToReceive.messageID, - messageToReceive + DEFAULT_ORIGIN_CHAIN_ID, messageToReceive.messageID, messageToReceive ); vm.expectEmit(true, true, true, true, address(teleporterMessenger)); emit ReceiveCrossChainMessage( @@ -255,16 +224,9 @@ contract TeleporterMessengerTest is Test { DEFAULT_RELAYER_REWARD_ADDRESS, messageToReceive ); - teleporterMessenger.receiveCrossChainMessage( - 0, - DEFAULT_RELAYER_REWARD_ADDRESS - ); + teleporterMessenger.receiveCrossChainMessage(0, DEFAULT_RELAYER_REWARD_ADDRESS); - return ( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_DESTINATION_ADDRESS, - messageToReceive - ); + return (DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_DESTINATION_ADDRESS, messageToReceive); } // Create a mock message to be used in tests. It should include no receipts @@ -274,34 +236,34 @@ contract TeleporterMessengerTest is Test { uint256 messageID, bytes memory message ) internal view returns (TeleporterMessage memory) { - return - TeleporterMessage({ - messageID: messageID, - senderAddress: address(this), - destinationBlockchainID: DEFAULT_DESTINATION_CHAIN_ID, - destinationAddress: DEFAULT_DESTINATION_ADDRESS, - requiredGasLimit: DEFAULT_REQUIRED_GAS_LIMIT, - allowedRelayerAddresses: new address[](0), - receipts: new TeleporterMessageReceipt[](0), - message: message - }); + return TeleporterMessage({ + messageID: messageID, + senderAddress: address(this), + destinationBlockchainID: DEFAULT_DESTINATION_CHAIN_ID, + destinationAddress: DEFAULT_DESTINATION_ADDRESS, + requiredGasLimit: DEFAULT_REQUIRED_GAS_LIMIT, + allowedRelayerAddresses: new address[](0), + receipts: new TeleporterMessageReceipt[](0), + message: message + }); } function _createDefaultWarpMessage( bytes32 originBlockchainID, bytes memory payload ) internal view returns (WarpMessage memory) { - return - WarpMessage({ - sourceChainID: originBlockchainID, - originSenderAddress: address(teleporterMessenger), - payload: payload - }); + return WarpMessage({ + sourceChainID: originBlockchainID, + originSenderAddress: address(teleporterMessenger), + payload: payload + }); } - function _formatTeleporterErrorMessage( - string memory errorMessage - ) internal pure returns (bytes memory) { + function _formatTeleporterErrorMessage(string memory errorMessage) + internal + pure + returns (bytes memory) + { return bytes(string.concat("TeleporterMessenger: ", errorMessage)); } } diff --git a/contracts/src/Teleporter/upgrades/README.md b/contracts/src/Teleporter/upgrades/README.md index 2007789d1..a929864ac 100644 --- a/contracts/src/Teleporter/upgrades/README.md +++ b/contracts/src/Teleporter/upgrades/README.md @@ -109,4 +109,8 @@ Using specific version: Dapps that inherit from `TeleporterUpgradeable` can pause Teleporter interactions by calling `TeleporterUpgradeable.pauseTeleporterAddress`. This function prevents the contract from interacting with the paused Teleporter address via `_getTeleporterMessenger()`. -`pauseTeleporterAddress` can only be called by addresses with the dapp's upgrade access, checked through `TeleporterUpgradeable._checkTeleporterUpgradeAccess`. \ No newline at end of file +`pauseTeleporterAddress` can only be called by addresses with the dapp's upgrade access, checked through `TeleporterUpgradeable._checkTeleporterUpgradeAccess`. + +As with pausing, dapps can unpause Teleporter interactions by calling `TeleporterUpgradeable.unpauseTeleporterAddress`. This unpause function allows receiving Teleporter message from the unpaused Teleporter address, and also enables the sending of messages through the unpaused Teleporter address in `_getTeleporterMessenger()`. Unpausing is also only allowed by addresses with the dapp's upgrade access. + +Note that receiving Teleporter messages is still governed by the `minTeleporterVersion` check, so even if a Teleporter address is unpaused, the dapp will not receive messages from the unpaused Teleporter address if the Teleporter version is less than `minTeleporterVersion`. \ No newline at end of file diff --git a/contracts/src/Teleporter/upgrades/TeleporterOwnerUpgradeable.sol b/contracts/src/Teleporter/upgrades/TeleporterOwnerUpgradeable.sol index dfbb79437..16426469c 100644 --- a/contracts/src/Teleporter/upgrades/TeleporterOwnerUpgradeable.sol +++ b/contracts/src/Teleporter/upgrades/TeleporterOwnerUpgradeable.sol @@ -13,9 +13,9 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; * only owners of the contract to update the minimum Teleporter version. */ abstract contract TeleporterOwnerUpgradeable is TeleporterUpgradeable, Ownable { - constructor( - address teleporterRegistryAddress - ) TeleporterUpgradeable(teleporterRegistryAddress) {} + constructor(address teleporterRegistryAddress) + TeleporterUpgradeable(teleporterRegistryAddress) + {} /** * @dev See {TeleporterUpgradeable-_checkTeleporterUpgradeAccess} diff --git a/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol b/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol index 1d319afc7..384f57b18 100644 --- a/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol +++ b/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol @@ -37,26 +37,18 @@ contract TeleporterRegistry { uint256 public latestVersion; // Mappings that keep track of the protocol version and corresponding contract address. - mapping(uint256 version => address protocolAddress) - private _versionToAddress; - mapping(address protocolAddress => uint256 version) - private _addressToVersion; + mapping(uint256 version => address protocolAddress) private _versionToAddress; + mapping(address protocolAddress => uint256 version) private _addressToVersion; /** * @dev Emitted when a new protocol version is added to the registry. */ - event AddProtocolVersion( - uint256 indexed version, - address indexed protocolAddress - ); + event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); /** * @dev Emitted when the latest version is updated. */ - event LatestVersionUpdated( - uint256 indexed oldVersion, - uint256 indexed newVersion - ); + event LatestVersionUpdated(uint256 indexed oldVersion, uint256 indexed newVersion); /** * @dev Initializes the contract by setting `blockchainID` and `latestVersion`. @@ -88,12 +80,11 @@ contract TeleporterRegistry { */ function addProtocolVersion(uint32 messageIndex) external { // Get the verified Warp message, and check that it was sent to this registry via a Warp off-chain message. - (WarpMessage memory message, bool success) = WARP_MESSENGER - .getVerifiedWarpMessage(messageIndex); + (WarpMessage memory message, bool success) = + WARP_MESSENGER.getVerifiedWarpMessage(messageIndex); require(success, "TeleporterRegistry: invalid warp message"); require( - message.sourceChainID == blockchainID, - "TeleporterRegistry: invalid source chain ID" + message.sourceChainID == blockchainID, "TeleporterRegistry: invalid source chain ID" ); // Check that the message is sent through a Warp off-chain message. require( @@ -101,13 +92,12 @@ contract TeleporterRegistry { "TeleporterRegistry: invalid origin sender address" ); - (ProtocolRegistryEntry memory entry, address destinationAddress) = abi - .decode(message.payload, (ProtocolRegistryEntry, address)); + (ProtocolRegistryEntry memory entry, address destinationAddress) = + abi.decode(message.payload, (ProtocolRegistryEntry, address)); // Check that the message is sent to the registry. require( - destinationAddress == address(this), - "TeleporterRegistry: invalid destination address" + destinationAddress == address(this), "TeleporterRegistry: invalid destination address" ); _addToRegistry(entry); @@ -116,11 +106,7 @@ contract TeleporterRegistry { /** * @dev Gets the latest {ITeleporterMessenger} contract. */ - function getLatestTeleporter() - external - view - returns (ITeleporterMessenger) - { + function getLatestTeleporter() external view returns (ITeleporterMessenger) { return ITeleporterMessenger(getAddressFromVersion(latestVersion)); } @@ -130,9 +116,11 @@ contract TeleporterRegistry { * * - `version` must be a valid registered version. */ - function getTeleporterFromVersion( - uint256 version - ) external view returns (ITeleporterMessenger) { + function getTeleporterFromVersion(uint256 version) + external + view + returns (ITeleporterMessenger) + { return ITeleporterMessenger(getAddressFromVersion(version)); } @@ -142,15 +130,10 @@ contract TeleporterRegistry { * * - `version` must be a valid registered version. */ - function getAddressFromVersion( - uint256 version - ) public view returns (address) { + function getAddressFromVersion(uint256 version) public view returns (address) { require(version != 0, "TeleporterRegistry: zero version"); address protocolAddress = _versionToAddress[version]; - require( - protocolAddress != address(0), - "TeleporterRegistry: version not found" - ); + require(protocolAddress != address(0), "TeleporterRegistry: version not found"); return protocolAddress; } @@ -160,13 +143,8 @@ contract TeleporterRegistry { * * - `protocolAddress` must be a valid registered protocol address. */ - function getVersionFromAddress( - address protocolAddress - ) public view returns (uint256) { - require( - protocolAddress != address(0), - "TeleporterRegistry: zero protocol address" - ); + function getVersionFromAddress(address protocolAddress) public view returns (uint256) { + require(protocolAddress != address(0), "TeleporterRegistry: zero protocol address"); uint256 version = _addressToVersion[protocolAddress]; require(version != 0, "TeleporterRegistry: protocol address not found"); return version; @@ -192,10 +170,7 @@ contract TeleporterRegistry { _versionToAddress[entry.version] == address(0), "TeleporterRegistry: version already exists" ); - require( - entry.protocolAddress != address(0), - "TeleporterRegistry: zero protocol address" - ); + require(entry.protocolAddress != address(0), "TeleporterRegistry: zero protocol address"); require( entry.version <= latestVersion + MAX_VERSION_INCREMENT, "TeleporterRegistry: version increment too high" diff --git a/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol b/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol index dce3e989d..687e33554 100644 --- a/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol +++ b/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol @@ -23,8 +23,7 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { /** * @dev A mapping that keeps track of paused Teleporter addresses. */ - mapping(address teleporterAddress => bool paused) - private _pausedTeleporterAddresses; + mapping(address teleporterAddress => bool paused) private _pausedTeleporterAddresses; /** * @dev The minimum required Teleporter version that the contract is allowed @@ -36,8 +35,7 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { * @dev Emitted when `minTeleporterVersion` is updated. */ event MinTeleporterVersionUpdated( - uint256 indexed oldMinTeleporterVersion, - uint256 indexed newMinTeleporterVersion + uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion ); /** @@ -45,6 +43,11 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { */ event TeleporterAddressPaused(address indexed teleporterAddress); + /** + * @dev Emitted when a Teleporter address is unpaused. + */ + event TeleporterAddressUnpaused(address indexed teleporterAddress); + /** * @dev Initializes the {TeleporterUpgradeable} contract by getting `teleporterRegistry` * instance and setting `_minTeleporterVersion`. @@ -72,8 +75,7 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { ) external { // Checks that `msg.sender` matches a Teleporter version greater than or equal to `minTeleporterVersion`. require( - teleporterRegistry.getVersionFromAddress(msg.sender) >= - _minTeleporterVersion, + teleporterRegistry.getVersionFromAddress(msg.sender) >= _minTeleporterVersion, "TeleporterUpgradeable: invalid Teleporter sender" ); @@ -83,11 +85,7 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { "TeleporterUpgradeable: Teleporter address paused" ); - _receiveTeleporterMessage( - originBlockchainID, - originSenderAddress, - message - ); + _receiveTeleporterMessage(originBlockchainID, originSenderAddress, message); } /** @@ -112,14 +110,12 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { * Requirements: * * - `msg.sender` must have Teleporter upgrade access. + * - `teleporterAddress` is not the zero address. * - `teleporterAddress` is not already paused. */ function pauseTeleporterAddress(address teleporterAddress) public virtual { _checkTeleporterUpgradeAccess(); - require( - teleporterAddress != address(0), - "TeleporterUpgradeable: zero Teleporter address" - ); + require(teleporterAddress != address(0), "TeleporterUpgradeable: zero Teleporter address"); require( !isTeleporterAddressPaused(teleporterAddress), "TeleporterUpgradeable: address already paused" @@ -128,6 +124,29 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { emit TeleporterAddressPaused(teleporterAddress); } + /** + * @dev Unpauses a Teleporter address from interacting with this contract. + * After unpausing a Teleporter address, it will again be able to deliver messages + * to this contract, and this contract can send messages through that Teleporter address. + * The address does not need to be registered with the Teleporter registry. + * Emits a {TeleporterAddressUnpaused} event if successfully unpaused. + * Requirements: + * + * - `msg.sender` must have Teleporter upgrade access. + * - `teleporterAddress` is not the zero address. + * - `teleporterAddress` is already paused. + */ + function unpauseTeleporterAddress(address teleporterAddress) public virtual { + _checkTeleporterUpgradeAccess(); + require(teleporterAddress != address(0), "TeleporterUpgradeable: zero Teleporter address"); + require( + isTeleporterAddressPaused(teleporterAddress), + "TeleporterUpgradeable: address not paused" + ); + emit TeleporterAddressUnpaused(teleporterAddress); + _pausedTeleporterAddresses[teleporterAddress] = false; + } + /** * @dev Public getter for `_minTeleporterVersion`. */ @@ -138,9 +157,12 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { /** * @dev Checks if a Teleporter address is paused. */ - function isTeleporterAddressPaused( - address teleporterAddress - ) public view virtual returns (bool) { + function isTeleporterAddressPaused(address teleporterAddress) + public + view + virtual + returns (bool) + { return _pausedTeleporterAddresses[teleporterAddress]; } @@ -158,8 +180,7 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { uint256 oldMinTeleporterVersion = _minTeleporterVersion; require( - version <= latestTeleporterVersion, - "TeleporterUpgradeable: invalid Teleporter version" + version <= latestTeleporterVersion, "TeleporterUpgradeable: invalid Teleporter version" ); require( version > oldMinTeleporterVersion, @@ -195,14 +216,8 @@ abstract contract TeleporterUpgradeable is ITeleporterReceiver { * By default returns the latest Teleporter messenger, but can be overriden to * return a Teleporter messenger of a specific version. */ - function _getTeleporterMessenger() - internal - view - virtual - returns (ITeleporterMessenger) - { - ITeleporterMessenger teleporter = teleporterRegistry - .getLatestTeleporter(); + function _getTeleporterMessenger() internal view virtual returns (ITeleporterMessenger) { + ITeleporterMessenger teleporter = teleporterRegistry.getLatestTeleporter(); require( !isTeleporterAddressPaused(address(teleporter)), "TeleporterUpgradeable: Teleporter sending paused" diff --git a/contracts/src/Teleporter/upgrades/tests/GetTeleporterMessengerTests.t.sol b/contracts/src/Teleporter/upgrades/tests/GetTeleporterMessengerTests.t.sol index 0bec3d6bd..53d58fd30 100644 --- a/contracts/src/Teleporter/upgrades/tests/GetTeleporterMessengerTests.t.sol +++ b/contracts/src/Teleporter/upgrades/tests/GetTeleporterMessengerTests.t.sol @@ -23,23 +23,26 @@ contract GetTeleporterMessengerTest is TeleporterUpgradeableTest { } function testGetPausedTeleporterMessenger() public { - app.pauseTeleporterAddress(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter sending paused" - ) - ); + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter sending paused")); + app.getTeleporterMessenger(); + } + + function testGetUnpausedTeleporterMessenger() public { + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter sending paused")); + app.getTeleporterMessenger(); + + // Unpause the Teleporter address, and now we should getTeleporterMessenger successfully + _unpauseTeleporterAddressSuccess(app, teleporterAddress); app.getTeleporterMessenger(); } function testGetNewTeleporterMessenger() public { // Pause the current latest version of Teleporter - app.pauseTeleporterAddress(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter sending paused" - ) - ); + + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter sending paused")); app.getTeleporterMessenger(); // Add a new version of Teleporter, and make sure we can get @@ -59,7 +62,7 @@ contract GetTeleporterMessengerTest is TeleporterUpgradeableTest { _addProtocolVersion(teleporterRegistry, newTeleporterAddress); // Pause a non-latest version of Teleporter - app.pauseTeleporterAddress(teleporterAddress); + _pauseTeleporterAddressSuccess(app, teleporterAddress); // Make sure we can still get the latest version of Teleporter for sending ITeleporterMessenger messenger = app.getTeleporterMessenger(); diff --git a/contracts/src/Teleporter/upgrades/tests/PauseTeleporterAddressTests.t.sol b/contracts/src/Teleporter/upgrades/tests/PauseTeleporterAddressTests.t.sol index 57cbdb89e..c4086a5ce 100644 --- a/contracts/src/Teleporter/upgrades/tests/PauseTeleporterAddressTests.t.sol +++ b/contracts/src/Teleporter/upgrades/tests/PauseTeleporterAddressTests.t.sol @@ -9,8 +9,6 @@ import {TeleporterUpgradeableTest} from "./TeleporterUpgradeableTests.t.sol"; import {TeleporterMessenger} from "../../TeleporterMessenger.sol"; contract PauseTeleporterAddressTest is TeleporterUpgradeableTest { - event TeleporterAddressPaused(address indexed teleporterAddress); - function setUp() public virtual override { TeleporterUpgradeableTest.setUp(); } @@ -18,48 +16,22 @@ contract PauseTeleporterAddressTest is TeleporterUpgradeableTest { function testPauseTeleporterAddressBasic() public { // Check that the teleporterAddress is not paused initially vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); // Check that teleporterAddress can not deliver messages once paused - vm.expectEmit(true, true, true, true, address(app)); - emit TeleporterAddressPaused(teleporterAddress); - app.pauseTeleporterAddress(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); } function testAlreadyPausedTeleporterAddress() public { // Check that teleporterAddress can not deliver messages once paused - vm.expectEmit(true, true, true, true, address(app)); - emit TeleporterAddressPaused(teleporterAddress); - app.pauseTeleporterAddress(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); // Check that teleporterAddress can not be paused again - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage("address already paused") - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("address already paused")); app.pauseTeleporterAddress(teleporterAddress); } @@ -72,41 +44,19 @@ contract PauseTeleporterAddressTest is TeleporterUpgradeableTest { // Check that the teleporterAddress is not paused initially vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); // Check that teleporterAddress can not deliver messages once paused - vm.expectEmit(true, true, true, true, address(app)); - emit TeleporterAddressPaused(teleporterAddress); - app.pauseTeleporterAddress(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); // Check that after updating mininum Teleporter version, the address is still paused - app.updateMinTeleporterVersion(teleporterRegistry.latestVersion()); + _updateMinTeleporterVersionSuccess(app, teleporterRegistry.latestVersion()); vm.prank(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); } function testPauseBeforeRegister() public { @@ -115,33 +65,21 @@ contract PauseTeleporterAddressTest is TeleporterUpgradeableTest { // Create a new Teleporter address that is not registered with the registry address newTeleporterAddress = address(new TeleporterMessenger()); - // Block the new Teleporter address before it is registered - vm.expectEmit(true, true, true, true, address(app)); - emit TeleporterAddressPaused(newTeleporterAddress); - app.pauseTeleporterAddress(newTeleporterAddress); + // Pause the new Teleporter address before it is registered + _pauseTeleporterAddressSuccess(app, newTeleporterAddress); // Register the new Teleporter address _addProtocolVersion(teleporterRegistry, newTeleporterAddress); // Check that the new Teleporter address is paused vm.prank(newTeleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); } function testPauseZeroAddress() public { // Check that a zero address can not be paused - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage("zero Teleporter address") - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("zero Teleporter address")); app.pauseTeleporterAddress(address(0)); } } diff --git a/contracts/src/Teleporter/upgrades/tests/TeleporterOwnerUpgradeableTests.t.sol b/contracts/src/Teleporter/upgrades/tests/TeleporterOwnerUpgradeableTests.t.sol index cef0f7562..c391c47b3 100644 --- a/contracts/src/Teleporter/upgrades/tests/TeleporterOwnerUpgradeableTests.t.sol +++ b/contracts/src/Teleporter/upgrades/tests/TeleporterOwnerUpgradeableTests.t.sol @@ -9,9 +9,9 @@ import {TeleporterOwnerUpgradeable} from "../TeleporterOwnerUpgradeable.sol"; import {TeleporterUpgradeableTest} from "./TeleporterUpgradeableTests.t.sol"; contract ExampleOwnerUpgradeableApp is TeleporterOwnerUpgradeable { - constructor( - address teleporterRegistryAddress - ) TeleporterOwnerUpgradeable(teleporterRegistryAddress) {} + constructor(address teleporterRegistryAddress) + TeleporterOwnerUpgradeable(teleporterRegistryAddress) + {} function checkTeleporterUpgradeAccess() external view { _checkTeleporterUpgradeAccess(); @@ -26,8 +26,7 @@ contract ExampleOwnerUpgradeableApp is TeleporterOwnerUpgradeable { contract TeleporterOwnerUpgradeableTest is TeleporterUpgradeableTest { ExampleOwnerUpgradeableApp public ownerApp; - address public constant MOCK_INVALID_OWNER_ADDRESS = - 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + address public constant MOCK_INVALID_OWNER_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; function setUp() public virtual override { TeleporterUpgradeableTest.setUp(); @@ -48,12 +47,7 @@ contract TeleporterOwnerUpgradeableTest is TeleporterUpgradeableTest { // Check that call to update minimum Teleporter version succeeds for owners vm.prank(address(this)); - vm.expectEmit(true, true, true, true, address(ownerApp)); - emit MinTeleporterVersionUpdated( - minTeleporterVersion, - minTeleporterVersion + 1 - ); - ownerApp.updateMinTeleporterVersion(minTeleporterVersion + 1); + _updateMinTeleporterVersionSuccess(ownerApp, minTeleporterVersion + 1); assertEq(ownerApp.getMinTeleporterVersion(), minTeleporterVersion + 1); } @@ -79,11 +73,6 @@ contract TeleporterOwnerUpgradeableTest is TeleporterUpgradeableTest { address newOwner = address(0x123); ownerApp.transferOwnership(newOwner); vm.prank(newOwner); - vm.expectEmit(true, true, true, true, address(ownerApp)); - emit MinTeleporterVersionUpdated( - minTeleporterVersion, - minTeleporterVersion + 1 - ); ownerApp.updateMinTeleporterVersion(minTeleporterVersion + 1); // Check that call with old owner reverts @@ -102,7 +91,7 @@ contract TeleporterOwnerUpgradeableTest is TeleporterUpgradeableTest { _addProtocolVersion(teleporterRegistry, teleporterAddress); uint256 latestVersion = teleporterRegistry.latestVersion(); // Check that update Teleporter version call for owner succeeds - ownerApp.updateMinTeleporterVersion(latestVersion); + _updateMinTeleporterVersionSuccess(ownerApp, latestVersion); // Check that after ownership renounce call reverts ownerApp.renounceOwnership(); @@ -111,35 +100,27 @@ contract TeleporterOwnerUpgradeableTest is TeleporterUpgradeableTest { } function testPauseTeleporterAccess() public { - // Check that call to pause Teleporter address reverts for non-owners + // First pause the Teleporter address + _pauseTeleporterAddressSuccess(ownerApp, teleporterAddress); + + // Try to unpause the Teleporter address from non-owner account vm.prank(MOCK_INVALID_OWNER_ADDRESS); vm.expectRevert("Ownable: caller is not the owner"); - ownerApp.pauseTeleporterAddress(teleporterAddress); + ownerApp.unpauseTeleporterAddress(teleporterAddress); - // Check that Teleporter address was not paused + // Check that the Teleporter address is still paused vm.prank(teleporterAddress); - ownerApp.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); + ownerApp.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + assertTrue(ownerApp.isTeleporterAddressPaused(teleporterAddress)); - // Check that call to pause Teleporter address succeeds for owners - vm.prank(address(this)); - ownerApp.pauseTeleporterAddress(teleporterAddress); + // Unpause the Teleporter address from owner account + _unpauseTeleporterAddressSuccess(ownerApp, teleporterAddress); - // Check that Teleporter address was paused + // Check that the Teleporter address can now deliver messages vm.prank(teleporterAddress); - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "Teleporter address paused" - ) - ); - ownerApp.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + ownerApp.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + assertFalse(ownerApp.isTeleporterAddressPaused(teleporterAddress)); } function testOwnerUpgradeAccess() public { diff --git a/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol b/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol index b1435d635..52d203110 100644 --- a/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol +++ b/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol @@ -14,18 +14,11 @@ contract TeleporterRegistryTest is Test { address public teleporterAddress; bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); - address public constant WARP_PRECOMPILE_ADDRESS = - 0x0200000000000000000000000000000000000005; + address public constant WARP_PRECOMPILE_ADDRESS = 0x0200000000000000000000000000000000000005; - event AddProtocolVersion( - uint256 indexed version, - address indexed protocolAddress - ); + event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress); - event LatestVersionUpdated( - uint256 indexed oldVersion, - uint256 indexed newVersion - ); + event LatestVersionUpdated(uint256 indexed oldVersion, uint256 indexed newVersion); function setUp() public virtual { vm.mockCall( @@ -47,10 +40,7 @@ contract TeleporterRegistryTest is Test { _addProtocolVersion(teleporterRegistry, teleporterAddress); assertEq(latestVersion + 1, teleporterRegistry.latestVersion()); - assertEq( - teleporterAddress, - address(teleporterRegistry.getLatestTeleporter()) - ); + assertEq(teleporterAddress, address(teleporterRegistry.getLatestTeleporter())); assertEq( teleporterRegistry.getVersionFromAddress(teleporterAddress), teleporterRegistry.latestVersion() @@ -68,10 +58,7 @@ contract TeleporterRegistryTest is Test { teleporterRegistry.addProtocolVersion(messageIndex); assertEq(latestVersion + 2, teleporterRegistry.latestVersion()); - assertEq( - teleporterAddress, - address(teleporterRegistry.getLatestTeleporter()) - ); + assertEq(teleporterAddress, address(teleporterRegistry.getLatestTeleporter())); } function testAddNonContractAddress() public { @@ -88,10 +75,7 @@ contract TeleporterRegistryTest is Test { teleporterRegistry.addProtocolVersion(messageIndex); assertEq(latestVersion + 2, teleporterRegistry.latestVersion()); - assertEq( - address(this), - teleporterRegistry.getAddressFromVersion(latestVersion + 2) - ); + assertEq(address(this), teleporterRegistry.getAddressFromVersion(latestVersion + 2)); } function testAddOldVersion() public { @@ -109,18 +93,12 @@ contract TeleporterRegistryTest is Test { teleporterRegistry.addProtocolVersion(messageIndex); assertEq(latestVersion + 2, teleporterRegistry.latestVersion()); - assertEq( - teleporterAddress, - teleporterRegistry.getAddressFromVersion(latestVersion + 2) - ); + assertEq(teleporterAddress, teleporterRegistry.getAddressFromVersion(latestVersion + 2)); // latestVersion + 1 was skipped in previous check, is not registered, and is less than latestVersion() uint256 oldVersion = latestVersion + 1; warpMessage = _createWarpOffChainMessage( - oldVersion, - address(teleporterRegistry), - address(this), - address(teleporterRegistry) + oldVersion, address(teleporterRegistry), address(this), address(teleporterRegistry) ); // Make sure that oldVersion is not registered, and is less than latestVersion() @@ -130,10 +108,7 @@ contract TeleporterRegistryTest is Test { _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); teleporterRegistry.addProtocolVersion(messageIndex); - assertEq( - address(this), - teleporterRegistry.getAddressFromVersion(oldVersion) - ); + assertEq(address(this), teleporterRegistry.getAddressFromVersion(oldVersion)); assertEq(oldVersion + 1, teleporterRegistry.latestVersion()); } @@ -152,31 +127,19 @@ contract TeleporterRegistryTest is Test { teleporterRegistry.addProtocolVersion(messageIndex); assertEq(latestVersion + 2, teleporterRegistry.latestVersion()); - assertEq( - teleporterAddress, - teleporterRegistry.getAddressFromVersion(latestVersion + 2) - ); + assertEq(teleporterAddress, teleporterRegistry.getAddressFromVersion(latestVersion + 2)); // latestVersion + 1 was skipped in previous check, is not registered, and is less than latestVersion() uint256 oldVersion = latestVersion + 1; warpMessage = _createWarpOffChainMessage( - oldVersion, - address(teleporterRegistry), - teleporterAddress, - address(teleporterRegistry) + oldVersion, address(teleporterRegistry), teleporterAddress, address(teleporterRegistry) ); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); teleporterRegistry.addProtocolVersion(messageIndex); - assertEq( - teleporterAddress, - teleporterRegistry.getAddressFromVersion(oldVersion) - ); + assertEq(teleporterAddress, teleporterRegistry.getAddressFromVersion(oldVersion)); - assertEq( - latestVersion + 2, - teleporterRegistry.getVersionFromAddress(teleporterAddress) - ); + assertEq(latestVersion + 2, teleporterRegistry.getVersionFromAddress(teleporterAddress)); } function testAddExistingVersion() public { @@ -194,10 +157,7 @@ contract TeleporterRegistryTest is Test { teleporterRegistry.addProtocolVersion(messageIndex); assertEq(latestVersion + 1, teleporterRegistry.latestVersion()); - assertEq( - teleporterAddress, - teleporterRegistry.getAddressFromVersion(latestVersion + 1) - ); + assertEq(teleporterAddress, teleporterRegistry.getAddressFromVersion(latestVersion + 1)); // Check that adding a protocol version with the same version fails vm.expectRevert(_formatRegistryErrorMessage("version already exists")); @@ -210,10 +170,7 @@ contract TeleporterRegistryTest is Test { // Check that adding an invalid protocol address of address(0) fails WarpMessage memory warpMessage = _createWarpOffChainMessage( - latestVersion + 1, - address(teleporterRegistry), - address(0), - address(teleporterRegistry) + latestVersion + 1, address(teleporterRegistry), address(0), address(teleporterRegistry) ); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); @@ -226,10 +183,7 @@ contract TeleporterRegistryTest is Test { // Check that adding an invalid version of 0 fails WarpMessage memory warpMessage = _createWarpOffChainMessage( - 0, - address(teleporterRegistry), - teleporterAddress, - address(teleporterRegistry) + 0, address(teleporterRegistry), teleporterAddress, address(teleporterRegistry) ); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); @@ -242,10 +196,7 @@ contract TeleporterRegistryTest is Test { uint256 latestVersion = teleporterRegistry.latestVersion(); // First test success case - assertEq( - teleporterAddress, - teleporterRegistry.getAddressFromVersion(latestVersion) - ); + assertEq(teleporterAddress, teleporterRegistry.getAddressFromVersion(latestVersion)); // Check that getting version 0 fails vm.expectRevert(_formatRegistryErrorMessage("zero version")); @@ -261,15 +212,10 @@ contract TeleporterRegistryTest is Test { uint256 latestVersion = teleporterRegistry.latestVersion(); // First test success case - assertEq( - latestVersion, - teleporterRegistry.getVersionFromAddress(teleporterAddress) - ); + assertEq(latestVersion, teleporterRegistry.getVersionFromAddress(teleporterAddress)); // Check that getting a version of an address that doesn't exist reverts - vm.expectRevert( - _formatRegistryErrorMessage("protocol address not found") - ); + vm.expectRevert(_formatRegistryErrorMessage("protocol address not found")); teleporterRegistry.getVersionFromAddress(address(this)); } @@ -301,23 +247,16 @@ contract TeleporterRegistryTest is Test { warpMessage.originSenderAddress = address(this); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); - vm.expectRevert( - _formatRegistryErrorMessage("invalid origin sender address") - ); + vm.expectRevert(_formatRegistryErrorMessage("invalid origin sender address")); teleporterRegistry.addProtocolVersion(messageIndex); // Check if we have an invalid destination address warpMessage = _createWarpOffChainMessage( - latestVersion + 1, - address(this), - teleporterAddress, - address(teleporterRegistry) + latestVersion + 1, address(this), teleporterAddress, address(teleporterRegistry) ); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); - vm.expectRevert( - _formatRegistryErrorMessage("invalid destination address") - ); + vm.expectRevert(_formatRegistryErrorMessage("invalid destination address")); teleporterRegistry.addProtocolVersion(messageIndex); } @@ -352,9 +291,7 @@ contract TeleporterRegistryTest is Test { _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); - vm.expectRevert( - _formatRegistryErrorMessage("version increment too high") - ); + vm.expectRevert(_formatRegistryErrorMessage("version increment too high")); teleporterRegistry.addProtocolVersion(messageIndex); } @@ -365,10 +302,7 @@ contract TeleporterRegistryTest is Test { uint256 latestVersion = registry.latestVersion(); uint32 messageIndex = 0; WarpMessage memory warpMessage = _createWarpOffChainMessage( - latestVersion + 1, - address(registry), - newProtocolAddress, - address(registry) + latestVersion + 1, address(registry), newProtocolAddress, address(registry) ); _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); @@ -386,18 +320,12 @@ contract TeleporterRegistryTest is Test { ) internal { vm.mockCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.getVerifiedWarpMessage, - (messageIndex) - ), + abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (messageIndex)), abi.encode(warpMessage, isValid) ); vm.expectCall( WARP_PRECOMPILE_ADDRESS, - abi.encodeCall( - IWarpMessenger.getVerifiedWarpMessage, - (messageIndex) - ) + abi.encodeCall(IWarpMessenger.getVerifiedWarpMessage, (messageIndex)) ); } @@ -407,24 +335,21 @@ contract TeleporterRegistryTest is Test { address protocolAddress, address registryAddress ) internal view returns (WarpMessage memory) { - return - WarpMessage({ - sourceChainID: MOCK_BLOCK_CHAIN_ID, - originSenderAddress: TeleporterRegistry(registryAddress) - .VALIDATORS_SOURCE_ADDRESS(), - payload: abi.encode( - ProtocolRegistryEntry({ - version: version, - protocolAddress: protocolAddress - }), - destinationAddress + return WarpMessage({ + sourceChainID: MOCK_BLOCK_CHAIN_ID, + originSenderAddress: TeleporterRegistry(registryAddress).VALIDATORS_SOURCE_ADDRESS(), + payload: abi.encode( + ProtocolRegistryEntry({version: version, protocolAddress: protocolAddress}), + destinationAddress ) - }); + }); } - function _formatRegistryErrorMessage( - string memory errorMessage - ) internal pure returns (bytes memory) { + function _formatRegistryErrorMessage(string memory errorMessage) + internal + pure + returns (bytes memory) + { return bytes(string.concat("TeleporterRegistry: ", errorMessage)); } } diff --git a/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol b/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol index 291386e8c..d41c77506 100644 --- a/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol +++ b/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol @@ -6,23 +6,19 @@ pragma solidity 0.8.18; import {TeleporterUpgradeable} from "../TeleporterUpgradeable.sol"; -import {TeleporterRegistryTest, TeleporterMessenger} from "./TeleporterRegistryTests.t.sol"; +import {TeleporterRegistryTest} from "./TeleporterRegistryTests.t.sol"; import {ITeleporterMessenger} from "../../ITeleporterMessenger.sol"; contract ExampleUpgradeableApp is TeleporterUpgradeable { - constructor( - address teleporterRegistryAddress - ) TeleporterUpgradeable(teleporterRegistryAddress) {} + constructor(address teleporterRegistryAddress) + TeleporterUpgradeable(teleporterRegistryAddress) + {} function setMinTeleporterVersion(uint256 version) public { _setMinTeleporterVersion(version); } - function getTeleporterMessenger() - public - view - returns (ITeleporterMessenger) - { + function getTeleporterMessenger() public view returns (ITeleporterMessenger) { return _getTeleporterMessenger(); } @@ -39,18 +35,18 @@ contract ExampleUpgradeableApp is TeleporterUpgradeable { contract TeleporterUpgradeableTest is TeleporterRegistryTest { ExampleUpgradeableApp public app; bytes32 public constant DEFAULT_ORIGIN_CHAIN_ID = - bytes32( - hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd" - ); + bytes32(hex"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd"); - address public constant DEFAULT_ORIGIN_ADDRESS = - 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; + address public constant DEFAULT_ORIGIN_ADDRESS = 0xd54e3E251b9b0EEd3ed70A858e927bbC2659587d; event MinTeleporterVersionUpdated( - uint256 indexed oldMinTeleporterVersion, - uint256 indexed newMinTeleporterVersion + uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion ); + event TeleporterAddressPaused(address indexed teleporterAddress); + + event TeleporterAddressUnpaused(address indexed teleporterAddress); + function setUp() public virtual override { TeleporterRegistryTest.setUp(); _addProtocolVersion(teleporterRegistry, teleporterAddress); @@ -59,9 +55,7 @@ contract TeleporterUpgradeableTest is TeleporterRegistryTest { function testInvalidRegistryAddress() public { vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "zero teleporter registry address" - ) + _formatTeleporterUpgradeableErrorMessage("zero teleporter registry address") ); new ExampleUpgradeableApp(address(0)); } @@ -69,83 +63,25 @@ contract TeleporterUpgradeableTest is TeleporterRegistryTest { function testOnlyAllowedTeleporter() public { assertEq(app.getMinTeleporterVersion(), 1); - vm.expectRevert( - _formatRegistryErrorMessage("protocol address not found") - ); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + vm.expectRevert(_formatRegistryErrorMessage("protocol address not found")); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); - } - - function testUpdateMinTeleporterVersion() public { - // First check that calling with initial teleporter address works - assertEq(app.getMinTeleporterVersion(), 1); - vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); - - // Now add new protocol version to registry and update the app's min version - address newTeleporterAddress = address(new TeleporterMessenger()); - _addProtocolVersion(teleporterRegistry, newTeleporterAddress); - - vm.expectEmit(true, true, true, true, address(app)); - emit MinTeleporterVersionUpdated(1, 2); - - app.updateMinTeleporterVersion(teleporterRegistry.latestVersion()); - assertEq(app.getMinTeleporterVersion(), 2); - - // Check that calling with the old teleporter address fails - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "invalid Teleporter sender" - ) - ); - vm.prank(teleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); - - // Check that calling with the new teleporter address works - vm.prank(newTeleporterAddress); - app.receiveTeleporterMessage( - DEFAULT_ORIGIN_CHAIN_ID, - DEFAULT_ORIGIN_ADDRESS, - "" - ); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); } function testSetMinTeleporterVersion() public { uint256 latestVersion = teleporterRegistry.latestVersion(); // Check setting for a version > latest version fails - vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "invalid Teleporter version" - ) - ); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("invalid Teleporter version")); app.setMinTeleporterVersion(latestVersion + 1); // Check setting for a version <= min version fails uint256 minVersion = app.getMinTeleporterVersion(); assertEq(minVersion, teleporterRegistry.latestVersion()); vm.expectRevert( - _formatTeleporterUpgradeableErrorMessage( - "not greater than current minimum version" - ) + _formatTeleporterUpgradeableErrorMessage("not greater than current minimum version") ); app.setMinTeleporterVersion(minVersion); @@ -159,9 +95,38 @@ contract TeleporterUpgradeableTest is TeleporterRegistryTest { assertEq(app.getMinTeleporterVersion(), latestVersion + 1); } - function _formatTeleporterUpgradeableErrorMessage( - string memory errorMessage - ) internal pure returns (bytes memory) { + function _updateMinTeleporterVersionSuccess( + TeleporterUpgradeable app_, + uint256 newMinTeleporterVersion + ) internal virtual { + vm.expectEmit(true, true, true, true, address(app_)); + emit MinTeleporterVersionUpdated(app_.getMinTeleporterVersion(), newMinTeleporterVersion); + app_.updateMinTeleporterVersion(newMinTeleporterVersion); + } + + function _pauseTeleporterAddressSuccess( + TeleporterUpgradeable app_, + address teleporterAddress_ + ) internal virtual { + vm.expectEmit(true, true, true, true, address(app_)); + emit TeleporterAddressPaused(teleporterAddress_); + app_.pauseTeleporterAddress(teleporterAddress_); + } + + function _unpauseTeleporterAddressSuccess( + TeleporterUpgradeable app_, + address teleporterAddress_ + ) internal virtual { + vm.expectEmit(true, true, true, true, address(app_)); + emit TeleporterAddressUnpaused(teleporterAddress_); + app_.unpauseTeleporterAddress(teleporterAddress_); + } + + function _formatTeleporterUpgradeableErrorMessage(string memory errorMessage) + internal + pure + returns (bytes memory) + { return bytes(string.concat("TeleporterUpgradeable: ", errorMessage)); } } diff --git a/contracts/src/Teleporter/upgrades/tests/UnpauseTeleporterAddressTests.t.sol b/contracts/src/Teleporter/upgrades/tests/UnpauseTeleporterAddressTests.t.sol new file mode 100644 index 000000000..38accbc8a --- /dev/null +++ b/contracts/src/Teleporter/upgrades/tests/UnpauseTeleporterAddressTests.t.sol @@ -0,0 +1,125 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import {TeleporterUpgradeableTest} from "./TeleporterUpgradeableTests.t.sol"; +import {TeleporterMessenger} from "../../TeleporterMessenger.sol"; + +contract UnpauseTeleporterAddressTest is TeleporterUpgradeableTest { + function setUp() public virtual override { + TeleporterUpgradeableTest.setUp(); + } + + function testUnpauseLessThanMinimumVersion() public { + // Check the case where a Teleporter address was previously paused, and now updates the minimum version. + // If the dapp unpauses the previous Teleporter address, it still can not receive messages from it, + // since receiving messages still checks against minimum Teleporter version. + + // Pause the Teleporter address + _pauseTeleporterAddressSuccess(app, teleporterAddress); + + // The Teleporter address paused no longer can deliver messages to the app + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Add a new Teleporter address to the registry and update minimum version + address newTeleporterAddress = address(new TeleporterMessenger()); + _addProtocolVersion(teleporterRegistry, newTeleporterAddress); + _updateMinTeleporterVersionSuccess(app, teleporterRegistry.latestVersion()); + + // Unpause the previously paused Teleporter address + _unpauseTeleporterAddressSuccess(app, teleporterAddress); + + // The previously paused Teleporter address still can not deliver messages to the app + // because the minimum version is still greater than the Teleporter address version + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("invalid Teleporter sender")); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Check that the new Teleporter address delivers messages fine + vm.prank(newTeleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUnpauseTeleporterAddressBasic() public { + // Check that the teleporterAddress is not paused initially + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + // Check that teleporterAddress can not deliver messages once paused + _pauseTeleporterAddressSuccess(app, teleporterAddress); + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("Teleporter address paused")); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Unpause the teleporterAddress and check that it can deliver messages again + _unpauseTeleporterAddressSuccess(app, teleporterAddress); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testAlreadyUnpausedTeleporterAddress() public { + // Check unpausing for an address that was never paused + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("address not paused")); + app.unpauseTeleporterAddress(teleporterAddress); + + // Pause the Teleporter address + _pauseTeleporterAddressSuccess(app, teleporterAddress); + + // Try to unpause the Teleporter address first time should succeed + _unpauseTeleporterAddressSuccess(app, teleporterAddress); + + // Try to unpause the Teleporter address second time should fail + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("address not paused")); + app.unpauseTeleporterAddress(teleporterAddress); + } + + function testUnpauseBeforeRegister() public { + // Check that a Teleporter address can be paused before it is registered with the registry + + // Create a new Teleporter address that is not registered with the registry + address newTeleporterAddress = address(new TeleporterMessenger()); + + // Pause the new Teleporter address before it is registered + _pauseTeleporterAddressSuccess(app, newTeleporterAddress); + + // Unpause before the Teleporter address is registered + _unpauseTeleporterAddressSuccess(app, newTeleporterAddress); + + // Register the new Teleporter address + _addProtocolVersion(teleporterRegistry, newTeleporterAddress); + + // Check that the new Teleporter address is unpaused + vm.prank(newTeleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUnpauseAfterRegister() public { + // Check that a Teleporter address can be paused before it is registered with the registry + + // Create a new Teleporter address that is not registered with the registry + address newTeleporterAddress = address(new TeleporterMessenger()); + + // Pause the new Teleporter address before it is registered + _pauseTeleporterAddressSuccess(app, newTeleporterAddress); + + // Register the new Teleporter address + _addProtocolVersion(teleporterRegistry, newTeleporterAddress); + + // Unpause before the Teleporter address is registered + _unpauseTeleporterAddressSuccess(app, newTeleporterAddress); + + // Check that the new Teleporter address is unpaused + vm.prank(newTeleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUnpauseZeroAddress() public { + // Check that a zero address can not be paused + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("zero Teleporter address")); + app.unpauseTeleporterAddress(address(0)); + } +} diff --git a/contracts/src/Teleporter/upgrades/tests/UpdateMinTeleporterVersionTests.t.sol b/contracts/src/Teleporter/upgrades/tests/UpdateMinTeleporterVersionTests.t.sol new file mode 100644 index 000000000..7855fa8a6 --- /dev/null +++ b/contracts/src/Teleporter/upgrades/tests/UpdateMinTeleporterVersionTests.t.sol @@ -0,0 +1,117 @@ +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// SPDX-License-Identifier: Ecosystem + +pragma solidity 0.8.18; + +import {TeleporterUpgradeableTest} from "./TeleporterUpgradeableTests.t.sol"; +import {TeleporterMessenger, WarpMessage} from "../../TeleporterMessenger.sol"; + +contract UpdateMinTeleporterVersionTest is TeleporterUpgradeableTest { + function setUp() public virtual override { + TeleporterUpgradeableTest.setUp(); + } + + function testMessageDeliveryFromOutdatedVersion() public { + // First check that calling with initial teleporter address works + assertEq(app.getMinTeleporterVersion(), 1); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Now add new protocol version to registry and update the app's min version + address newTeleporterAddress = address(new TeleporterMessenger()); + _addProtocolVersion(teleporterRegistry, newTeleporterAddress); + + _updateMinTeleporterVersionSuccess(app, teleporterRegistry.latestVersion()); + assertEq(app.getMinTeleporterVersion(), 2); + + // Check that calling with the old teleporter address fails + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("invalid Teleporter sender")); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Check that calling with the new teleporter address works + vm.prank(newTeleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUpdateToNonRegisteredVersion() public { + // The Teleporter registry allows skipping versions, so we don't have to update + // in increments of 1. This test checks that the app can update to a version + // that is not registered in the registry. + + // First add to the registry by skipping a version + address newTeleporterAddress = address(new TeleporterMessenger()); + uint256 latestVersion = teleporterRegistry.latestVersion(); + uint32 messageIndex = 0; + WarpMessage memory warpMessage = _createWarpOffChainMessage( + latestVersion + 2, + address(teleporterRegistry), + newTeleporterAddress, + address(teleporterRegistry) + ); + _mockGetVerifiedWarpMessage(messageIndex, warpMessage, true); + + vm.expectEmit(true, true, true, true, address(teleporterRegistry)); + emit AddProtocolVersion(latestVersion + 2, newTeleporterAddress); + vm.expectEmit(true, true, true, true, address(teleporterRegistry)); + emit LatestVersionUpdated(latestVersion, latestVersion + 2); + teleporterRegistry.addProtocolVersion(messageIndex); + + // Check that the latest version is updated + assertEq(teleporterRegistry.latestVersion(), latestVersion + 2); + + // Make sure that a version was skipped and is not registered + uint256 skippedVersion = latestVersion + 1; + vm.expectRevert(_formatRegistryErrorMessage("version not found")); + teleporterRegistry.getTeleporterFromVersion(skippedVersion); + + // Update to the skipped version + _updateMinTeleporterVersionSuccess(app, skippedVersion); + assertEq(app.getMinTeleporterVersion(), skippedVersion); + + // Make sure that the old minimum Teleporter version can not deliver messages + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("invalid Teleporter sender")); + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + + // Make sure that the new minimum Teleporter version can still deliver messages + vm.prank(newTeleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUpdateWithCurrentVersion() public { + // Get the current minimum Teleporter version + uint256 minTeleporterVersion = app.getMinTeleporterVersion(); + + // Check that current latest version is equal to minimum version + assertEq(minTeleporterVersion, teleporterRegistry.latestVersion()); + + // Try to update to current minimum version, should fail + vm.expectRevert( + _formatTeleporterUpgradeableErrorMessage("not greater than current minimum version") + ); + app.updateMinTeleporterVersion(minTeleporterVersion); + + // Check that minimum version is still the same + assertEq(app.getMinTeleporterVersion(), minTeleporterVersion); + + // Check that calling with the teleporter address works + vm.prank(teleporterAddress); + app.receiveTeleporterMessage(DEFAULT_ORIGIN_CHAIN_ID, DEFAULT_ORIGIN_ADDRESS, ""); + } + + function testUpdateWithGreaterThanLatestVersion() public { + // Get current latest version and minimum Teleporter version + uint256 latestVersion = teleporterRegistry.latestVersion(); + uint256 minTeleporterVersion = app.getMinTeleporterVersion(); + + // Try to update to a version greater than the latest version, should fail + vm.expectRevert(_formatTeleporterUpgradeableErrorMessage("invalid Teleporter version")); + app.updateMinTeleporterVersion(latestVersion + 1); + + // Check that minimum version is still the same + assertEq(app.getMinTeleporterVersion(), minTeleporterVersion); + } +} diff --git a/go.mod b/go.mod index 27e891615..1a525902b 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ module github.com/ava-labs/teleporter go 1.20 require ( - github.com/ava-labs/avalanchego v1.10.15 + github.com/ava-labs/avalanchego v1.10.17 github.com/supranational/blst v0.3.11 // indirect ) require ( - github.com/ava-labs/avalanche-network-runner v1.7.3 - github.com/ava-labs/subnet-evm v0.5.9 + github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b + github.com/ava-labs/subnet-evm v0.5.10 github.com/ethereum/go-ethereum v1.12.0 github.com/onsi/ginkgo/v2 v2.13.2 github.com/onsi/gomega v1.30.0 @@ -25,7 +25,7 @@ require ( github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.10.0 // indirect - github.com/ava-labs/coreth v0.12.8-rc.1 // indirect + github.com/ava-labs/coreth v0.12.9-rc.9 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect @@ -126,14 +126,14 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/mock v0.2.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.14.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.14.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect diff --git a/go.sum b/go.sum index 742c24720..9cdb0b423 100644 --- a/go.sum +++ b/go.sum @@ -59,14 +59,14 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/avalanche-network-runner v1.7.3 h1:9fY3PXoqLg6EOJ+wRzftG5Od4CtGEFFq9STugo99bAo= -github.com/ava-labs/avalanche-network-runner v1.7.3/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= -github.com/ava-labs/avalanchego v1.10.15 h1:GQ1bkwgKnv5D/yUwXUjWPFqx1cWrf35WOaHSykHUXyE= -github.com/ava-labs/avalanchego v1.10.15/go.mod h1:fHTzxKZOMdM0n4EEXDDR0V3Ieb/Jnz7PM8zAsJRsh2U= -github.com/ava-labs/coreth v0.12.8-rc.1 h1:tvJcxQTQzxIQqx8TnrxdyMhZYbdsMaiy6AEiOyjvaa4= -github.com/ava-labs/coreth v0.12.8-rc.1/go.mod h1:GBH5SxHZdScSp95IijDs9+Gxw/QDIWvfoLKiJMNYLsE= -github.com/ava-labs/subnet-evm v0.5.9 h1:IYWj5j83C2oterPOrxOix6/qYCua85HTQ/viMFHNPOM= -github.com/ava-labs/subnet-evm v0.5.9/go.mod h1:n4/abB4BYU1xlAqD15uKz6pRROOh/5u5Jxf4JPK6DbY= +github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b h1:iH6q+S7dmBOYCXrZx+nNlS1HBp72L2msiVCLs39Ls5A= +github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= +github.com/ava-labs/avalanchego v1.10.17 h1:Ri01nU5ukKC38ZCkCh3namaMZtJkSuv1X/vC13uJguc= +github.com/ava-labs/avalanchego v1.10.17/go.mod h1:A6f3877qlq7bePjCU4T0D60bZGecRMCk15pMpJGOb4Q= +github.com/ava-labs/coreth v0.12.9-rc.9 h1:mvYxABdyPByXwwwIxnTBCiNO23dsE1Kfnd5H106lric= +github.com/ava-labs/coreth v0.12.9-rc.9/go.mod h1:yrf2vEah4Fgj6sJ4UpHewo4DLolwdpf2bJuLRT80PGw= +github.com/ava-labs/subnet-evm v0.5.10 h1:ed9BxoiuXRnB/qKakKzYKtZzV/gVjOB2LxuDegpLs9g= +github.com/ava-labs/subnet-evm v0.5.10/go.mod h1:wln8B4siQ1Osch+elW9vW1XJGjj5PYxQETkzFyDEMjk= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -633,8 +633,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -812,12 +812,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -828,8 +828,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/scripts/lint.sh b/scripts/lint.sh index fb379da33..6c89e1997 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -6,27 +6,24 @@ set -e source ./scripts/versions.sh -LINTER= -HELP= -while [ $# -gt 0 ]; do - case "$1" in - -l | --linter) LINTER=$2 ;; - -h | --help) HELP=true ;; - esac - shift -done +TELEPORTER_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) -if [ "$HELP" = true ]; then - echo "Usage: ./scripts/lint.sh [OPTIONS]" - echo "Lint Teleporter Solidity contracts and E2E tests Golang code." - echo "" - echo "Options:" - echo " -l, --linter Specify which linter (sol/go) to run. If empty, runs both solidity and go linters." - echo " -h, --help Print this help message" - exit 0 -fi +function solFormat() { + # format solidity contracts + echo "Formatting Solidity contracts..." + forge fmt --root $TELEPORTER_PATH/contracts $TELEPORTER_PATH/contracts/src/** +} -function sollinter() { +function solFormatCheck() { + # format solidity contracts + echo "Checking formatting of Solidity contracts..." + forge fmt --check --root $TELEPORTER_PATH/contracts $TELEPORTER_PATH/contracts/src/** +} + +function solLinter() { # lint solidity contracts echo "Linting Solidity contracts..." cd $TELEPORTER_PATH/contracts/src @@ -35,26 +32,60 @@ function sollinter() { solhint '**/*.sol' --config ./.solhint.json --ignore-path ./.solhintignore --max-warnings 0 } -function golanglinter() { +function golangLinter() { # lint e2e tests go code go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} echo "Linting Golang code..." - cd $TELEPORTER_PATH/ + cd $TELEPORTER_PATH golangci-lint run --config=$TELEPORTER_PATH/.golangci.yml ./... } -if [ -z "$LINTER" ]; then - sollinter - golanglinter -elif [ "$LINTER" = "sol" ]; then - sollinter -elif [ "$LINTER" = "go" ]; then - golanglinter -else - echo "Invalid linter option: $LINTER" - exit 1 +function runAll() { + solFormat + solLinter + golangLinter +} + +function printHelp() { + echo "Usage: ./scripts/lint.sh [OPTIONS]" + echo "Lint/Format Teleporter Solidity contracts and E2E tests Golang code." + echo "Pass no parameters to perform all checks" + printUsage +} + +function printUsage() { + echo "Options:" + echo " -sfc, --sol-format-check Check for proper formatted Solidity files. Exits with code 1 if not." + echo " -sf, --sol-format Format Solidity contracts" + echo " -sl, --sol-lint Run the Solidity linter" + echo " -gl, --go-lint Run the Golang linter" + echo " -h, --help Print this help message" +} + +# if we have no args, perform all checks +if [ $# -eq 0 ]; then + runAll + exit 0 fi +while [ $# -gt 0 ]; do + case "$1" in + -sfc | --sol-format-check) + solFormatCheck ;; + -sf | --sol-format) + solFormat ;; + -sl | --sol-lint) + solLinter ;; + -gl | --go-lint) + golangLinter ;; + -h | --help) + printHelp ;; + *) + echo "Invalid option: -$1" && printHelp && exit 1;; + esac + shift +done + exit 0 \ No newline at end of file diff --git a/tests/flows/block_hash_publish_receive.go b/tests/flows/block_hash_publish_receive.go index 4e7bf745e..19ffe3635 100644 --- a/tests/flows/block_hash_publish_receive.go +++ b/tests/flows/block_hash_publish_receive.go @@ -50,8 +50,7 @@ func BlockHashPublishReceive(network interfaces.Network) { tx_opts, subnetBInfo.BlockchainID, receiverAddress) Expect(err).Should(BeNil()) - receipt, err := bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) + receipt := utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) // relay publication diff --git a/tests/flows/deliver_to_nonexistent_contract.go b/tests/flows/deliver_to_nonexistent_contract.go index 3554075d6..2be592475 100644 --- a/tests/flows/deliver_to_nonexistent_contract.go +++ b/tests/flows/deliver_to_nonexistent_contract.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" examplecrosschainmessenger "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ava-labs/teleporter/tests/utils" @@ -34,7 +33,7 @@ func DeliverToNonExistentContract(network interfaces.Network) { fundDeployerTx := utils.CreateNativeTransferTransaction( ctx, subnetBInfo, fundedKey, deployerAddress, fundAmount, ) - utils.SendTransactionAndWaitForAcceptance(ctx, subnetBInfo, fundDeployerTx, true) + utils.SendTransactionAndWaitForSuccess(ctx, subnetBInfo, fundDeployerTx) // // Deploy ExampleMessenger to Subnet A, but not to Subnet B @@ -69,9 +68,7 @@ func DeliverToNonExistentContract(network interfaces.Network) { Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) sendEvent, err := utils.GetEventFromLogs(receipt.Logs, subnetAInfo.TeleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/deliver_to_wrong_chain.go b/tests/flows/deliver_to_wrong_chain.go index 9eeb71726..3df1fa157 100644 --- a/tests/flows/deliver_to_wrong_chain.go +++ b/tests/flows/deliver_to_wrong_chain.go @@ -74,7 +74,7 @@ func DeliverToWrongChain(network interfaces.Network) { // the same message to subnet C. // wrongChainDeliveryTx := createWrongChainDeliveryTransaction(ctx, deliveryTx, fundedKey, fundedAddress, subnetCInfo) - utils.SendTransactionAndWaitForAcceptance(ctx, subnetCInfo, wrongChainDeliveryTx, false) + utils.SendTransactionAndWaitForFailure(ctx, subnetCInfo, wrongChainDeliveryTx) } // diff --git a/tests/flows/erc20_bridge_multihop.go b/tests/flows/erc20_bridge_multihop.go index a959ae619..24c50ff54 100644 --- a/tests/flows/erc20_bridge_multihop.go +++ b/tests/flows/erc20_bridge_multihop.go @@ -381,9 +381,7 @@ func submitCreateBridgeToken( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, source.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, source, tx) event, err := utils.GetEventFromLogs(receipt.Logs, teleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) @@ -429,9 +427,7 @@ func bridgeToken( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, source.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, source, tx) event, err := utils.GetEventFromLogs(receipt.Logs, teleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) @@ -457,10 +453,8 @@ func approveBridgeToken( opts, err := bind.NewKeyedTransactorWithChainID(fundedKey, source.EVMChainID) Expect(err).Should(BeNil()) - txn, err := transactor.Approve(opts, spender, amount) + tx, err := transactor.Approve(opts, spender, amount) Expect(err).Should(BeNil()) - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + utils.WaitForTransactionSuccess(ctx, source, tx) } diff --git a/tests/flows/erc20_to_native_token_bridge.go b/tests/flows/erc20_to_native_token_bridge.go index 61ec05dd5..4c5aacd35 100644 --- a/tests/flows/erc20_to_native_token_bridge.go +++ b/tests/flows/erc20_to_native_token_bridge.go @@ -126,7 +126,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { tx, err := exampleERC20.Approve(transactor, bridgeContractAddress, bal) Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) + utils.WaitForTransactionSuccess(ctx, sourceSubnet, tx) } { @@ -276,7 +276,7 @@ func ERC20ToNativeTokenBridge(network interfaces.LocalNetwork) { ) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destSubnet) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, destSubnet, tx) reportEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -339,7 +339,7 @@ func sendERC20TokensToDestination( ) Expect(err).Should(BeNil()) - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, sourceSubnet, tx) transferEvent, err := utils.GetEventFromLogs( sourceChainReceipt.Logs, diff --git a/tests/flows/example_messenger.go b/tests/flows/example_messenger.go index 5a0a71be1..5c3f2c2e1 100644 --- a/tests/flows/example_messenger.go +++ b/tests/flows/example_messenger.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" examplecrosschainmessenger "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ava-labs/teleporter/tests/utils" @@ -45,9 +44,7 @@ func ExampleMessenger(network interfaces.Network) { Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) event, err := utils.GetEventFromLogs(receipt.Logs, subnetAInfo.TeleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/insufficient_gas.go b/tests/flows/insufficient_gas.go index 28555ecda..245f488ab 100644 --- a/tests/flows/insufficient_gas.go +++ b/tests/flows/insufficient_gas.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ava-labs/teleporter/tests/utils" . "github.com/onsi/gomega" @@ -34,9 +33,7 @@ func InsufficientGas(network interfaces.Network) { Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) event, err := utils.GetEventFromLogs(receipt.Logs, subnetAInfo.TeleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/native_token_bridge.go b/tests/flows/native_token_bridge.go index 4ab292e6d..d38e7d464 100644 --- a/tests/flows/native_token_bridge.go +++ b/tests/flows/native_token_bridge.go @@ -252,7 +252,7 @@ func NativeTokenBridge(network interfaces.LocalNetwork) { ) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destSubnet) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, destSubnet, tx) reportEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -363,7 +363,7 @@ func sendTokensToSource( ) Expect(err).Should(BeNil()) - destChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), destinationSubnet) + destChainReceipt := utils.WaitForTransactionSuccess(ctx, destinationSubnet, tx) transferEvent, err := utils.GetEventFromLogs( destChainReceipt.Logs, @@ -400,7 +400,7 @@ func sendNativeTokensToDestination( ) Expect(err).Should(BeNil()) - sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, tx.Hash(), sourceSubnet) + sourceChainReceipt := utils.WaitForTransactionSuccess(ctx, sourceSubnet, tx) transferEvent, err := utils.GetEventFromLogs( sourceChainReceipt.Logs, diff --git a/tests/flows/relayer_modifies_message.go b/tests/flows/relayer_modifies_message.go index 0d449a651..1179f15ec 100644 --- a/tests/flows/relayer_modifies_message.go +++ b/tests/flows/relayer_modifies_message.go @@ -86,7 +86,7 @@ func relayAlteredMessage( ) log.Info("Sending transaction to destination chain") - utils.SendTransactionAndWaitForAcceptance(ctx, destination, signedTx, false) + utils.SendTransactionAndWaitForFailure(ctx, destination, signedTx) } func createAlteredReceiveCrossChainMessageTransaction( diff --git a/tests/flows/retry_successful_execution.go b/tests/flows/retry_successful_execution.go index fac255dfb..ea745a3f5 100644 --- a/tests/flows/retry_successful_execution.go +++ b/tests/flows/retry_successful_execution.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" examplecrosschainmessenger "github.com/ava-labs/teleporter/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ava-labs/teleporter/tests/utils" @@ -44,9 +43,7 @@ func RetrySuccessfulExecution(network interfaces.Network) { Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) event, err := utils.GetEventFromLogs(receipt.Logs, subnetAInfo.TeleporterMessenger.ParseSendCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/validator_churn.go b/tests/flows/validator_churn.go index e874c478e..5ed3a7199 100644 --- a/tests/flows/validator_churn.go +++ b/tests/flows/validator_churn.go @@ -6,7 +6,6 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/accounts/abi/bind" - "github.com/ava-labs/subnet-evm/core/types" subnetEvmUtils "github.com/ava-labs/subnet-evm/tests/utils" teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/Teleporter/TeleporterMessenger" "github.com/ava-labs/teleporter/tests/interfaces" @@ -93,7 +92,7 @@ func ValidatorChurn(network interfaces.LocalNetwork) { ) log.Info("Sending transaction to destination chain") - receipt = utils.SendTransactionAndWaitForAcceptance(ctx, subnetBInfo, signedTx, false) + utils.SendTransactionAndWaitForFailure(ctx, subnetBInfo, signedTx) // Verify the message was not delivered delivered, err := subnetBInfo.TeleporterMessenger.MessageReceived( @@ -114,9 +113,7 @@ func ValidatorChurn(network interfaces.LocalNetwork) { Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err = bind.WaitMined(ctx, subnetAInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt = utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx) network.RelayMessage(ctx, receipt, subnetAInfo, subnetBInfo, true) diff --git a/tests/local/network.go b/tests/local/network.go index 7f02bb5cc..94dd0bb4c 100644 --- a/tests/local/network.go +++ b/tests/local/network.go @@ -250,7 +250,7 @@ func (n *localNetwork) deployTeleporterContracts( fundDeployerTx := utils.CreateNativeTransferTransaction( ctx, subnetInfo, fundedKey, deployerAddress, fundAmount, ) - utils.SendTransactionAndWaitForAcceptance(ctx, subnetInfo, fundDeployerTx, true) + utils.SendTransactionAndWaitForSuccess(ctx, subnetInfo, fundDeployerTx) } log.Info("Finished funding Teleporter deployer", "blockchainID", subnetInfo.BlockchainID.Hex()) @@ -310,9 +310,8 @@ func (n *localNetwork) deployTeleporterRegistryContracts( n.subnetsInfo[subnetInfo.SubnetID].TeleporterRegistryAddress = teleporterRegistryAddress // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnetInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + utils.WaitForTransactionSuccess(ctx, subnetInfo, tx) + log.Info("Deployed TeleporterRegistry contract to subnet", subnetInfo.SubnetID.Hex(), "Deploy address", teleporterRegistryAddress.Hex()) } @@ -351,7 +350,8 @@ func (n *localNetwork) RelayMessage(ctx context.Context, sourceReceipt *types.Receipt, source interfaces.SubnetTestInfo, destination interfaces.SubnetTestInfo, - expectSuccess bool) *types.Receipt { + expectSuccess bool, +) *types.Receipt { // Fetch the Teleporter message from the logs sendEvent, err := utils.GetEventFromLogs(sourceReceipt.Logs, source.TeleporterMessenger.ParseSendCrossChainMessage) @@ -370,12 +370,12 @@ func (n *localNetwork) RelayMessage(ctx context.Context, ) log.Info("Sending transaction to destination chain") - receipt := utils.SendTransactionAndWaitForAcceptance(ctx, destination, signedTx, expectSuccess) - if !expectSuccess { - return nil + return utils.SendTransactionAndWaitForFailure(ctx, destination, signedTx) } + receipt := utils.SendTransactionAndWaitForSuccess(ctx, destination, signedTx) + // Check the transaction logs for the ReceiveCrossChainMessage event emitted by the Teleporter contract receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, destination.TeleporterMessenger.ParseReceiveCrossChainMessage) @@ -460,7 +460,10 @@ func (n *localNetwork) ConstructSignedWarpMessageBytes( warpClient, err := warpBackend.NewClient(source.NodeURIs[0], source.BlockchainID.String()) Expect(err).Should(BeNil()) signedWarpMessageBytes, err := warpClient.GetMessageAggregateSignature( - ctx, unsignedWarpMessageID, params.WarpQuorumDenominator, + ctx, + unsignedWarpMessageID, + params.WarpQuorumDenominator, + source.SubnetID.String(), ) Expect(err).Should(BeNil()) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index ed7eb624f..07fe970cb 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -25,7 +25,6 @@ import ( "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/eth/tracers" "github.com/ava-labs/subnet-evm/ethclient" - "github.com/ava-labs/subnet-evm/params" predicateutils "github.com/ava-labs/subnet-evm/predicate" "github.com/ava-labs/subnet-evm/rpc" "github.com/ava-labs/subnet-evm/x/warp" @@ -41,72 +40,16 @@ import ( ) var ( - NativeTransferGas uint64 = 21_000 - DefaultTeleporterTransactionGas uint64 = 300_000 - DefaultTeleporterTransactionGasFeeCap = big.NewInt(225 * params.GWei) - DefaultTeleporterTransactionGasTipCap = big.NewInt(params.GWei) - DefaultTeleporterTransactionValue = common.Big0 - ExpectedExampleERC20DeployerBalance = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e10)) + NativeTransferGas uint64 = 21_000 + DefaultTeleporterTransactionGas uint64 = 300_000 + DefaultTeleporterTransactionValue = common.Big0 + ExpectedExampleERC20DeployerBalance = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(1e10)) ) // // Test utility functions // -// Subscribes to new heads, sends a tx, and waits for the new head to appear -// Returns the new head -func SendTransactionAndWaitForAcceptance( - ctx context.Context, - subnetInfo interfaces.SubnetTestInfo, - tx *types.Transaction, - expectSuccess bool) *types.Receipt { - err := subnetInfo.RPCClient.SendTransaction(ctx, tx) - Expect(err).Should(BeNil()) - - // Wait for the transaction to be accepted - receipt, err := bind.WaitMined(ctx, subnetInfo.RPCClient, tx) - Expect(err).Should(BeNil()) - if expectSuccess { - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - } else { - Expect(receipt.Status).Should(Equal(types.ReceiptStatusFailed)) - } - - return receipt -} - -func SendCrossChainMessageAndWaitForAcceptance( - ctx context.Context, - source interfaces.SubnetTestInfo, - destination interfaces.SubnetTestInfo, - input teleportermessenger.TeleporterMessageInput, - senderKey *ecdsa.PrivateKey, - // transactor *teleportermessenger.TeleporterMessenger, -) (*types.Receipt, *big.Int) { - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, source.EVMChainID) - Expect(err).Should(BeNil()) - - // Send a transaction to the Teleporter contract - txn, err := source.TeleporterMessenger.SendCrossChainMessage(opts, input) - Expect(err).Should(BeNil()) - - // Wait for the transaction to be accepted - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - - // Check the transaction logs for the SendCrossChainMessage event emitted by the Teleporter contract - event, err := GetEventFromLogs(receipt.Logs, source.TeleporterMessenger.ParseSendCrossChainMessage) - Expect(err).Should(BeNil()) - - log.Info("Sending SendCrossChainMessage transaction on source chain", - "sourceChainID", source.BlockchainID, - "destinationChainID", destination.BlockchainID, - "txHash", txn.Hash()) - - return receipt, event.Message.MessageID -} - func SendAddFeeAmountAndWaitForAcceptance( ctx context.Context, source interfaces.SubnetTestInfo, @@ -121,11 +64,10 @@ func SendAddFeeAmountAndWaitForAcceptance( senderKey, source.EVMChainID) Expect(err).Should(BeNil()) - txn, err := transactor.AddFeeAmount(opts, destination.BlockchainID, messageID, feeContractAddress, amount) - Expect(err).Should(BeNil()) - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) + tx, err := transactor.AddFeeAmount(opts, destination.BlockchainID, messageID, feeContractAddress, amount) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + receipt := WaitForTransactionSuccess(ctx, source, tx) addFeeAmountEvent, err := GetEventFromLogs(receipt.Logs, transactor.ParseAddFeeAmount) Expect(err).Should(BeNil()) @@ -146,19 +88,14 @@ func RetryMessageExecutionAndWaitForAcceptance( subnet interfaces.SubnetTestInfo, message teleportermessenger.TeleporterMessage, senderKey *ecdsa.PrivateKey, - // transactor *teleportermessenger.TeleporterMessenger, ) *types.Receipt { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) - txn, err := subnet.TeleporterMessenger.RetryMessageExecution(opts, originChainID, message) - Expect(err).Should(BeNil()) - - receipt, err := bind.WaitMined(ctx, subnet.RPCClient, txn) + tx, err := subnet.TeleporterMessenger.RetryMessageExecution(opts, originChainID, message) Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - return receipt + return WaitForTransactionSuccess(ctx, subnet, tx) } func RedeemRelayerRewardsAndConfirm( @@ -180,13 +117,12 @@ func RedeemRelayerRewardsAndConfirm( relayerKey, subnet.EVMChainID, ) Expect(err).Should(BeNil()) - transaction, err := subnet.TeleporterMessenger.RedeemRelayerRewards( + tx, err := subnet.TeleporterMessenger.RedeemRelayerRewards( tx_opts, feeTokenAddress, ) Expect(err).Should(BeNil()) - receipt, err := bind.WaitMined(ctx, subnet.RPCClient, transaction) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + + receipt := WaitForTransactionSuccess(ctx, subnet, tx) balanceAfterRedemption, err := feeToken.BalanceOf( &bind.CallOpts{}, relayerAddress, @@ -201,8 +137,11 @@ func RedeemRelayerRewardsAndConfirm( ), ) - updatedRewardAmount, err := - subnet.TeleporterMessenger.CheckRelayerRewardAmount(&bind.CallOpts{}, relayerAddress, feeTokenAddress) + updatedRewardAmount, err := subnet.TeleporterMessenger.CheckRelayerRewardAmount( + &bind.CallOpts{}, + relayerAddress, + feeTokenAddress, + ) Expect(err).Should(BeNil()) Expect(updatedRewardAmount.Cmp(big.NewInt(0))).Should(Equal(0)) @@ -217,18 +156,15 @@ func SendSpecifiedReceiptsAndWaitForAcceptance( feeInfo teleportermessenger.TeleporterFeeInfo, allowedRelayerAddresses []common.Address, senderKey *ecdsa.PrivateKey, - // transactor *teleportermessenger.TeleporterMessenger, ) (*types.Receipt, *big.Int) { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, source.EVMChainID) Expect(err).Should(BeNil()) - txn, err := source.TeleporterMessenger.SendSpecifiedReceipts( + tx, err := source.TeleporterMessenger.SendSpecifiedReceipts( opts, originChainID, messageIDs, feeInfo, allowedRelayerAddresses) Expect(err).Should(BeNil()) - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + receipt := WaitForTransactionSuccess(ctx, source, tx) // Check the transaction logs for the SendCrossChainMessage event emitted by the Teleporter contract event, err := GetEventFromLogs(receipt.Logs, source.TeleporterMessenger.ParseSendCrossChainMessage) @@ -237,7 +173,7 @@ func SendSpecifiedReceiptsAndWaitForAcceptance( log.Info("Sending SendSpecifiedReceipts transaction", "originChainID", originChainID, - "txHash", txn.Hash()) + "txHash", tx.Hash()) return receipt, event.Message.MessageID } @@ -406,31 +342,112 @@ func CreateNativeTransferTransaction( return SignTransaction(tx, fromKey, subnetInfo.EVMChainID) } +// Sends a tx, and waits for it to be mined. +// Asserts Receipt.status equals success. +func sendAndWaitForTransaction( + ctx context.Context, + subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, + success bool, +) *types.Receipt { + err := subnetInfo.RPCClient.SendTransaction(ctx, tx) + Expect(err).Should(BeNil()) + + return waitForTransaction(ctx, subnetInfo, tx, success) +} + +// Sends a tx, and waits for it to be mined. +// Asserts Receipt.status equals false. +func SendTransactionAndWaitForFailure( + ctx context.Context, + subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, +) *types.Receipt { + return sendAndWaitForTransaction(ctx, subnetInfo, tx, false) +} + +// Sends a tx, and waits for it to be mined. +// Asserts Receipt.status equals true. +func SendTransactionAndWaitForSuccess( + ctx context.Context, + subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, +) *types.Receipt { + return sendAndWaitForTransaction(ctx, subnetInfo, tx, true) +} + +func SendCrossChainMessageAndWaitForAcceptance( + ctx context.Context, + source interfaces.SubnetTestInfo, + destination interfaces.SubnetTestInfo, + input teleportermessenger.TeleporterMessageInput, + senderKey *ecdsa.PrivateKey, +) (*types.Receipt, *big.Int) { + opts, err := bind.NewKeyedTransactorWithChainID(senderKey, source.EVMChainID) + Expect(err).Should(BeNil()) + + // Send a transaction to the Teleporter contract + tx, err := source.TeleporterMessenger.SendCrossChainMessage(opts, input) + Expect(err).Should(BeNil()) + + // Wait for the transaction to be accepted + receipt := WaitForTransactionSuccess(ctx, source, tx) + + // Check the transaction logs for the SendCrossChainMessage event emitted by the Teleporter contract + event, err := GetEventFromLogs(receipt.Logs, source.TeleporterMessenger.ParseSendCrossChainMessage) + Expect(err).Should(BeNil()) + + log.Info("Sending SendCrossChainMessage transaction on source chain", + "sourceChainID", source.BlockchainID, + "destinationChainID", destination.BlockchainID, + "txHash", tx.Hash()) + + return receipt, event.Message.MessageID +} + +// Waits for a transaction to be mined. +// Asserts Receipt.status equals true. func WaitForTransactionSuccess( ctx context.Context, - txHash common.Hash, subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, ) *types.Receipt { - receipt := WaitForTransaction(ctx, txHash, subnetInfo) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) - return receipt + return waitForTransaction(ctx, subnetInfo, tx, true) +} + +// Waits for a transaction to be mined. +// Asserts Receipt.status equals false. +func WaitForTransactionFailure( + ctx context.Context, + subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, +) *types.Receipt { + return waitForTransaction(ctx, subnetInfo, tx, false) } -func WaitForTransaction(ctx context.Context, txHash common.Hash, subnetInfo interfaces.SubnetTestInfo) *types.Receipt { +// Waits for a transaction to be mined. +// Asserts Receipt.status equals success. +func waitForTransaction( + ctx context.Context, + subnetInfo interfaces.SubnetTestInfo, + tx *types.Transaction, + success bool, +) *types.Receipt { cctx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() - // Loop until we find the transaction or time out - for { - receipt, err := subnetInfo.RPCClient.TransactionReceipt(cctx, txHash) - if err == nil { - return receipt - } else { - Expect(err).ShouldNot(Equal(context.DeadlineExceeded)) - log.Info("Waiting for transaction", "hash", txHash.Hex()) - time.Sleep(500 * time.Millisecond) + receipt, err := bind.WaitMined(cctx, subnetInfo.RPCClient, tx) + Expect(err).Should(BeNil()) + + if success { + if receipt.Status == types.ReceiptStatusFailed { + fmt.Println(TraceTransaction(ctx, subnetInfo, tx)) } + Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + } else { + Expect(receipt.Status).Should(Equal(types.ReceiptStatusFailed)) } + return receipt } // Returns the first log in 'logs' that is successfully parsed by 'parser' @@ -485,7 +502,7 @@ func CheckBalance(ctx context.Context, addr common.Address, expectedBalance *big ExpectBigEqual(bal, expectedBalance) } -func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo interfaces.SubnetTestInfo) string { +func TraceTransaction(ctx context.Context, subnetInfo interfaces.SubnetTestInfo, tx *types.Transaction) string { url := HttpToRPCURI(subnetInfo.NodeURIs[0], subnetInfo.BlockchainID.String()) rpcClient, err := rpc.DialContext(ctx, url) Expect(err).Should(BeNil()) @@ -493,7 +510,7 @@ func TraceTransaction(ctx context.Context, txHash common.Hash, subnetInfo interf var result interface{} ct := "callTracer" - err = rpcClient.Call(&result, "debug_traceTransaction", txHash.String(), tracers.TraceConfig{Tracer: &ct}) + err = rpcClient.Call(&result, "debug_traceTransaction", tx.Hash().String(), tracers.TraceConfig{Tracer: &ct}) Expect(err).Should(BeNil()) jsonStr, err := json.Marshal(result) @@ -526,8 +543,8 @@ func DeployContract( Expect(err).Should(BeNil()) // Wait for transaction, then check code was deployed - receipt := WaitForTransaction(ctx, tx.Hash(), subnetInfo) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, subnetInfo, tx) + code, err := subnetInfo.WSClient.CodeAt(ctx, contractAddress, nil) Expect(err).Should(BeNil()) Expect(len(code)).Should(BeNumerically(">", 2)) // 0x is an EOA, contract returns the bytecode @@ -556,13 +573,11 @@ func ERC20Approve( ) { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, source.EVMChainID) Expect(err).Should(BeNil()) - txn, err := token.Approve(opts, spender, amount) + tx, err := token.Approve(opts, spender, amount) Expect(err).Should(BeNil()) - log.Info("Approved ERC20", "spender", spender.Hex(), "txHash", txn.Hash().Hex()) + log.Info("Approved ERC20", "spender", spender.Hex(), "txHash", tx.Hash().Hex()) - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, source, tx) } func DeployExampleERC20( @@ -574,14 +589,12 @@ func DeployExampleERC20( Expect(err).Should(BeNil()) // Deploy Mock ERC20 contract - address, txn, token, err := exampleerc20.DeployExampleERC20(opts, source.RPCClient) + address, tx, token, err := exampleerc20.DeployExampleERC20(opts, source.RPCClient) Expect(err).Should(BeNil()) - log.Info("Deployed Mock ERC20 contract", "address", address.Hex(), "txHash", txn.Hash().Hex()) + log.Info("Deployed Mock ERC20 contract", "address", address.Hex(), "txHash", tx.Hash().Hex()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, source.RPCClient, txn) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, source, tx) // Check that the deployer has the expected initial balance senderAddress := crypto.PubkeyToAddress(senderKey.PublicKey) @@ -606,9 +619,7 @@ func DeployExampleCrossChainMessenger( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnet.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, subnet, tx) return address, exampleMessenger } @@ -626,9 +637,7 @@ func DeployERC20Bridge( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, source.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, source, tx) log.Info("Deployed ERC20 Bridge contract", "address", address.Hex(), "txHash", tx.Hash().Hex()) @@ -649,9 +658,7 @@ func DeployBlockHashPublisher( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnet.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, subnet, tx) return address, publisher } @@ -676,9 +683,7 @@ func DeployBlockHashReceiver( Expect(err).Should(BeNil()) // Wait for the transaction to be mined - receipt, err := bind.WaitMined(ctx, subnet.RPCClient, tx) - Expect(err).Should(BeNil()) - Expect(receipt.Status).Should(Equal(types.ReceiptStatusSuccessful)) + WaitForTransactionSuccess(ctx, subnet, tx) return address, receiver }