diff --git a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go index a93965bc3..5994b4903 100644 --- a/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go +++ b/abi-bindings/go/CrossChainApplications/ERC20Bridge/ERC20Bridge/ERC20Bridge.go @@ -31,7 +31,7 @@ var ( // ERC20BridgeMetaData contains all meta data concerning the ERC20Bridge contract. var ERC20BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"tokenContractAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"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\":\"bytes32\",\"name\":\"destinationChainID\",\"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\"},{\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + 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\":\"destinationChainID\",\"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\":\"nativeChainID\",\"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\":\"destinationChainID\",\"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\"},{\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentChainID\",\"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\":\"destinationChainID\",\"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\":\"minTeleporterVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nativeToWrappedTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nativeChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"nativeBridgeAddress\",\"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\":\"destinationChainID\",\"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\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"submittedBridgeTokenCreations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"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\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokenContracts\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ERC20BridgeABI is the input ABI used to generate the binding from. @@ -459,6 +459,37 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) EncodeTransferBridgeTokensData(des return _ERC20Bridge.Contract.EncodeTransferBridgeTokensData(&_ERC20Bridge.CallOpts, destinationChainID, destinationBridgeAddress, nativeContractAddress, recipient, amount, feeAmount) } +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeSession) MinTeleporterVersion() (*big.Int, error) { + return _ERC20Bridge.Contract.MinTeleporterVersion(&_ERC20Bridge.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ERC20Bridge *ERC20BridgeCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _ERC20Bridge.Contract.MinTeleporterVersion(&_ERC20Bridge.CallOpts) +} + // NativeToWrappedTokens is a free data retrieval call binding the contract method 0x65435568. // // Solidity: function nativeToWrappedTokens(bytes32 , address , address ) view returns(address) @@ -490,6 +521,37 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) NativeToWrappedTokens(arg0 [32]byt return _ERC20Bridge.Contract.NativeToWrappedTokens(&_ERC20Bridge.CallOpts, arg0, arg1, arg2) } +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20Bridge.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) Owner() (common.Address, error) { + return _ERC20Bridge.Contract.Owner(&_ERC20Bridge.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) Owner() (common.Address, error) { + return _ERC20Bridge.Contract.Owner(&_ERC20Bridge.CallOpts) +} + // SubmittedBridgeTokenCreations is a free data retrieval call binding the contract method 0x8343f661. // // Solidity: function submittedBridgeTokenCreations(bytes32 , address , address ) view returns(bool) @@ -521,12 +583,12 @@ func (_ERC20Bridge *ERC20BridgeCallerSession) SubmittedBridgeTokenCreations(arg0 return _ERC20Bridge.Contract.SubmittedBridgeTokenCreations(&_ERC20Bridge.CallOpts, arg0, arg1, arg2) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20Bridge *ERC20BridgeCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _ERC20Bridge.contract.Call(opts, &out, "teleporterMessenger") + err := _ERC20Bridge.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -538,18 +600,18 @@ func (_ERC20Bridge *ERC20BridgeCaller) TeleporterMessenger(opts *bind.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20Bridge *ERC20BridgeSession) TeleporterMessenger() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeSession) TeleporterRegistry() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterMessenger() (common.Address, error) { - return _ERC20Bridge.Contract.TeleporterMessenger(&_ERC20Bridge.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ERC20Bridge *ERC20BridgeCallerSession) TeleporterRegistry() (common.Address, error) { + return _ERC20Bridge.Contract.TeleporterRegistry(&_ERC20Bridge.CallOpts) } // WrappedTokenContracts is a free data retrieval call binding the contract method 0x9bd9abc0. @@ -625,6 +687,27 @@ func (_ERC20Bridge *ERC20BridgeTransactorSession) ReceiveTeleporterMessage(nativ return _ERC20Bridge.Contract.ReceiveTeleporterMessage(&_ERC20Bridge.TransactOpts, nativeChainID, nativeBridgeAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20Bridge *ERC20BridgeTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20Bridge *ERC20BridgeSession) RenounceOwnership() (*types.Transaction, error) { + return _ERC20Bridge.Contract.RenounceOwnership(&_ERC20Bridge.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _ERC20Bridge.Contract.RenounceOwnership(&_ERC20Bridge.TransactOpts) +} + // SubmitCreateBridgeToken is a paid mutator transaction binding the contract method 0x6c7e40d1. // // Solidity: function submitCreateBridgeToken(bytes32 destinationChainID, address destinationBridgeAddress, address nativeToken, address messageFeeAsset, uint256 messageFeeAmount) returns() @@ -646,6 +729,48 @@ func (_ERC20Bridge *ERC20BridgeTransactorSession) SubmitCreateBridgeToken(destin return _ERC20Bridge.Contract.SubmitCreateBridgeToken(&_ERC20Bridge.TransactOpts, destinationChainID, destinationBridgeAddress, nativeToken, messageFeeAsset, messageFeeAmount) } +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20Bridge *ERC20BridgeTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20Bridge *ERC20BridgeSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ERC20Bridge.Contract.TransferOwnership(&_ERC20Bridge.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ERC20Bridge.Contract.TransferOwnership(&_ERC20Bridge.TransactOpts, newOwner) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20Bridge.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ERC20Bridge *ERC20BridgeTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ERC20Bridge.Contract.UpdateMinTeleporterVersion(&_ERC20Bridge.TransactOpts) +} + // ERC20BridgeBridgeTokensIterator is returned from FilterBridgeTokens and is used to iterate over the raw logs and unpacked data for BridgeTokens events raised by the ERC20Bridge contract. type ERC20BridgeBridgeTokensIterator struct { Event *ERC20BridgeBridgeTokens // Event containing the contract specifics and raw log @@ -974,6 +1099,159 @@ func (_ERC20Bridge *ERC20BridgeFilterer) ParseCreateBridgeToken(log types.Log) ( return event, nil } +// ERC20BridgeMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the ERC20Bridge contract. +type ERC20BridgeMinTeleporterVersionUpdatedIterator struct { + Event *ERC20BridgeMinTeleporterVersionUpdated // 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 *ERC20BridgeMinTeleporterVersionUpdatedIterator) 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(ERC20BridgeMinTeleporterVersionUpdated) + 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(ERC20BridgeMinTeleporterVersionUpdated) + 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 *ERC20BridgeMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the ERC20Bridge contract. +type ERC20BridgeMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*ERC20BridgeMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &ERC20BridgeMinTeleporterVersionUpdatedIterator{contract: _ERC20Bridge.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *ERC20BridgeMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + 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(ERC20BridgeMinTeleporterVersionUpdated) + if err := _ERC20Bridge.contract.UnpackLog(event, "MinTeleporterVersionUpdated", 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 +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*ERC20BridgeMinTeleporterVersionUpdated, error) { + event := new(ERC20BridgeMinTeleporterVersionUpdated) + if err := _ERC20Bridge.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ERC20BridgeMintBridgeTokensIterator is returned from FilterMintBridgeTokens and is used to iterate over the raw logs and unpacked data for MintBridgeTokens events raised by the ERC20Bridge contract. type ERC20BridgeMintBridgeTokensIterator struct { Event *ERC20BridgeMintBridgeTokens // Event containing the contract specifics and raw log @@ -1120,6 +1398,159 @@ func (_ERC20Bridge *ERC20BridgeFilterer) ParseMintBridgeTokens(log types.Log) (* return event, nil } +// ERC20BridgeOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ERC20Bridge contract. +type ERC20BridgeOwnershipTransferredIterator struct { + Event *ERC20BridgeOwnershipTransferred // 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 *ERC20BridgeOwnershipTransferredIterator) 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(ERC20BridgeOwnershipTransferred) + 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(ERC20BridgeOwnershipTransferred) + 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 *ERC20BridgeOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ERC20BridgeOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ERC20BridgeOwnershipTransferred represents a OwnershipTransferred event raised by the ERC20Bridge contract. +type ERC20BridgeOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20Bridge *ERC20BridgeFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ERC20BridgeOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ERC20Bridge.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ERC20BridgeOwnershipTransferredIterator{contract: _ERC20Bridge.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20Bridge *ERC20BridgeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ERC20BridgeOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ERC20Bridge.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(ERC20BridgeOwnershipTransferred) + if err := _ERC20Bridge.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ERC20Bridge *ERC20BridgeFilterer) ParseOwnershipTransferred(log types.Log) (*ERC20BridgeOwnershipTransferred, error) { + event := new(ERC20BridgeOwnershipTransferred) + if err := _ERC20Bridge.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ERC20BridgeSubmitCreateBridgeTokenIterator is returned from FilterSubmitCreateBridgeToken and is used to iterate over the raw logs and unpacked data for SubmitCreateBridgeToken events raised by the ERC20Bridge contract. type ERC20BridgeSubmitCreateBridgeTokenIterator struct { Event *ERC20BridgeSubmitCreateBridgeToken // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go index 596f88b46..b6b3f54cd 100644 --- a/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go +++ b/abi-bindings/go/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger/ExampleCrossChainMessenger.go @@ -31,7 +31,7 @@ var ( // ExampleCrossChainMessengerMetaData contains all meta data concerning the ExampleCrossChainMessenger contract. var ExampleCrossChainMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + 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\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"feeAsset\",\"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\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"}],\"name\":\"getCurrentMessage\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minTeleporterVersion\",\"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\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"feeContractAddress\",\"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\":\"messageID\",\"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\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ExampleCrossChainMessengerABI is the input ABI used to generate the binding from. @@ -225,12 +225,74 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) GetC return _ExampleCrossChainMessenger.Contract.GetCurrentMessage(&_ExampleCrossChainMessenger.CallOpts, originChainID) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterMessenger") + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) MinTeleporterVersion() (*big.Int, error) { + return _ExampleCrossChainMessenger.Contract.MinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _ExampleCrossChainMessenger.Contract.MinTeleporterVersion(&_ExampleCrossChainMessenger.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) Owner() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.Owner(&_ExampleCrossChainMessenger.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) Owner() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.Owner(&_ExampleCrossChainMessenger.CallOpts) +} + +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. +// +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ExampleCrossChainMessenger.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -242,18 +304,18 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCaller) TeleporterM } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterMessenger() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TeleporterRegistry() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterMessenger() (common.Address, error) { - return _ExampleCrossChainMessenger.Contract.TeleporterMessenger(&_ExampleCrossChainMessenger.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerCallerSession) TeleporterRegistry() (common.Address, error) { + return _ExampleCrossChainMessenger.Contract.TeleporterRegistry(&_ExampleCrossChainMessenger.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -277,6 +339,27 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) return _ExampleCrossChainMessenger.Contract.ReceiveTeleporterMessage(&_ExampleCrossChainMessenger.TransactOpts, originChainID, originSenderAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) RenounceOwnership() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.RenounceOwnership(&_ExampleCrossChainMessenger.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.RenounceOwnership(&_ExampleCrossChainMessenger.TransactOpts) +} + // SendMessage is a paid mutator transaction binding the contract method 0xf63d09d7. // // Solidity: function sendMessage(bytes32 destinationChainID, address destinationAddress, address feeContractAddress, uint256 feeAmount, uint256 requiredGasLimit, string message) returns(uint256 messageID) @@ -298,6 +381,354 @@ func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) return _ExampleCrossChainMessenger.Contract.SendMessage(&_ExampleCrossChainMessenger.TransactOpts, destinationChainID, destinationAddress, feeContractAddress, feeAmount, requiredGasLimit, message) } +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.TransferOwnership(&_ExampleCrossChainMessenger.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.TransferOwnership(&_ExampleCrossChainMessenger.TransactOpts, newOwner) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ExampleCrossChainMessenger.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _ExampleCrossChainMessenger.Contract.UpdateMinTeleporterVersion(&_ExampleCrossChainMessenger.TransactOpts) +} + +// ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator struct { + Event *ExampleCrossChainMessengerMinTeleporterVersionUpdated // 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 *ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator) 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(ExampleCrossChainMessengerMinTeleporterVersionUpdated) + 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(ExampleCrossChainMessengerMinTeleporterVersionUpdated) + 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 *ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ExampleCrossChainMessengerMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &ExampleCrossChainMessengerMinTeleporterVersionUpdatedIterator{contract: _ExampleCrossChainMessenger.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *ExampleCrossChainMessengerMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + 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(ExampleCrossChainMessengerMinTeleporterVersionUpdated) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "MinTeleporterVersionUpdated", 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 +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*ExampleCrossChainMessengerMinTeleporterVersionUpdated, error) { + event := new(ExampleCrossChainMessengerMinTeleporterVersionUpdated) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ExampleCrossChainMessengerOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerOwnershipTransferredIterator struct { + Event *ExampleCrossChainMessengerOwnershipTransferred // 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 *ExampleCrossChainMessengerOwnershipTransferredIterator) 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(ExampleCrossChainMessengerOwnershipTransferred) + 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(ExampleCrossChainMessengerOwnershipTransferred) + 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 *ExampleCrossChainMessengerOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ExampleCrossChainMessengerOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ExampleCrossChainMessengerOwnershipTransferred represents a OwnershipTransferred event raised by the ExampleCrossChainMessenger contract. +type ExampleCrossChainMessengerOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ExampleCrossChainMessengerOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &ExampleCrossChainMessengerOwnershipTransferredIterator{contract: _ExampleCrossChainMessenger.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ExampleCrossChainMessengerOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _ExampleCrossChainMessenger.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(ExampleCrossChainMessengerOwnershipTransferred) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_ExampleCrossChainMessenger *ExampleCrossChainMessengerFilterer) ParseOwnershipTransferred(log types.Log) (*ExampleCrossChainMessengerOwnershipTransferred, error) { + event := new(ExampleCrossChainMessengerOwnershipTransferred) + if err := _ExampleCrossChainMessenger.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ExampleCrossChainMessengerReceiveMessageIterator is returned from FilterReceiveMessage and is used to iterate over the raw logs and unpacked data for ReceiveMessage events raised by the ExampleCrossChainMessenger contract. type ExampleCrossChainMessengerReceiveMessageIterator struct { Event *ExampleCrossChainMessengerReceiveMessage // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go index cc8b99e61..10b22f7b2 100644 --- a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go +++ b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher/BlockHashPublisher.go @@ -31,7 +31,7 @@ var ( // BlockHashPublisherMetaData contains all meta data concerning the BlockHashPublisher contract. var BlockHashPublisherMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destinationChainID\",\"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\":\"destinationChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"destinationAddress\",\"type\":\"address\"}],\"name\":\"publishLatestBlockHash\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"messageID\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"teleporterRegistry\",\"outputs\":[{\"internalType\":\"contractTeleporterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // BlockHashPublisherABI is the input ABI used to generate the binding from. @@ -211,12 +211,12 @@ func (_BlockHashPublisher *BlockHashPublisherCallerSession) RECEIVEBLOCKHASHREQU return _BlockHashPublisher.Contract.RECEIVEBLOCKHASHREQUIREDGASLIMIT(&_BlockHashPublisher.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterMessenger") + err := _BlockHashPublisher.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -228,18 +228,18 @@ func (_BlockHashPublisher *BlockHashPublisherCaller) TeleporterMessenger(opts *b } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashPublisher *BlockHashPublisherSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashPublisher.Contract.TeleporterMessenger(&_BlockHashPublisher.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashPublisher *BlockHashPublisherCallerSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashPublisher.Contract.TeleporterRegistry(&_BlockHashPublisher.CallOpts) } // PublishLatestBlockHash is a paid mutator transaction binding the contract method 0x82ab2b86. diff --git a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go index 2fc54b476..e57771c63 100644 --- a/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go +++ b/abi-bindings/go/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver/BlockHashReceiver.go @@ -31,7 +31,7 @@ var ( // BlockHashReceiverMetaData contains all meta data concerning the BlockHashReceiver contract. var BlockHashReceiverMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterMessengerAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisherContractAddress\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"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\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"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\":[{\"internalType\":\"bytes32\",\"name\":\"originChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"receiveTeleporterMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sourceChainID\",\"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\":\"teleporterMessenger\",\"outputs\":[{\"internalType\":\"contractITeleporterMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"teleporterRegistryAddress\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"publisherChainID\",\"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\":\"originChainID\",\"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\"},{\"inputs\":[],\"name\":\"getLatestBlockInfo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"}],\"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\":\"minTeleporterVersion\",\"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\":\"bytes32\",\"name\":\"originChainID\",\"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\":\"sourceChainID\",\"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\":[],\"name\":\"updateMinTeleporterVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // BlockHashReceiverABI is the input ABI used to generate the binding from. @@ -287,6 +287,68 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) LatestBlockHeight() (* return _BlockHashReceiver.Contract.LatestBlockHeight(&_BlockHashReceiver.CallOpts) } +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverCaller) MinTeleporterVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _BlockHashReceiver.contract.Call(opts, &out, "minTeleporterVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverSession) MinTeleporterVersion() (*big.Int, error) { + return _BlockHashReceiver.Contract.MinTeleporterVersion(&_BlockHashReceiver.CallOpts) +} + +// MinTeleporterVersion is a free data retrieval call binding the contract method 0xe49cc553. +// +// Solidity: function minTeleporterVersion() view returns(uint256) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) MinTeleporterVersion() (*big.Int, error) { + return _BlockHashReceiver.Contract.MinTeleporterVersion(&_BlockHashReceiver.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _BlockHashReceiver.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverSession) Owner() (common.Address, error) { + return _BlockHashReceiver.Contract.Owner(&_BlockHashReceiver.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) Owner() (common.Address, error) { + return _BlockHashReceiver.Contract.Owner(&_BlockHashReceiver.CallOpts) +} + // SourceChainID is a free data retrieval call binding the contract method 0x4c335368. // // Solidity: function sourceChainID() view returns(bytes32) @@ -349,12 +411,12 @@ func (_BlockHashReceiver *BlockHashReceiverCallerSession) SourcePublisherContrac return _BlockHashReceiver.Contract.SourcePublisherContractAddress(&_BlockHashReceiver.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterMessenger(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterRegistry(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterMessenger") + err := _BlockHashReceiver.contract.Call(opts, &out, "teleporterRegistry") if err != nil { return *new(common.Address), err @@ -366,18 +428,18 @@ func (_BlockHashReceiver *BlockHashReceiverCaller) TeleporterMessenger(opts *bin } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashReceiver *BlockHashReceiverSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.CallOpts) } -// TeleporterMessenger is a free data retrieval call binding the contract method 0x9b3e5803. +// TeleporterRegistry is a free data retrieval call binding the contract method 0x1a7f5bec. // -// Solidity: function teleporterMessenger() view returns(address) -func (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterMessenger() (common.Address, error) { - return _BlockHashReceiver.Contract.TeleporterMessenger(&_BlockHashReceiver.CallOpts) +// Solidity: function teleporterRegistry() view returns(address) +func (_BlockHashReceiver *BlockHashReceiverCallerSession) TeleporterRegistry() (common.Address, error) { + return _BlockHashReceiver.Contract.TeleporterRegistry(&_BlockHashReceiver.CallOpts) } // ReceiveTeleporterMessage is a paid mutator transaction binding the contract method 0xc868efaa. @@ -401,6 +463,375 @@ func (_BlockHashReceiver *BlockHashReceiverTransactorSession) ReceiveTeleporterM return _BlockHashReceiver.Contract.ReceiveTeleporterMessage(&_BlockHashReceiver.TransactOpts, originChainID, originSenderAddress, message) } +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BlockHashReceiver.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BlockHashReceiver *BlockHashReceiverSession) RenounceOwnership() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.RenounceOwnership(&_BlockHashReceiver.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.RenounceOwnership(&_BlockHashReceiver.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BlockHashReceiver *BlockHashReceiverTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BlockHashReceiver *BlockHashReceiverSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.Contract.TransferOwnership(&_BlockHashReceiver.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_BlockHashReceiver *BlockHashReceiverTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _BlockHashReceiver.Contract.TransferOwnership(&_BlockHashReceiver.TransactOpts, newOwner) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactor) UpdateMinTeleporterVersion(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BlockHashReceiver.contract.Transact(opts, "updateMinTeleporterVersion") +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) +} + +// UpdateMinTeleporterVersion is a paid mutator transaction binding the contract method 0xb6109d9d. +// +// Solidity: function updateMinTeleporterVersion() returns() +func (_BlockHashReceiver *BlockHashReceiverTransactorSession) UpdateMinTeleporterVersion() (*types.Transaction, error) { + return _BlockHashReceiver.Contract.UpdateMinTeleporterVersion(&_BlockHashReceiver.TransactOpts) +} + +// BlockHashReceiverMinTeleporterVersionUpdatedIterator is returned from FilterMinTeleporterVersionUpdated and is used to iterate over the raw logs and unpacked data for MinTeleporterVersionUpdated events raised by the BlockHashReceiver contract. +type BlockHashReceiverMinTeleporterVersionUpdatedIterator struct { + Event *BlockHashReceiverMinTeleporterVersionUpdated // 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 *BlockHashReceiverMinTeleporterVersionUpdatedIterator) 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(BlockHashReceiverMinTeleporterVersionUpdated) + 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(BlockHashReceiverMinTeleporterVersionUpdated) + 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 *BlockHashReceiverMinTeleporterVersionUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BlockHashReceiverMinTeleporterVersionUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BlockHashReceiverMinTeleporterVersionUpdated represents a MinTeleporterVersionUpdated event raised by the BlockHashReceiver contract. +type BlockHashReceiverMinTeleporterVersionUpdated struct { + OldMinTeleporterVersion *big.Int + NewMinTeleporterVersion *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMinTeleporterVersionUpdated is a free log retrieval operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_BlockHashReceiver *BlockHashReceiverFilterer) FilterMinTeleporterVersionUpdated(opts *bind.FilterOpts, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (*BlockHashReceiverMinTeleporterVersionUpdatedIterator, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _BlockHashReceiver.contract.FilterLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + if err != nil { + return nil, err + } + return &BlockHashReceiverMinTeleporterVersionUpdatedIterator{contract: _BlockHashReceiver.contract, event: "MinTeleporterVersionUpdated", logs: logs, sub: sub}, nil +} + +// WatchMinTeleporterVersionUpdated is a free log subscription operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_BlockHashReceiver *BlockHashReceiverFilterer) WatchMinTeleporterVersionUpdated(opts *bind.WatchOpts, sink chan<- *BlockHashReceiverMinTeleporterVersionUpdated, oldMinTeleporterVersion []*big.Int, newMinTeleporterVersion []*big.Int) (event.Subscription, error) { + + var oldMinTeleporterVersionRule []interface{} + for _, oldMinTeleporterVersionItem := range oldMinTeleporterVersion { + oldMinTeleporterVersionRule = append(oldMinTeleporterVersionRule, oldMinTeleporterVersionItem) + } + var newMinTeleporterVersionRule []interface{} + for _, newMinTeleporterVersionItem := range newMinTeleporterVersion { + newMinTeleporterVersionRule = append(newMinTeleporterVersionRule, newMinTeleporterVersionItem) + } + + logs, sub, err := _BlockHashReceiver.contract.WatchLogs(opts, "MinTeleporterVersionUpdated", oldMinTeleporterVersionRule, newMinTeleporterVersionRule) + 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(BlockHashReceiverMinTeleporterVersionUpdated) + if err := _BlockHashReceiver.contract.UnpackLog(event, "MinTeleporterVersionUpdated", 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 +} + +// ParseMinTeleporterVersionUpdated is a log parse operation binding the contract event 0xa9a7ef57e41f05b4c15480842f5f0c27edfcbb553fed281f7c4068452cc1c02d. +// +// Solidity: event MinTeleporterVersionUpdated(uint256 indexed oldMinTeleporterVersion, uint256 indexed newMinTeleporterVersion) +func (_BlockHashReceiver *BlockHashReceiverFilterer) ParseMinTeleporterVersionUpdated(log types.Log) (*BlockHashReceiverMinTeleporterVersionUpdated, error) { + event := new(BlockHashReceiverMinTeleporterVersionUpdated) + if err := _BlockHashReceiver.contract.UnpackLog(event, "MinTeleporterVersionUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BlockHashReceiverOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the BlockHashReceiver contract. +type BlockHashReceiverOwnershipTransferredIterator struct { + Event *BlockHashReceiverOwnershipTransferred // 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 *BlockHashReceiverOwnershipTransferredIterator) 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(BlockHashReceiverOwnershipTransferred) + 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(BlockHashReceiverOwnershipTransferred) + 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 *BlockHashReceiverOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BlockHashReceiverOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BlockHashReceiverOwnershipTransferred represents a OwnershipTransferred event raised by the BlockHashReceiver contract. +type BlockHashReceiverOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_BlockHashReceiver *BlockHashReceiverFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*BlockHashReceiverOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _BlockHashReceiver.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &BlockHashReceiverOwnershipTransferredIterator{contract: _BlockHashReceiver.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_BlockHashReceiver *BlockHashReceiverFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BlockHashReceiverOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _BlockHashReceiver.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + 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(BlockHashReceiverOwnershipTransferred) + if err := _BlockHashReceiver.contract.UnpackLog(event, "OwnershipTransferred", 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 +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_BlockHashReceiver *BlockHashReceiverFilterer) ParseOwnershipTransferred(log types.Log) (*BlockHashReceiverOwnershipTransferred, error) { + event := new(BlockHashReceiverOwnershipTransferred) + if err := _BlockHashReceiver.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // BlockHashReceiverReceiveBlockHashIterator is returned from FilterReceiveBlockHash and is used to iterate over the raw logs and unpacked data for ReceiveBlockHash events raised by the BlockHashReceiver contract. type BlockHashReceiverReceiveBlockHashIterator struct { Event *BlockHashReceiverReceiveBlockHash // Event containing the contract specifics and raw log diff --git a/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go b/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go new file mode 100644 index 000000000..ef6385100 --- /dev/null +++ b/abi-bindings/go/Teleporter/upgrades/TeleporterRegistry/TeleporterRegistry.go @@ -0,0 +1,578 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package teleporterregistry + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ProtocolRegistryEntry is an auto generated low-level Go binding around an user-defined struct. +type ProtocolRegistryEntry struct { + Version *big.Int + ProtocolAddress common.Address +} + +// 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\"},{\"inputs\":[],\"name\":\"VALIDATORS_SOURCE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"addProtocolVersion\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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\":[],\"name\":\"getLatestVersion\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\"}]", +} + +// TeleporterRegistryABI is the input ABI used to generate the binding from. +// Deprecated: Use TeleporterRegistryMetaData.ABI instead. +var TeleporterRegistryABI = TeleporterRegistryMetaData.ABI + +// TeleporterRegistry is an auto generated Go binding around an Ethereum contract. +type TeleporterRegistry struct { + TeleporterRegistryCaller // Read-only binding to the contract + TeleporterRegistryTransactor // Write-only binding to the contract + TeleporterRegistryFilterer // Log filterer for contract events +} + +// TeleporterRegistryCaller is an auto generated read-only Go binding around an Ethereum contract. +type TeleporterRegistryCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TeleporterRegistryTransactor is an auto generated write-only Go binding around an Ethereum contract. +type TeleporterRegistryTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TeleporterRegistryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TeleporterRegistryFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TeleporterRegistrySession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TeleporterRegistrySession struct { + Contract *TeleporterRegistry // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TeleporterRegistryCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TeleporterRegistryCallerSession struct { + Contract *TeleporterRegistryCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TeleporterRegistryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TeleporterRegistryTransactorSession struct { + Contract *TeleporterRegistryTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TeleporterRegistryRaw is an auto generated low-level Go binding around an Ethereum contract. +type TeleporterRegistryRaw struct { + Contract *TeleporterRegistry // Generic contract binding to access the raw methods on +} + +// TeleporterRegistryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TeleporterRegistryCallerRaw struct { + Contract *TeleporterRegistryCaller // Generic read-only contract binding to access the raw methods on +} + +// TeleporterRegistryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TeleporterRegistryTransactorRaw struct { + Contract *TeleporterRegistryTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewTeleporterRegistry creates a new instance of TeleporterRegistry, bound to a specific deployed contract. +func NewTeleporterRegistry(address common.Address, backend bind.ContractBackend) (*TeleporterRegistry, error) { + contract, err := bindTeleporterRegistry(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &TeleporterRegistry{TeleporterRegistryCaller: TeleporterRegistryCaller{contract: contract}, TeleporterRegistryTransactor: TeleporterRegistryTransactor{contract: contract}, TeleporterRegistryFilterer: TeleporterRegistryFilterer{contract: contract}}, nil +} + +// NewTeleporterRegistryCaller creates a new read-only instance of TeleporterRegistry, bound to a specific deployed contract. +func NewTeleporterRegistryCaller(address common.Address, caller bind.ContractCaller) (*TeleporterRegistryCaller, error) { + contract, err := bindTeleporterRegistry(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TeleporterRegistryCaller{contract: contract}, nil +} + +// NewTeleporterRegistryTransactor creates a new write-only instance of TeleporterRegistry, bound to a specific deployed contract. +func NewTeleporterRegistryTransactor(address common.Address, transactor bind.ContractTransactor) (*TeleporterRegistryTransactor, error) { + contract, err := bindTeleporterRegistry(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TeleporterRegistryTransactor{contract: contract}, nil +} + +// NewTeleporterRegistryFilterer creates a new log filterer instance of TeleporterRegistry, bound to a specific deployed contract. +func NewTeleporterRegistryFilterer(address common.Address, filterer bind.ContractFilterer) (*TeleporterRegistryFilterer, error) { + contract, err := bindTeleporterRegistry(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TeleporterRegistryFilterer{contract: contract}, nil +} + +// bindTeleporterRegistry binds a generic wrapper to an already deployed contract. +func bindTeleporterRegistry(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := TeleporterRegistryMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TeleporterRegistry *TeleporterRegistryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TeleporterRegistry.Contract.TeleporterRegistryCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TeleporterRegistry *TeleporterRegistryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.TeleporterRegistryTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TeleporterRegistry *TeleporterRegistryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.TeleporterRegistryTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TeleporterRegistry *TeleporterRegistryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TeleporterRegistry.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TeleporterRegistry *TeleporterRegistryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TeleporterRegistry *TeleporterRegistryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.contract.Transact(opts, method, params...) +} + +// VALIDATORSSOURCEADDRESS is a free data retrieval call binding the contract method 0x0731775d. +// +// Solidity: function VALIDATORS_SOURCE_ADDRESS() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCaller) VALIDATORSSOURCEADDRESS(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "VALIDATORS_SOURCE_ADDRESS") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// VALIDATORSSOURCEADDRESS is a free data retrieval call binding the contract method 0x0731775d. +// +// Solidity: function VALIDATORS_SOURCE_ADDRESS() view returns(address) +func (_TeleporterRegistry *TeleporterRegistrySession) VALIDATORSSOURCEADDRESS() (common.Address, error) { + return _TeleporterRegistry.Contract.VALIDATORSSOURCEADDRESS(&_TeleporterRegistry.CallOpts) +} + +// VALIDATORSSOURCEADDRESS is a free data retrieval call binding the contract method 0x0731775d. +// +// Solidity: function VALIDATORS_SOURCE_ADDRESS() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) VALIDATORSSOURCEADDRESS() (common.Address, error) { + return _TeleporterRegistry.Contract.VALIDATORSSOURCEADDRESS(&_TeleporterRegistry.CallOpts) +} + +// WARPMESSENGER is a free data retrieval call binding the contract method 0xb771b3bc. +// +// Solidity: function WARP_MESSENGER() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCaller) WARPMESSENGER(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "WARP_MESSENGER") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WARPMESSENGER is a free data retrieval call binding the contract method 0xb771b3bc. +// +// Solidity: function WARP_MESSENGER() view returns(address) +func (_TeleporterRegistry *TeleporterRegistrySession) WARPMESSENGER() (common.Address, error) { + return _TeleporterRegistry.Contract.WARPMESSENGER(&_TeleporterRegistry.CallOpts) +} + +// WARPMESSENGER is a free data retrieval call binding the contract method 0xb771b3bc. +// +// Solidity: function WARP_MESSENGER() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) WARPMESSENGER() (common.Address, error) { + return _TeleporterRegistry.Contract.WARPMESSENGER(&_TeleporterRegistry.CallOpts) +} + +// GetAddressFromVersion is a free data retrieval call binding the contract method 0x46f9ef49. +// +// Solidity: function getAddressFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCaller) GetAddressFromVersion(opts *bind.CallOpts, version *big.Int) (common.Address, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "getAddressFromVersion", version) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetAddressFromVersion is a free data retrieval call binding the contract method 0x46f9ef49. +// +// Solidity: function getAddressFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistrySession) GetAddressFromVersion(version *big.Int) (common.Address, error) { + return _TeleporterRegistry.Contract.GetAddressFromVersion(&_TeleporterRegistry.CallOpts, version) +} + +// GetAddressFromVersion is a free data retrieval call binding the contract method 0x46f9ef49. +// +// Solidity: function getAddressFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) GetAddressFromVersion(version *big.Int) (common.Address, error) { + return _TeleporterRegistry.Contract.GetAddressFromVersion(&_TeleporterRegistry.CallOpts, version) +} + +// GetLatestTeleporter is a free data retrieval call binding the contract method 0xd820e64f. +// +// Solidity: function getLatestTeleporter() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCaller) GetLatestTeleporter(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "getLatestTeleporter") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetLatestTeleporter is a free data retrieval call binding the contract method 0xd820e64f. +// +// Solidity: function getLatestTeleporter() view returns(address) +func (_TeleporterRegistry *TeleporterRegistrySession) GetLatestTeleporter() (common.Address, error) { + return _TeleporterRegistry.Contract.GetLatestTeleporter(&_TeleporterRegistry.CallOpts) +} + +// GetLatestTeleporter is a free data retrieval call binding the contract method 0xd820e64f. +// +// Solidity: function getLatestTeleporter() view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) GetLatestTeleporter() (common.Address, error) { + return _TeleporterRegistry.Contract.GetLatestTeleporter(&_TeleporterRegistry.CallOpts) +} + +// GetLatestVersion is a free data retrieval call binding the contract method 0x0e6d1de9. +// +// Solidity: function getLatestVersion() view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistryCaller) GetLatestVersion(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "getLatestVersion") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetLatestVersion is a free data retrieval call binding the contract method 0x0e6d1de9. +// +// Solidity: function getLatestVersion() view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistrySession) GetLatestVersion() (*big.Int, error) { + return _TeleporterRegistry.Contract.GetLatestVersion(&_TeleporterRegistry.CallOpts) +} + +// GetLatestVersion is a free data retrieval call binding the contract method 0x0e6d1de9. +// +// Solidity: function getLatestVersion() view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) GetLatestVersion() (*big.Int, error) { + return _TeleporterRegistry.Contract.GetLatestVersion(&_TeleporterRegistry.CallOpts) +} + +// GetTeleporterFromVersion is a free data retrieval call binding the contract method 0x215abce9. +// +// Solidity: function getTeleporterFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCaller) GetTeleporterFromVersion(opts *bind.CallOpts, version *big.Int) (common.Address, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "getTeleporterFromVersion", version) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetTeleporterFromVersion is a free data retrieval call binding the contract method 0x215abce9. +// +// Solidity: function getTeleporterFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistrySession) GetTeleporterFromVersion(version *big.Int) (common.Address, error) { + return _TeleporterRegistry.Contract.GetTeleporterFromVersion(&_TeleporterRegistry.CallOpts, version) +} + +// GetTeleporterFromVersion is a free data retrieval call binding the contract method 0x215abce9. +// +// Solidity: function getTeleporterFromVersion(uint256 version) view returns(address) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) GetTeleporterFromVersion(version *big.Int) (common.Address, error) { + return _TeleporterRegistry.Contract.GetTeleporterFromVersion(&_TeleporterRegistry.CallOpts, version) +} + +// GetVersionFromAddress is a free data retrieval call binding the contract method 0x4c1f08ce. +// +// Solidity: function getVersionFromAddress(address protocolAddress) view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistryCaller) GetVersionFromAddress(opts *bind.CallOpts, protocolAddress common.Address) (*big.Int, error) { + var out []interface{} + err := _TeleporterRegistry.contract.Call(opts, &out, "getVersionFromAddress", protocolAddress) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetVersionFromAddress is a free data retrieval call binding the contract method 0x4c1f08ce. +// +// Solidity: function getVersionFromAddress(address protocolAddress) view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistrySession) GetVersionFromAddress(protocolAddress common.Address) (*big.Int, error) { + return _TeleporterRegistry.Contract.GetVersionFromAddress(&_TeleporterRegistry.CallOpts, protocolAddress) +} + +// GetVersionFromAddress is a free data retrieval call binding the contract method 0x4c1f08ce. +// +// Solidity: function getVersionFromAddress(address protocolAddress) view returns(uint256) +func (_TeleporterRegistry *TeleporterRegistryCallerSession) GetVersionFromAddress(protocolAddress common.Address) (*big.Int, error) { + return _TeleporterRegistry.Contract.GetVersionFromAddress(&_TeleporterRegistry.CallOpts, protocolAddress) +} + +// AddProtocolVersion is a paid mutator transaction binding the contract method 0x41f34ed9. +// +// Solidity: function addProtocolVersion(uint32 messageIndex) returns() +func (_TeleporterRegistry *TeleporterRegistryTransactor) AddProtocolVersion(opts *bind.TransactOpts, messageIndex uint32) (*types.Transaction, error) { + return _TeleporterRegistry.contract.Transact(opts, "addProtocolVersion", messageIndex) +} + +// AddProtocolVersion is a paid mutator transaction binding the contract method 0x41f34ed9. +// +// Solidity: function addProtocolVersion(uint32 messageIndex) returns() +func (_TeleporterRegistry *TeleporterRegistrySession) AddProtocolVersion(messageIndex uint32) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.AddProtocolVersion(&_TeleporterRegistry.TransactOpts, messageIndex) +} + +// AddProtocolVersion is a paid mutator transaction binding the contract method 0x41f34ed9. +// +// Solidity: function addProtocolVersion(uint32 messageIndex) returns() +func (_TeleporterRegistry *TeleporterRegistryTransactorSession) AddProtocolVersion(messageIndex uint32) (*types.Transaction, error) { + return _TeleporterRegistry.Contract.AddProtocolVersion(&_TeleporterRegistry.TransactOpts, messageIndex) +} + +// TeleporterRegistryAddProtocolVersionIterator is returned from FilterAddProtocolVersion and is used to iterate over the raw logs and unpacked data for AddProtocolVersion events raised by the TeleporterRegistry contract. +type TeleporterRegistryAddProtocolVersionIterator struct { + Event *TeleporterRegistryAddProtocolVersion // 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 *TeleporterRegistryAddProtocolVersionIterator) 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(TeleporterRegistryAddProtocolVersion) + 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(TeleporterRegistryAddProtocolVersion) + 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 *TeleporterRegistryAddProtocolVersionIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TeleporterRegistryAddProtocolVersionIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TeleporterRegistryAddProtocolVersion represents a AddProtocolVersion event raised by the TeleporterRegistry contract. +type TeleporterRegistryAddProtocolVersion struct { + Version *big.Int + ProtocolAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAddProtocolVersion is a free log retrieval operation binding the contract event 0xa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a. +// +// Solidity: event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress) +func (_TeleporterRegistry *TeleporterRegistryFilterer) FilterAddProtocolVersion(opts *bind.FilterOpts, version []*big.Int, protocolAddress []common.Address) (*TeleporterRegistryAddProtocolVersionIterator, error) { + + var versionRule []interface{} + for _, versionItem := range version { + versionRule = append(versionRule, versionItem) + } + var protocolAddressRule []interface{} + for _, protocolAddressItem := range protocolAddress { + protocolAddressRule = append(protocolAddressRule, protocolAddressItem) + } + + logs, sub, err := _TeleporterRegistry.contract.FilterLogs(opts, "AddProtocolVersion", versionRule, protocolAddressRule) + if err != nil { + return nil, err + } + return &TeleporterRegistryAddProtocolVersionIterator{contract: _TeleporterRegistry.contract, event: "AddProtocolVersion", logs: logs, sub: sub}, nil +} + +// WatchAddProtocolVersion is a free log subscription operation binding the contract event 0xa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a. +// +// Solidity: event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress) +func (_TeleporterRegistry *TeleporterRegistryFilterer) WatchAddProtocolVersion(opts *bind.WatchOpts, sink chan<- *TeleporterRegistryAddProtocolVersion, version []*big.Int, protocolAddress []common.Address) (event.Subscription, error) { + + var versionRule []interface{} + for _, versionItem := range version { + versionRule = append(versionRule, versionItem) + } + var protocolAddressRule []interface{} + for _, protocolAddressItem := range protocolAddress { + protocolAddressRule = append(protocolAddressRule, protocolAddressItem) + } + + logs, sub, err := _TeleporterRegistry.contract.WatchLogs(opts, "AddProtocolVersion", versionRule, protocolAddressRule) + 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(TeleporterRegistryAddProtocolVersion) + if err := _TeleporterRegistry.contract.UnpackLog(event, "AddProtocolVersion", 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 +} + +// ParseAddProtocolVersion is a log parse operation binding the contract event 0xa5eed93d951a9603d5f7c0a57de79a299dd3dbd5e51429be209d8053a42ab43a. +// +// Solidity: event AddProtocolVersion(uint256 indexed version, address indexed protocolAddress) +func (_TeleporterRegistry *TeleporterRegistryFilterer) ParseAddProtocolVersion(log types.Log) (*TeleporterRegistryAddProtocolVersion, error) { + event := new(TeleporterRegistryAddProtocolVersion) + if err := _TeleporterRegistry.contract.UnpackLog(event, "AddProtocolVersion", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol index dc81c237a..c180ca71f 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol @@ -10,10 +10,13 @@ import "./BridgeToken.sol"; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; +import "../../Teleporter/upgrades/TeleporterRegistry.sol"; +import "../../Teleporter/upgrades/TeleporterUpgradeable.sol"; import "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; /** * @dev Implementation of the {IERC20Bridge} interface. @@ -21,7 +24,13 @@ import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; * 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, ITeleporterReceiver, ReentrancyGuard { +contract ERC20Bridge is + IERC20Bridge, + ITeleporterReceiver, + ReentrancyGuard, + TeleporterUpgradeable, + Ownable +{ using SafeERC20 for IERC20; struct WrappedTokenTransferInfo { @@ -38,9 +47,6 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { 0x0200000000000000000000000000000000000005; bytes32 public immutable currentChainID; - // Used for sending an receiving Teleporter messages. - ITeleporterMessenger public immutable teleporterMessenger; - // Tracks which bridge tokens have been submitted to be created other bridge instances. // (destinationChainID, destinationBridgeAddress) -> nativeTokenContract -> tokenCreationSubmitted // Note that the existence of a bridge token in this mapping does not ensure that it exists on @@ -71,13 +77,9 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { * @dev Initializes the Teleporter messenger used for sending and receiving messages, * and initializes the current chain ID. */ - constructor(address teleporterMessengerAddress) { - require( - teleporterMessengerAddress != address(0), - "ERC20Bridge: zero teleporter messenger address" - ); - - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + constructor( + address teleporterRegistryAddress + ) TeleporterUpgradeable(teleporterRegistryAddress) { currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) .getBlockchainID(); } @@ -198,6 +200,8 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { destinationBridgeAddress != address(0), "ERC20Bridge: zero destination bridge address" ); + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); // For non-zero fee amounts, transfer the fee into the control of this contract first, and then // allow the Teleporter contract to spend it. @@ -257,13 +261,7 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { bytes32 nativeChainID, address nativeBridgeAddress, bytes calldata message - ) external { - // Only allow the Teleporter messenger to deliver messages. - require( - msg.sender == address(teleporterMessenger), - "ERC20Bridge: unauthorized" - ); - + ) external onlyAllowedTeleporter { // Decode the payload to recover the action and corresponding function parameters (BridgeAction action, bytes memory actionData) = abi.decode( message, @@ -326,6 +324,23 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { } } + /** + * @dev See {TeleporterUpgradeable-updateMinTeleporterVersion} + * + * Updates the minimum Teleporter version allowed for receiving on this contract + * to the latest version registered in the {TeleporterRegistry}. + * Restricted to only owners of the contract. + * Emits a {MinTeleporterVersionUpdated} event. + */ + function updateMinTeleporterVersion() external override onlyOwner { + uint256 oldMinTeleporterVersion = minTeleporterVersion; + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + emit MinTeleporterVersionUpdated( + oldMinTeleporterVersion, + minTeleporterVersion + ); + } + /** * @dev Encodes the parameters for the Create action to be decoded and executed on the destination. */ @@ -573,6 +588,8 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { destinationChainID != currentChainID, "ERC20Bridge: cannot bridge to same chain" ); + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); // Allow the Teleporter messenger to spend the fee amount. if (feeAmount > 0) { @@ -629,6 +646,9 @@ contract ERC20Bridge is IERC20Bridge, ITeleporterReceiver, ReentrancyGuard { function _processWrappedTokenTransfer( WrappedTokenTransferInfo memory wrappedTransferInfo ) private { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); + // If necessary, transfer the primary fee amount to this contract and approve the // Teleporter messenger to spend it when the first message back to the native subnet // is submitted. The secondary fee amount is then handled by the native subnet when diff --git a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol index ae9758eb2..57de69358 100644 --- a/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol +++ b/contracts/src/CrossChainApplications/ERC20Bridge/tests/ERC20BridgeTests.t.sol @@ -12,6 +12,8 @@ import "../../../Mocks/UnitTestMockERC20.sol"; contract ERC20BridgeTest is Test { address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; + address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = + 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; address public constant WARP_PRECOMPILE_ADDRESS = address(0x0200000000000000000000000000000000000005); bytes32 private constant _MOCK_BLOCKCHAIN_ID = bytes32(uint256(123456)); @@ -59,14 +61,32 @@ contract ERC20BridgeTest is Test { uint256 amount ); + event MinTeleporterVersionUpdated( + uint256 indexed oldMinTeleporterVersion, + uint256 indexed newMinTeleporterVersion + ); + function setUp() public virtual { vm.mockCall( WARP_PRECOMPILE_ADDRESS, abi.encodeWithSelector(WarpMessenger.getBlockchainID.selector), abi.encode(_MOCK_BLOCKCHAIN_ID) ); + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(WarpMessenger.getBlockchainID.selector) + ); + + _initMockTeleporterRegistry(); - erc20Bridge = new ERC20Bridge(MOCK_TELEPORTER_MESSENGER_ADDRESS); + vm.expectCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getLatestVersion.selector + ) + ); + + erc20Bridge = new ERC20Bridge(MOCK_TELEPORTER_REGISTRY_ADDRESS); mockERC20 = new UnitTestMockERC20(); } @@ -609,6 +629,76 @@ contract ERC20BridgeTest is Test { assertEq(address(mockERC20), newBridgeToken.nativeAsset()); } + function testZeroTeleporterRegistryAddress() public { + vm.expectRevert( + "TeleporterUpgradeable: zero teleporter registry address" + ); + new ERC20Bridge(address(0)); + } + + function testUpdateMinTeleporterVersion() public { + // Check that updating minimum Teleporter version fails if it's not the contract owner. + vm.prank(address(0)); + vm.expectRevert("Ownable: caller is not the owner"); + erc20Bridge.updateMinTeleporterVersion(); + + // Check that the owner can update the minimum Teleporter version. + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getLatestVersion.selector + ), + abi.encode(2) + ); + vm.expectCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getLatestVersion.selector + ) + ); + + vm.expectEmit(true, true, true, true, address(erc20Bridge)); + emit MinTeleporterVersionUpdated(1, 2); + erc20Bridge.updateMinTeleporterVersion(); + assertEq(erc20Bridge.minTeleporterVersion(), 2); + } + + function _initMockTeleporterRegistry() internal { + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getLatestVersion.selector + ), + abi.encode(1) + ); + + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getVersionFromAddress.selector, + (MOCK_TELEPORTER_MESSENGER_ADDRESS) + ), + abi.encode(1) + ); + + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + WarpProtocolRegistry.getAddressFromVersion.selector, + (1) + ), + abi.encode(MOCK_TELEPORTER_MESSENGER_ADDRESS) + ); + + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeWithSelector( + TeleporterRegistry.getLatestTeleporter.selector + ), + abi.encode(ITeleporterMessenger(MOCK_TELEPORTER_MESSENGER_ADDRESS)) + ); + } + function _setUpExpectedTransferFromCall( address tokenContract, uint256 amount diff --git a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol index 451d39515..0fcd28801 100644 --- a/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol +++ b/contracts/src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol @@ -8,14 +8,22 @@ pragma solidity 0.8.18; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/SafeERC20TransferFrom.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/upgrades/TeleporterRegistry.sol"; +import "../../Teleporter/upgrades/TeleporterUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; /** * @dev ExampleCrossChainMessenger is an example contract that demonstrates how to send and receive * messages cross chain. */ -contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { +contract ExampleCrossChainMessenger is + ITeleporterReceiver, + ReentrancyGuard, + TeleporterUpgradeable, + Ownable +{ using SafeERC20 for IERC20; // Messages sent to this contract. @@ -24,8 +32,6 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { string message; } - ITeleporterMessenger public immutable teleporterMessenger; - mapping(bytes32 => Message) private _messages; /** @@ -49,9 +55,9 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { string message ); - constructor(address teleporterMessengerAddress) { - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); - } + constructor( + address teleporterRegistryAddress + ) TeleporterUpgradeable(teleporterRegistryAddress) {} /** * @dev See {ITeleporterReceiver-receiveTeleporterMessage}. @@ -62,10 +68,7 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { bytes32 originChainID, address originSenderAddress, bytes calldata message - ) external { - // Only the Teleporter receiver can deliver a message. - require(msg.sender == address(teleporterMessenger), "ExampleCrossChainMessenger: unauthorized"); - + ) external onlyAllowedTeleporter { // Store the message. string memory messageString = abi.decode(message, (string)); _messages[originChainID] = Message(originSenderAddress, messageString); @@ -83,6 +86,8 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { uint256 requiredGasLimit, string calldata message ) external nonReentrant returns (uint256 messageID) { + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); // For non-zero fee amounts, transfer the fee into the control of this contract first, and then // allow the Teleporter contract to spend it. uint256 adjustedFeeAmount = 0; @@ -121,6 +126,23 @@ contract ExampleCrossChainMessenger is ITeleporterReceiver, ReentrancyGuard { ); } + /** + * @dev See {TeleporterUpgradeable-updateMinTeleporterVersion} + * + * Updates the minimum Teleporter version allowed for receiving on this contract + * to the latest version registered in the {TeleporterRegistry}. Also restricts this function to + * the owner of this contract. + * Emits a {MinTeleporterVersionUpdated} event. + */ + function updateMinTeleporterVersion() external override onlyOwner { + uint256 oldMinTeleporterVersion = minTeleporterVersion; + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + emit MinTeleporterVersionUpdated( + oldMinTeleporterVersion, + minTeleporterVersion + ); + } + /** * @dev Returns the current message from another chain. */ diff --git a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol index bb13de94d..54e2fa17e 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol @@ -6,6 +6,7 @@ pragma solidity 0.8.18; import "../../Teleporter/ITeleporterMessenger.sol"; +import "../../Teleporter/upgrades/TeleporterRegistry.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./BlockHashReceiver.sol"; @@ -13,9 +14,10 @@ import "./BlockHashReceiver.sol"; * Contract that publishes the latest block hash of current chain to another chain. */ contract BlockHashPublisher { - ITeleporterMessenger public immutable teleporterMessenger; uint256 public constant RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT = 1.5e5; + TeleporterRegistry public immutable teleporterRegistry; + /** * @dev Emitted when a block hash is submitted to be published to another chain. */ @@ -26,8 +28,13 @@ contract BlockHashPublisher { bytes32 blockHash ); - constructor(address teleporterMessengerAddress) { - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + constructor(address teleporterRegistryAddress) { + require( + teleporterRegistryAddress != address(0), + "BlockHashPublisher: zero teleporter registry address" + ); + + teleporterRegistry = TeleporterRegistry(teleporterRegistryAddress); } /** @@ -52,18 +59,20 @@ contract BlockHashPublisher { blockHeight, blockHash ); - messageID = teleporterMessenger.sendCrossChainMessage( - TeleporterMessageInput({ - destinationChainID: destinationChainID, - destinationAddress: destinationAddress, - feeInfo: TeleporterFeeInfo({ - contractAddress: address(0), - amount: 0 - }), - requiredGasLimit: RECEIVE_BLOCK_HASH_REQUIRED_GAS_LIMIT, - allowedRelayerAddresses: new address[](0), - message: messageData - }) - ); + messageID = teleporterRegistry + .getLatestTeleporter() + .sendCrossChainMessage( + TeleporterMessageInput({ + destinationChainID: destinationChainID, + destinationAddress: destinationAddress, + feeInfo: TeleporterFeeInfo({ + contractAddress: 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 a5f0bf1fa..e7d902f91 100644 --- a/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol +++ b/contracts/src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol @@ -7,13 +7,18 @@ pragma solidity 0.8.18; import "../../Teleporter/ITeleporterMessenger.sol"; import "../../Teleporter/ITeleporterReceiver.sol"; +import "../../Teleporter/upgrades/TeleporterRegistry.sol"; +import "../../Teleporter/upgrades/TeleporterUpgradeable.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; /** * Contract for receiving latest block hashes from another chain. */ -contract BlockHashReceiver is ITeleporterReceiver { - ITeleporterMessenger public immutable teleporterMessenger; - +contract BlockHashReceiver is + ITeleporterReceiver, + TeleporterUpgradeable, + Ownable +{ // Source chain information bytes32 public immutable sourceChainID; address public immutable sourcePublisherContractAddress; @@ -33,11 +38,10 @@ contract BlockHashReceiver is ITeleporterReceiver { ); constructor( - address teleporterMessengerAddress, + address teleporterRegistryAddress, bytes32 publisherChainID, address publisherContractAddress - ) { - teleporterMessenger = ITeleporterMessenger(teleporterMessengerAddress); + ) TeleporterUpgradeable(teleporterRegistryAddress) { sourceChainID = publisherChainID; sourcePublisherContractAddress = publisherContractAddress; } @@ -57,11 +61,7 @@ contract BlockHashReceiver is ITeleporterReceiver { bytes32 originChainID, address originSenderAddress, bytes calldata message - ) external { - require( - msg.sender == address(teleporterMessenger), - "BlockHashReceiver: unauthorized" - ); + ) external onlyAllowedTeleporter { require( originChainID == sourceChainID, "BlockHashReceiver: invalid source chain ID" @@ -88,6 +88,23 @@ contract BlockHashReceiver is ITeleporterReceiver { } } + /** + * @dev See {TeleporterUpgradeable-updateMinTeleporterVersion} + * + * Updates the minimum Teleporter version allowed for receiving on this contract + * to the latest version registered in the {TeleporterRegistry}. + * Restricted to only owners of the contract. + * Emits a {MinTeleporterVersionUpdated} event. + */ + function updateMinTeleporterVersion() external override onlyOwner { + uint256 oldMinTeleporterVersion = minTeleporterVersion; + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + emit MinTeleporterVersionUpdated( + oldMinTeleporterVersion, + minTeleporterVersion + ); + } + /** * @dev Returns the latest block information. */ diff --git a/contracts/src/Teleporter/upgrades/README.md b/contracts/src/Teleporter/upgrades/README.md new file mode 100644 index 000000000..afc168987 --- /dev/null +++ b/contracts/src/Teleporter/upgrades/README.md @@ -0,0 +1,82 @@ +# Upgradeability + +## Overview + +The `TeleporterMessenger` contract is non-upgradable, once a version of the contract is deployed it cannot be changed. This is with the intention of preventing any changes to the deployed contract that could potentially introduce bugs or vulnerabilities. + +However, there could still be new versions of `TeleporterMessenger` contracts needed to be deployed in the future. `TeleporterRegistry` provides applications that use a `TeleporterMessenger` instance a minimal step process to integrate with new versions of `TeleporterMessenger`. + +The `TeleporterRegistry` maintains a mapping of `TeleporterMessenger` contract versions to their addresses. When a new `TeleporterMessenger` version is deployed, its address can be added to the `TeleporterRegistry`. The `TeleporterRegistry` can only be updated through a Warp out-of-band message that meets the following requirements: + +- `sourceChainAddress` must match `VALIDATORS_SOURCE_ADDRESS = address(0)` + - The zero address can only be set as the source chain address by a Warp out-of-band message, and cannot be set by an on-chain Warp message. +- `sourceChainID` must match the blockchain ID that the registry is deployed on +- `destinationChainID` must match the blockchain ID that the registry is deployed on +- `destinationAddress` must match the address of the registry + +In the `TeleporterRegistry` contract, the `getLatestVersion` function returns the highest version number that has been registered in the registry. The `getLatestTeleporter` function returns the `ITeleporterMessenger` that is registered with the corresponding version. + +## Design + +- `TeleporterRegistry` is deployed on each blockchain that needs to keep track of `TeleporterMessenger` contract versions. +- Each registry's mapping of version to contract address is independent of registries on other blockchains, and chains can decide on their own registry mapping entries. +- `TeleporterRegistry` contract can be initialized through a list of initial registry entries, which are `TeleporterMessenger` contract versions and their addresses. +- The registry keeps track of a mapping of `TeleporterMessenger` contract versions to their addresses, and vice versa, a mapping of `TeleporterMessenger` contract addresses to their versions. +- Version zero is an invalid version, and is used to indicate that a `TeleporterMessenger` contract has not been registered yet. +- Once a version number is registered in the registry, it cannot be changed, but a previous registered protocol address can be added to the registry with a new version. This is especially important in the case of a rollback to a previous Teleporter version, in which case the previous Teleporter contract address would need to be registered with a new version to the registry. + +## How to use `TeleporterRegistry` + +`TeleporterUpgradeable` is an abstract contract that helps integrate the `TeleporterRegistry` into a dapp. The dapp contract can inherit `TeleporterUpgradeable`, and pass in the Teleporter registry address inside the constructor, for example in [ERC20Bridge](../ERC20Bridge.sol): + +```solidity +contract ERC20Bridge is + IERC20Bridge, + ITeleporterReceiver, + ReentrancyGuard, + TeleporterUpgradeable, + Ownable +{ + ... + constructor( + address teleporterRegistryAddress + ) TeleporterUpgradeable(teleporterRegistryAddress) { + currentChainID = WarpMessenger(WARP_PRECOMPILE_ADDRESS) + .getBlockchainID(); + } + ... +} +``` + +The `TeleporterUpgradeable` contract saves the Teleporter registry in a state variable used by the inheriting contract, and initializes a `minTeleporterVersion` to the highest number `TeleporterMessenger` version registered in `TeleporterRegistry`. The `onlyAllowedTeleporter` modifier ensures that `msg.sender` is a `TeleporterMessenger` contract with a version greater than or equal to `minTeleporterVersion`. This modifier is used to restrict access to functions that should only be called by a `TeleporterMessenger` contract, i.e. `ITeleporterReceiver.receiveTeleporterMessage`. This is to support the case where a dapp wants to upgrade to a new version of the `TeleporterMessenger` contract, but still wants to be able to receive messages from the old Teleporter contract. + +Every derived contract of `TeleporterUpgradeable` must implement `TeleporterUpgradeable.updateMinTeleporterVersion`, which updates the `minTeleporterVersion` used by the `onlyAllowedTeleporter` modifier and emits the `MinTeleporterVersionUpdated` event. The `updateMinTeleporterVersion` function should be called by the dapp when it completes delivery of messages from the old Teleporter contract, and now wants to update the `minTeleporterVersion` to only allow the new Teleporter version. + +To prevent anyone from calling the dapp's `updateMinTeleporterVersion`, which would disallow messages from old Teleporter versions from being received, this function should be safeguarded with access controls. For example, the ERC20Bridge inherits `Ownable`, and restricts the `updateMinTeleporterVersion` function call to the owner of the contract. + +```solidity + function updateMinTeleporterVersion() external override onlyOwner { + uint256 oldMinTeleporterVersion = minTeleporterVersion; + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + emit MinTeleporterVersionUpdated( + oldMinTeleporterVersion, + minTeleporterVersion + ); + } +``` + +For sending messages with the Teleporter registry, dapps should generally use `TeleporterRegistry.getLatestTeleporter` for the latest version, but if the dapp wants to send a message to a specific version, it can use `TeleporterRegistry.getTeleporterFromVersion` to get the specific Teleporter version. + +Using latest version: + +```solidity + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getLatestTeleporter(); +``` + +Using specific version: + +```solidity + ITeleporterMessenger teleporterMessenger = teleporterRegistry + .getTeleporterFromVersion(version); +``` diff --git a/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol b/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol new file mode 100644 index 000000000..529c899bc --- /dev/null +++ b/contracts/src/Teleporter/upgrades/TeleporterRegistry.sol @@ -0,0 +1,42 @@ +// (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 "../../WarpProtocolRegistry.sol"; +import "../ITeleporterMessenger.sol"; + +/** + * @dev TeleporterRegistry contract is a {WarpProtocolRegistry} and provides an upgrade + * mechanism for {ITeleporterMessenger} contracts. + */ +contract TeleporterRegistry is WarpProtocolRegistry { + constructor( + ProtocolRegistryEntry[] memory initialEntries + ) WarpProtocolRegistry(initialEntries) {} + + /** + * @dev Gets the {ITeleporterMessenger} contract of the given `version`. + * Requirements: + * + * - `version` must be a valid version, i.e. greater than 0 and not greater than the latest version. + */ + function getTeleporterFromVersion( + uint256 version + ) external view returns (ITeleporterMessenger) { + return ITeleporterMessenger(_getAddressFromVersion(version)); + } + + /** + * @dev Gets the latest {ITeleporterMessenger} contract. + */ + function getLatestTeleporter() + external + view + returns (ITeleporterMessenger) + { + return ITeleporterMessenger(_getAddressFromVersion(_latestVersion)); + } +} diff --git a/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol b/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol new file mode 100644 index 000000000..f7715850a --- /dev/null +++ b/contracts/src/Teleporter/upgrades/TeleporterUpgradeable.sol @@ -0,0 +1,63 @@ +// (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 "./TeleporterRegistry.sol"; + +/** + * @dev TeleporterUpgradeable provides upgrade utility for applications built on top + * of the Teleporter protocol by integrating with the {TeleporterRegistry}. + * + * This contract is intended to be inherited by other contracts that wish to use the + * upgrade mechanism. It provides a modifier that restricts access to only Teleporter + * versions that are greater than or equal to `minTeleporterVersion`. + */ +abstract contract TeleporterUpgradeable { + TeleporterRegistry public immutable teleporterRegistry; + uint256 public minTeleporterVersion; + + event MinTeleporterVersionUpdated( + uint256 indexed oldMinTeleporterVersion, + uint256 indexed newMinTeleporterVersion + ); + + /** + * @dev Throws if called by a `msg.sender` that is not an allowed Teleporter version. + * Checks that `msg.sender` matches a Teleporter version greater than or equal to `minTeleporterVersion`. + */ + modifier onlyAllowedTeleporter() { + require( + teleporterRegistry.getVersionFromAddress(msg.sender) >= + minTeleporterVersion, + "TeleporterUpgradeable: invalid teleporter sender" + ); + _; + } + + /** + * @dev Initializes the {TeleporterUpgradeable} contract by getting `teleporterRegistry` + * instance and setting `_minTeleporterVersion`. + */ + constructor(address teleporterRegistryAddress) { + require( + teleporterRegistryAddress != address(0), + "TeleporterUpgradeable: zero teleporter registry address" + ); + + teleporterRegistry = TeleporterRegistry(teleporterRegistryAddress); + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + } + + /** + * @dev This is a virtual function that should be overridden to update the `minTeleporterVersion` + * allowed for modifier `onlyAllowedTeleporter`, and emit {MinTeleporterVersionUpdated} event after. + * + * Note: To prevent anyone from being able to call this function, which would disallow messages + * from old Teleporter versions from being received, this function should be safeguarded with access + * controls. For example, if the derived contract has an owner/admin, only they can call this function. + */ + function updateMinTeleporterVersion() external virtual; +} diff --git a/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol b/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol new file mode 100644 index 000000000..cb5a328a8 --- /dev/null +++ b/contracts/src/Teleporter/upgrades/tests/TeleporterRegistryTests.t.sol @@ -0,0 +1,422 @@ +// (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 "forge-std/Test.sol"; +import "../TeleporterRegistry.sol"; +import "../../TeleporterMessenger.sol"; +import "../../../WarpProtocolRegistry.sol"; + +contract TeleporterRegistryTest is Test { + TeleporterRegistry public teleporterRegistry; + address public teleporterAddress; + + bytes32 public constant MOCK_BLOCK_CHAIN_ID = bytes32(uint256(123456)); + address public constant WARP_PRECOMPILE_ADDRESS = + 0x0200000000000000000000000000000000000005; + + event AddProtocolVersion( + uint256 indexed version, + address indexed protocolAddress + ); + + function setUp() public { + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeWithSelector(WarpMessenger.getBlockchainID.selector), + abi.encode(MOCK_BLOCK_CHAIN_ID) + ); + teleporterRegistry = new TeleporterRegistry( + new ProtocolRegistryEntry[](0) + ); + assertEq(0, teleporterRegistry.getLatestVersion()); + + teleporterAddress = address(new TeleporterMessenger()); + } + + function testAddProtocolVersionBasic() public { + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + assertEq(0, latestVersion); + + _addProtocolVersion(teleporterRegistry); + assertEq(latestVersion + 1, teleporterRegistry.getLatestVersion()); + assertEq( + teleporterAddress, + address(teleporterRegistry.getLatestTeleporter()) + ); + assertEq( + teleporterRegistry.getVersionFromAddress(teleporterAddress), + teleporterRegistry.getLatestVersion() + ); + + // Check that adding a protocol version with a version that is not the increment of the latest version succeeds + latestVersion = teleporterRegistry.getLatestVersion(); + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 2, + teleporterAddress, + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + teleporterRegistry.addProtocolVersion(messageIndex); + assertEq(latestVersion + 2, teleporterRegistry.getLatestVersion()); + assertEq( + teleporterAddress, + address(teleporterRegistry.getLatestTeleporter()) + ); + } + + function testAddNonContractAddress() public { + // Check that adding a protocol version with a protocol address that is not a contract address succeeds + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 2, + address(this), + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + teleporterRegistry.addProtocolVersion(messageIndex); + assertEq(latestVersion + 2, teleporterRegistry.getLatestVersion()); + assertEq( + address(this), + teleporterRegistry.getAddressFromVersion(latestVersion + 2) + ); + } + + function testAddOldVersion() public { + // Check that adding a protocol version that has not been registered, but is less than the latest version succeeds + // First add to latest version by skipping a version. + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 2, + teleporterAddress, + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + teleporterRegistry.addProtocolVersion(messageIndex); + assertEq(latestVersion + 2, teleporterRegistry.getLatestVersion()); + assertEq( + teleporterAddress, + teleporterRegistry.getAddressFromVersion(latestVersion + 2) + ); + + // latestVersion + 1 was skipped in previous check, is not registered, and is less than getLatestVersion() + uint256 oldVersion = latestVersion + 1; + warpMessage = _createWarpOutofBandMessage( + oldVersion, + address(this), + address(teleporterRegistry) + ); + + // Make sure that oldVersion is not registered, and is less than getLatestVersion() + assertEq(oldVersion, teleporterRegistry.getLatestVersion() - 1); + assertEq( + address(0), + teleporterRegistry.getAddressFromVersion(oldVersion) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + teleporterRegistry.addProtocolVersion(messageIndex); + assertEq( + address(this), + teleporterRegistry.getAddressFromVersion(oldVersion) + ); + assertEq(oldVersion + 1, teleporterRegistry.getLatestVersion()); + } + + function testAddExistingVersion() public { + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + + // Add a new version to the registiry + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 1, + teleporterAddress, + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (messageIndex)) + ); + + teleporterRegistry.addProtocolVersion(messageIndex); + assertEq(latestVersion + 1, teleporterRegistry.getLatestVersion()); + assertEq( + teleporterAddress, + teleporterRegistry.getAddressFromVersion(latestVersion + 1) + ); + + // Check that adding a protocol version with the same version fails + vm.expectRevert(_formatErrorMessage("version already exists")); + teleporterRegistry.addProtocolVersion(messageIndex); + } + + function testAddZeroProtocolAddress() public { + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + + // Check that adding an invalid protocol address of address(0) fails + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 1, + address(0), + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("zero protocol address")); + teleporterRegistry.addProtocolVersion(messageIndex); + } + + function testAddZeroVersion() public { + uint32 messageIndex = 0; + + // Check that adding an invalid version of 0 fails + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + 0, + teleporterAddress, + address(teleporterRegistry) + ); + + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("zero version")); + teleporterRegistry.addProtocolVersion(messageIndex); + } + + function testGetAddressFromVersion() public { + _addProtocolVersion(teleporterRegistry); + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + + // First test success case + assertEq( + teleporterAddress, + teleporterRegistry.getAddressFromVersion(latestVersion) + ); + + // Check that getting version 0 fails + vm.expectRevert(_formatErrorMessage("zero version")); + teleporterRegistry.getAddressFromVersion(0); + + // Check that getting a version that doesn't exist fails + vm.expectRevert(_formatErrorMessage("invalid version")); + teleporterRegistry.getAddressFromVersion(latestVersion + 1); + } + + function testGetVersionFromAddress() public { + _addProtocolVersion(teleporterRegistry); + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + + // First test success case + assertEq( + latestVersion, + teleporterRegistry.getVersionFromAddress(teleporterAddress) + ); + + // Check that getting a version of an address that doesn't exist returns 0 + assertEq(0, teleporterRegistry.getVersionFromAddress(address(this))); + } + + function testInvalidWarpMessage() public { + uint256 latestVersion = teleporterRegistry.getLatestVersion(); + uint32 messageIndex = 0; + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 1, + teleporterAddress, + address(teleporterRegistry) + ); + + // First check if warp message is invalid from getVerifiedWarpMessage + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, false) + ); + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (messageIndex)) + ); + + vm.expectRevert(_formatErrorMessage("invalid warp message")); + teleporterRegistry.addProtocolVersion(messageIndex); + + // Check if we have an invalid source chain ID + warpMessage.sourceChainID = bytes32(uint256(1234567)); + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("invalid source chain ID")); + teleporterRegistry.addProtocolVersion(messageIndex); + + // Check if we have an invalid origin sender address + warpMessage.sourceChainID = MOCK_BLOCK_CHAIN_ID; + warpMessage.originSenderAddress = address(this); + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("invalid origin sender address")); + teleporterRegistry.addProtocolVersion(messageIndex); + + // Check if we have an invalid destination chain ID + warpMessage.originSenderAddress = teleporterRegistry + .VALIDATORS_SOURCE_ADDRESS(); + warpMessage.destinationChainID = bytes32(uint256(1234567)); + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("invalid destination chain ID")); + teleporterRegistry.addProtocolVersion(messageIndex); + + // Check if we have an invalid destination address + warpMessage.destinationChainID = MOCK_BLOCK_CHAIN_ID; + warpMessage.destinationAddress = address(this); + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + + vm.expectRevert(_formatErrorMessage("invalid destination address")); + teleporterRegistry.addProtocolVersion(messageIndex); + } + + function _addProtocolVersion(TeleporterRegistry registry) internal { + uint256 latestVersion = registry.getLatestVersion(); + uint32 messageIndex = 0; + WarpMessage memory warpMessage = _createWarpOutofBandMessage( + latestVersion + 1, + teleporterAddress, + address(registry) + ); + vm.mockCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall( + WarpMessenger.getVerifiedWarpMessage, + (messageIndex) + ), + abi.encode(warpMessage, true) + ); + vm.expectCall( + WARP_PRECOMPILE_ADDRESS, + abi.encodeCall(WarpMessenger.getVerifiedWarpMessage, (messageIndex)) + ); + + vm.expectEmit(true, true, false, false, address(registry)); + emit AddProtocolVersion(latestVersion + 1, teleporterAddress); + registry.addProtocolVersion(messageIndex); + } + + function _createWarpOutofBandMessage( + uint256 version, + address protocolAddress, + address registryAddress + ) internal view returns (WarpMessage memory) { + return + WarpMessage({ + sourceChainID: MOCK_BLOCK_CHAIN_ID, + originSenderAddress: TeleporterRegistry(registryAddress) + .VALIDATORS_SOURCE_ADDRESS(), + destinationChainID: MOCK_BLOCK_CHAIN_ID, + destinationAddress: address(registryAddress), + payload: abi.encode( + ProtocolRegistryEntry({ + version: version, + protocolAddress: protocolAddress + }) + ) + }); + } + + function _formatErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("WarpProtocolRegistry: ", errorMessage)); + } +} diff --git a/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol b/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol new file mode 100644 index 000000000..a3e34be6c --- /dev/null +++ b/contracts/src/Teleporter/upgrades/tests/TeleporterUpgradeableTests.t.sol @@ -0,0 +1,132 @@ +// (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 "forge-std/Test.sol"; +import "../TeleporterRegistry.sol"; +import "../TeleporterUpgradeable.sol"; + +contract ExampleUpgradeableApp is TeleporterUpgradeable { + constructor( + address teleporterRegistryAddress + ) TeleporterUpgradeable(teleporterRegistryAddress) {} + + function updateMinTeleporterVersion() external override { + uint256 oldMinTeleporterVersion = minTeleporterVersion; + minTeleporterVersion = teleporterRegistry.getLatestVersion(); + emit MinTeleporterVersionUpdated( + oldMinTeleporterVersion, + minTeleporterVersion + ); + } + + // solhint-disable-next-line no-empty-blocks + function teleporterCall() public onlyAllowedTeleporter {} +} + +contract TeleporterUpgradeableTest is Test { + address public constant MOCK_TELEPORTER_REGISTRY_ADDRESS = + 0xf9FA4a0c696b659328DDaaBCB46Ae4eBFC9e68e4; + address public constant MOCK_TELEPORTER_MESSENGER_ADDRESS = + 0x644E5b7c5D4Bc8073732CEa72c66e0BB90dFC00f; + + event MinTeleporterVersionUpdated( + uint256 indexed oldMinTeleporterVersion, + uint256 indexed newMinTeleporterVersion + ); + + function setUp() public { + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeCall(WarpProtocolRegistry.getLatestVersion, ()), + abi.encode(1) + ); + + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeCall( + WarpProtocolRegistry.getVersionFromAddress, + (MOCK_TELEPORTER_MESSENGER_ADDRESS) + ), + abi.encode(1) + ); + + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeCall( + WarpProtocolRegistry.getVersionFromAddress, + (address(this)) + ), + abi.encode(0) + ); + } + + function testInvalidRegistryAddress() public { + vm.expectRevert( + _formatTeleporterUpgradeableErrorMessage( + "zero teleporter registry address" + ) + ); + new ExampleUpgradeableApp(address(0)); + } + + function testOnlyAllowedTeleporter() public { + ExampleUpgradeableApp app = new ExampleUpgradeableApp( + MOCK_TELEPORTER_REGISTRY_ADDRESS + ); + + assertEq(app.minTeleporterVersion(), 1); + + vm.expectRevert( + _formatTeleporterUpgradeableErrorMessage( + "invalid teleporter sender" + ) + ); + app.teleporterCall(); + + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + app.teleporterCall(); + } + + function testUpdateMinTeleporterVersion() public { + ExampleUpgradeableApp app = new ExampleUpgradeableApp( + MOCK_TELEPORTER_REGISTRY_ADDRESS + ); + + // First check that calling with initial teleporter address works + assertEq(app.minTeleporterVersion(), 1); + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + app.teleporterCall(); + + // Now mock the registry getting a new version and updating the app's min version + vm.mockCall( + MOCK_TELEPORTER_REGISTRY_ADDRESS, + abi.encodeCall(WarpProtocolRegistry.getLatestVersion, ()), + abi.encode(2) + ); + + vm.expectEmit(true, true, true, true, address(app)); + emit MinTeleporterVersionUpdated(1, 2); + + app.updateMinTeleporterVersion(); + assertEq(app.minTeleporterVersion(), 2); + + // Check that calling with the old teleporter address fails + vm.expectRevert( + _formatTeleporterUpgradeableErrorMessage( + "invalid teleporter sender" + ) + ); + vm.prank(MOCK_TELEPORTER_MESSENGER_ADDRESS); + app.teleporterCall(); + } + + function _formatTeleporterUpgradeableErrorMessage( + string memory errorMessage + ) private pure returns (bytes memory) { + return bytes(string.concat("TeleporterUpgradeable: ", errorMessage)); + } +} diff --git a/contracts/src/WarpProtocolRegistry.sol b/contracts/src/WarpProtocolRegistry.sol new file mode 100644 index 000000000..2ec5dc642 --- /dev/null +++ b/contracts/src/WarpProtocolRegistry.sol @@ -0,0 +1,198 @@ +// (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 "@subnet-evm-contracts/interfaces/IWarpMessenger.sol"; +import "@openzeppelin/contracts/utils/Address.sol"; + +/** + * @dev Registry entry that represents a mapping between protocolAddress and version. + */ +struct ProtocolRegistryEntry { + uint256 version; + address protocolAddress; +} + +/** + * @dev Implementation of an abstract `WarpProtocolRegistry` contract. + * + * This implementation is a contract that can be used as a base contract for protocols that are + * built on top of Warp. It allows the protocol to be upgraded through a Warp out-of-band message. + */ +abstract contract WarpProtocolRegistry { + // Address that the out-of-band Warp message sets as the "source" address. + // The address is not owned by any EOA or smart contract account, so it + // cannot possibly be the source address of any other Warp message emitted by the VM. + address public constant VALIDATORS_SOURCE_ADDRESS = address(0); + + WarpMessenger public constant WARP_MESSENGER = + WarpMessenger(0x0200000000000000000000000000000000000005); + + bytes32 internal immutable _blockchainID; + + // The latest protocol version. 0 means no protocol version has been added, and isn't a valid version. + uint256 internal _latestVersion; + + // Mappings that keep track of the protocol version and corresponding contract address. + mapping(uint256 => address) internal _versionToAddress; + mapping(address => uint256) internal _addressToVersion; + + /** + * @dev Emitted when a new protocol version is added to the registry. + */ + event AddProtocolVersion( + uint256 indexed version, + address indexed protocolAddress + ); + + /** + * @dev Initializes the contract by setting `_blockchainID` and `_latestVersion`. + * Also adds the initial protocol versions to the registry. + */ + constructor(ProtocolRegistryEntry[] memory initialEntries) { + _blockchainID = WARP_MESSENGER.getBlockchainID(); + _latestVersion = 0; + + for (uint256 i = 0; i < initialEntries.length; i++) { + _addToRegistry(initialEntries[i]); + } + } + + /** + * @dev Gets and verifies a warp out-of-band message, and adds the new protocol version + * address to the registry. + * If a version is greater than the current latest version, it will be set as the latest version. + * If a version is less than the current latest version, it is added to the registry, but + * doesn't change the latest version. + * + * Emits a {AddProtocolVersion} event when successful. + * Requirements: + * + * - a valid Warp out-of-band message must be provided. + * - source chain ID must be the same as the blockchain ID of the registry. + * - origin sender address must be the same as the `VALIDATORS_SOURCE_ADDRESS`. + * - destination chain ID must be the same as the blockchain ID of the registry. + * - destination address must be the same as the address of the registry. + * - version must not be zero. + * - version must not already be registered. + * - protocol address must not be zero address. + */ + function addProtocolVersion(uint32 messageIndex) external virtual { + // Get and validate for a warp out-of-band message. + (WarpMessage memory message, bool success) = WARP_MESSENGER + .getVerifiedWarpMessage(messageIndex); + require(success, "WarpProtocolRegistry: invalid warp message"); + require( + message.sourceChainID == _blockchainID, + "WarpProtocolRegistry: invalid source chain ID" + ); + // Check that the message is sent through a warp out of band message. + require( + message.originSenderAddress == VALIDATORS_SOURCE_ADDRESS, + "WarpProtocolRegistry: invalid origin sender address" + ); + require( + message.destinationChainID == _blockchainID, + "WarpProtocolRegistry: invalid destination chain ID" + ); + require( + message.destinationAddress == address(this), + "WarpProtocolRegistry: invalid destination address" + ); + + ProtocolRegistryEntry memory entry = abi.decode( + message.payload, + (ProtocolRegistryEntry) + ); + + _addToRegistry(entry); + } + + /** + * @dev Gets the address of a protocol version. + * Requirements: + * + * - the version must be a valid version. + */ + function getAddressFromVersion( + uint256 version + ) external view virtual returns (address) { + return _getAddressFromVersion(version); + } + + /** + * @dev Gets the version of the given `protocolAddress`. + * If `protocolAddress` is not a registered protocol address, returns 0, which is an invalid version. + */ + function getVersionFromAddress( + address protocolAddress + ) external view virtual returns (uint256) { + return _addressToVersion[protocolAddress]; + } + + /** + * @dev Gets the latest protocol version. + * If the registry has no versions, we return 0, which is an invalid version. + */ + function getLatestVersion() external view virtual returns (uint256) { + return _latestVersion; + } + + /** + * @dev Adds the new protocol version address to the registry. + * Updates latest version if the version is greater than the current latest version. + * + * Emits a {AddProtocolVersion} event when successful. + * Note: `protocolAddress` doesn't have to be a contract address, this is primarily + * to support the case we want to register a new protocol address meant for a security patch + * before the contract is deployed, to prevent the vulnerabilitiy from being exposed before registry update. + * Requirements: + * + * - `version` is not zero + * - `version` is not already registered + * - `protocolAddress` is not zero address + */ + function _addToRegistry( + ProtocolRegistryEntry memory entry + ) internal virtual { + require(entry.version != 0, "WarpProtocolRegistry: zero version"); + // Check that the version has not previously been registered. + require( + _versionToAddress[entry.version] == address(0), + "WarpProtocolRegistry: version already exists" + ); + require( + entry.protocolAddress != address(0), + "WarpProtocolRegistry: zero protocol address" + ); + + _versionToAddress[entry.version] = entry.protocolAddress; + _addressToVersion[entry.protocolAddress] = entry.version; + emit AddProtocolVersion(entry.version, entry.protocolAddress); + + // Set latest version if the version is greater than the current latest version. + if (entry.version > _latestVersion) { + _latestVersion = entry.version; + } + } + + /** + * @dev Gets the address of a protocol version. + * Requirements: + * + * - `version` must be a valid version, i.e. greater than 0 and not greater than the latest version. + */ + function _getAddressFromVersion( + uint256 version + ) internal view virtual returns (address) { + require(version != 0, "WarpProtocolRegistry: zero version"); + require( + version <= _latestVersion, + "WarpProtocolRegistry: invalid version" + ); + return _versionToAddress[version]; + } +} diff --git a/docker/Dockerfile b/docker/Dockerfile index c60b4b563..31012a85e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,13 +36,13 @@ ENV LANG en_US.utf8 # Install foundry from specific commit SHELL ["/bin/bash", "-c"] -RUN curl -L https://raw.githubusercontent.com/foundry-rs/foundry/70d00222c2ef74fc484b8d98c5705d131ab31871/foundryup/install > /tmp/foundry-install-script && \ - sed -i 's/\/foundry-rs\/foundry\/master\/foundryup/\/foundry-rs\/foundry\/70d00222c2ef74fc484b8d98c5705d131ab31871\/foundryup/g' /tmp/foundry-install-script && \ +RUN curl -L https://raw.githubusercontent.com/foundry-rs/foundry/037b3bc9cebd545fe3a4f05a32bf7efb82afdbd8/foundryup/install > /tmp/foundry-install-script && \ + sed -i 's/\/foundry-rs\/foundry\/master\/foundryup/\/foundry-rs\/foundry\/037b3bc9cebd545fe3a4f05a32bf7efb82afdbd8\/foundryup/g' /tmp/foundry-install-script && \ cat /tmp/foundry-install-script | bash && \ echo "export PATH=\"$PATH:/$HOME/.foundry/bin\"">> ~/.bashrc && \ source ~/.bashrc && \ export PATH=$PATH:$HOME/.foundry/bin:$HOME/.cargo/bin && \ - foundryup --version nightly-70d00222c2ef74fc484b8d98c5705d131ab31871 + foundryup --version nightly-037b3bc9cebd545fe3a4f05a32bf7efb82afdbd8 # Install python base58 decode library RUN apt-get update && \ diff --git a/docker/run_setup.sh b/docker/run_setup.sh index e38829ea8..811cdd482 100755 --- a/docker/run_setup.sh +++ b/docker/run_setup.sh @@ -133,6 +133,24 @@ if [ ! -e $dir_prefix/NETWORK_RUNNING ]; then fi echo "Deployed TeleporterMessenger to C-chain." + # Deploy TeleporterRegistry to each chain. + cd contracts + registry_deploy_result_a=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_a_url src/Teleporter/upgrades/TeleporterRegistry.sol:TeleporterRegistry --constructor-args "[(1,$teleporter_contract_address)]") + registry_address_a=$(parseContractAddress "$registry_deploy_result_a") + echo "TeleporterRegistry contract deployed to subnet A at $registry_address_a." + + registry_deploy_result_b=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_b_url src/Teleporter/upgrades/TeleporterRegistry.sol:TeleporterRegistry --constructor-args "[(1,$teleporter_contract_address)]") + registry_address_b=$(parseContractAddress "$registry_deploy_result_b") + echo "TeleporterRegistry contract deployed to subnet B at $registry_address_b." + + registry_deploy_result_c=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_c_url src/Teleporter/upgrades/TeleporterRegistry.sol:TeleporterRegistry --constructor-args "[(1,$teleporter_contract_address)]") + registry_address_c=$(parseContractAddress "$registry_deploy_result_c") + echo "TeleporterRegistry contract deployed to subnet C at $registry_address_c." + cd .. + # Send tokens to cover gas costs for the relayers. relayer_private_key=C2CE4E001B7585F543982A01FBC537CFF261A672FA8BD1FAFC08A207098FE2DE relayer_address=0xA100fF48a37cab9f87c8b5Da933DA46ea1a5fb80 diff --git a/go.work.sum b/go.work.sum index ba31eab35..8405bfc63 100644 --- a/go.work.sum +++ b/go.work.sum @@ -746,11 +746,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/ava-labs/avalanche-network-runner-sdk v0.3.0/go.mod h1:SgKJvtqvgo/Bl/c8fxEHCLaSxEbzimYfBopcfrajxQk= -github.com/ava-labs/avalanchego v1.10.10-rc.4/go.mod h1:BN97sZppDSvIMIfEjrLTjdPTFkGLkb0ISJHEcoxMMNk= -github.com/ava-labs/ledger-avalanche/go v0.0.0-20230105152938-00a24d05a8c7/go.mod h1:XhiXSrh90sHUbkERzaxEftCmUz53eCijshDLZ4fByVM= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -760,15 +756,9 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -777,40 +767,27 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/s2a-go v0.1.3 h1:FAgZmpLl/SXurPEZyCMPBIiiYeTbqfjlbdnCNTAkbGE= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -832,16 +809,10 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -857,9 +828,6 @@ github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXx github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ= github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= @@ -867,71 +835,42 @@ github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3ev github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ= -github.com/sanity-io/litter v1.5.1/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/thepudds/fzgen v0.4.2/go.mod h1:kHCWdsv5tdnt32NIHYDdgq083m6bMtaY0M+ipiO9xWE= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k= go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4= go.etcd.io/etcd/client/v2 v2.305.7/go.mod h1:GQGT5Z3TBuAQGvgPfhR7VPySu/SudxmEkRq9BgzFU6s= go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= @@ -939,7 +878,6 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -954,12 +892,10 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -970,36 +906,26 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0= google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.122.0 h1:zDobeejm3E7pEG1mNHvdxvjs5XJoCMzyNH+CmwL94Es= google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= @@ -1011,7 +937,5 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/scripts/abi_bindings.sh b/scripts/abi_bindings.sh index cfaaa6138..e368d08e3 100755 --- a/scripts/abi_bindings.sh +++ b/scripts/abi_bindings.sh @@ -13,7 +13,7 @@ TELEPORTER_PATH=$( cd .. && pwd ) -DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken" +DEFAULT_CONTRACT_LIST="TeleporterMessenger ERC20Bridge ExampleCrossChainMessenger BlockHashPublisher BlockHashReceiver BridgeToken TeleporterRegistry" CONTRACT_LIST= HELP= diff --git a/scripts/local/integration-tests/basic_send_receive.sh b/scripts/local/integration-tests/basic_send_receive.sh index ebc047ffb..91f53c246 100755 --- a/scripts/local/integration-tests/basic_send_receive.sh +++ b/scripts/local/integration-tests/basic_send_receive.sh @@ -22,6 +22,9 @@ set -e # Stop on first error # subnet_b_subnet_id_hex # teleporter_contract_address # warp_messenger_precompile_addr +# registry_address_a +# registry_address_b +# registry_address_c # Test covers: # - Sending bidirectional cross chain messages between two chains, by calling Teleporter contract sendCrossChainMessage function directly. diff --git a/scripts/local/integration-tests/block_hash_publish_receive.sh b/scripts/local/integration-tests/block_hash_publish_receive.sh index 314817d5e..1e0a3ee8f 100755 --- a/scripts/local/integration-tests/block_hash_publish_receive.sh +++ b/scripts/local/integration-tests/block_hash_publish_receive.sh @@ -21,6 +21,10 @@ set -e # Stop on first error # subnet_a_subnet_id_hex # subnet_b_subnet_id_hex # teleporter_contract_address +# warp_messenger_precompile_addr +# registry_address_a +# registry_address_b +# registry_address_c # Test covers: # - Deploying block hash publisher smart contract, which is built on top of teleporter. @@ -28,15 +32,15 @@ set -e # Stop on first error # Deploy the block hash publisher to subnet A cd contracts -block_hash_publisher_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_a_url src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol:BlockHashPublisher) +block_hash_publisher_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_a_url src/CrossChainApplications/VerifiedBlockHash/BlockHashPublisher.sol:BlockHashPublisher --constructor-args $registry_address_a ) block_hash_publisher_contract_address=$(parseContractAddress "$block_hash_publisher_deploy_result") echo "Block hash publisher contract deployed to subnet A at $block_hash_publisher_contract_address" # Deploy the example messenger application on subnet B block_hash_receiver_deploy_result=$(forge create --private-key $user_private_key \ - --constructor-args $teleporter_contract_address $subnet_a_chain_id_hex $block_hash_publisher_contract_address \ - --rpc-url $subnet_b_url src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol:BlockHashReceiver) + --rpc-url $subnet_b_url src/CrossChainApplications/VerifiedBlockHash/BlockHashReceiver.sol:BlockHashReceiver \ + --constructor-args $registry_address_a $subnet_a_chain_id_hex $block_hash_publisher_contract_address) block_hash_receiver_contract_address=$(parseContractAddress "$block_hash_receiver_deploy_result") echo "Block hash receiver contract deployed to subnet B at $block_hash_receiver_contract_address" diff --git a/scripts/local/integration-tests/erc20_bridge_multihop.sh b/scripts/local/integration-tests/erc20_bridge_multihop.sh index f6292f8ba..a612e349a 100755 --- a/scripts/local/integration-tests/erc20_bridge_multihop.sh +++ b/scripts/local/integration-tests/erc20_bridge_multihop.sh @@ -26,6 +26,10 @@ set -e # Stop on first error # subnet_b_subnet_id_hex # subnet_c_subnet_id_hex # teleporter_contract_address +# warp_messenger_precompile_addr +# registry_address_a +# registry_address_b +# registry_address_c # Test covers: # - Creating bridged tokens on subnets different from the original subnet with the native token asset. @@ -39,19 +43,22 @@ native_erc20_deploy_result=$(forge create --private-key $user_private_key src/Mo native_erc20_contract_address=$(parseContractAddress "$native_erc20_deploy_result") echo "Test ERC20 contract deployed to $native_erc20_contract_address on Subnet A" -# Deploy the ERC20 bridge contract to both chains. -bridge_a_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_a_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) +# Deploy the ERC20 bridge contract to all chains. +bridge_a_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_a_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge \ + --constructor-args $registry_address_a) bridge_a_address=$(parseContractAddress "$bridge_a_deploy_result") echo "ERC20 bridge contract deployed to subnet A at $bridge_a_address." -bridge_b_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_b_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) +bridge_b_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_b_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge \ + --constructor-args $registry_address_b) bridge_b_address=$(parseContractAddress "$bridge_b_deploy_result") echo "ERC20 bridge contract deployed to subnet B at $bridge_b_address." -bridge_c_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_c_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge) +bridge_c_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_c_url src/CrossChainApplications/ERC20Bridge/ERC20Bridge.sol:ERC20Bridge \ + --constructor-args $registry_address_c) bridge_c_address=$(parseContractAddress "$bridge_c_deploy_result") echo "ERC20 bridge contract deployed to subnet C at $bridge_c_address." diff --git a/scripts/local/integration-tests/example_messenger.sh b/scripts/local/integration-tests/example_messenger.sh index d4a6ba9b3..4f13d887a 100755 --- a/scripts/local/integration-tests/example_messenger.sh +++ b/scripts/local/integration-tests/example_messenger.sh @@ -22,6 +22,9 @@ set -e # Stop on first error # subnet_b_subnet_id_hex # teleporter_contract_address # warp_messenger_precompile_addr +# registry_address_a +# registry_address_b +# registry_address_c # Deploy a test ERC20 on subnet A. cd contracts @@ -30,14 +33,14 @@ erc20_contract_address=$(parseContractAddress "$erc20_deploy_result") echo "Test ERC20 contract deployed to $erc20_contract_address on Subnet A" # Deploy the example messenger application on subnet A -example_messenger_a_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_a_url src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol:ExampleCrossChainMessenger) +example_messenger_a_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_a_url src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol:ExampleCrossChainMessenger --constructor-args $registry_address_a) example_messenger_a_contract_address=$(parseContractAddress "$example_messenger_a_deploy_result") echo "Example Messenger contract deployed to subnet A at $example_messenger_a_contract_address" # Deploy the example messenger application on subnet B -example_messenger_b_deploy_result=$(forge create --private-key $user_private_key --constructor-args $teleporter_contract_address \ - --rpc-url $subnet_b_url src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol:ExampleCrossChainMessenger) +example_messenger_b_deploy_result=$(forge create --private-key $user_private_key \ + --rpc-url $subnet_b_url src/CrossChainApplications/ExampleMessenger/ExampleCrossChainMessenger.sol:ExampleCrossChainMessenger --constructor-args $registry_address_b) example_messenger_b_contract_address=$(parseContractAddress "$example_messenger_b_deploy_result") echo "Example Messenger contract deployed to subnet B at $example_messenger_b_contract_address" diff --git a/scripts/local/integration-tests/retry_receipts.sh b/scripts/local/integration-tests/retry_receipts.sh index cd9a48ba9..2b98ef133 100755 --- a/scripts/local/integration-tests/retry_receipts.sh +++ b/scripts/local/integration-tests/retry_receipts.sh @@ -22,6 +22,9 @@ set -e # Stop on first error # subnet_b_subnet_id_hex # teleporter_contract_address # warp_messenger_precompile_addr +# registry_address_a +# registry_address_b +# registry_address_c # Test covers: # - Sending cross chain messages between two chains, by calling Teleporter contract sendCrossChainMessage function directly.