From 32bed5d08e0d17477228ba89182236530f1084b3 Mon Sep 17 00:00:00 2001 From: Masanori Yoshida Date: Fri, 9 Aug 2024 12:50:46 +0900 Subject: [PATCH] use yui-ibc-solidity@v0.3.34 Signed-off-by: Masanori Yoshida --- Makefile | 15 +- .../ibcchannelupgradablemodule.go | 300 ------------------ .../iibcchannelupgradablemodule.go | 300 ++++++++++++++++++ pkg/relay/ethereum/cmd.go | 8 +- pkg/relay/ethereum/upgrade.go | 10 +- yui-ibc-solidity | 2 +- 6 files changed, 316 insertions(+), 319 deletions(-) delete mode 100644 pkg/contract/ibcchannelupgradablemodule/ibcchannelupgradablemodule.go create mode 100644 pkg/contract/iibcchannelupgradablemodule/iibcchannelupgradablemodule.go diff --git a/Makefile b/Makefile index 9eac239..4d05cd6 100644 --- a/Makefile +++ b/Makefile @@ -24,15 +24,12 @@ compile: .PHONY: abigen abigen: compile @mkdir -p ./build/abi - @mkdir -p ./pkg/contract/ibchandler - @mkdir -p ./pkg/contract/multicall3 - @mkdir -p ./pkg/contract/ibcchannelupgradablemodule - @jq -r '.abi' ./yui-ibc-solidity/out/IBCHandler.sol/IBCHandler.json > ./build/abi/IBCHandler.abi - @jq -r '.abi' ./yui-ibc-solidity/out/Multicall3.sol/Multicall3.json > ./build/abi/Multicall3.abi - @jq -r '.abi' ./yui-ibc-solidity/out/IBCChannelUpgradableModule.sol/IIBCChannelUpgradableModule.json > ./build/abi/IIBCChannelUpgradableModule.abi - @$(ABIGEN) --abi ./build/abi/IBCHandler.abi --pkg ibchandler --out ./pkg/contract/ibchandler/ibchandler.go - @$(ABIGEN) --abi ./build/abi/Multicall3.abi --pkg multicall3 --out ./pkg/contract/multicall3/multicall3.go - @$(ABIGEN) --abi ./build/abi/IIBCChannelUpgradableModule.abi --pkg ibcchannelupgradablemodule -out ./pkg/contract/ibcchannelupgradablemodule/ibcchannelupgradablemodule.go + @for a in IBCHandler Multicall3 IIBCChannelUpgradableModule; do \ + b=$$(echo $$a | tr '[A-Z]' '[a-z]'); \ + mkdir -p ./build/abi ./pkg/contract/$$b; \ + jq -r '.abi' ./yui-ibc-solidity/out/$$a.sol/$$a.json > ./build/abi/$$a.abi; \ + $(ABIGEN) --abi ./build/abi/$$a.abi --pkg $$b --out ./pkg/contract/$$b/$$b.go; \ + done .PHONY: proto-gen proto-update-deps proto-gen: diff --git a/pkg/contract/ibcchannelupgradablemodule/ibcchannelupgradablemodule.go b/pkg/contract/ibcchannelupgradablemodule/ibcchannelupgradablemodule.go deleted file mode 100644 index 841a3ec..0000000 --- a/pkg/contract/ibcchannelupgradablemodule/ibcchannelupgradablemodule.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package ibcchannelupgradablemodule - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// HeightData is an auto generated low-level Go binding around an user-defined struct. -type HeightData struct { - RevisionNumber uint64 - RevisionHeight uint64 -} - -// IIBCChannelUpgradableModuleUpgradeProposal is an auto generated low-level Go binding around an user-defined struct. -type IIBCChannelUpgradableModuleUpgradeProposal struct { - Fields UpgradeFieldsData - Timeout TimeoutData -} - -// TimeoutData is an auto generated low-level Go binding around an user-defined struct. -type TimeoutData struct { - Height HeightData - Timestamp uint64 -} - -// UpgradeFieldsData is an auto generated low-level Go binding around an user-defined struct. -type UpgradeFieldsData struct { - Ordering uint8 - ConnectionHops []string - Version string -} - -// IbcchannelupgradablemoduleMetaData contains all meta data concerning the Ibcchannelupgradablemodule contract. -var IbcchannelupgradablemoduleMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"allowTransitionToFlushComplete\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"upgradeSequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getUpgradeProposal\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelUpgradableModule.UpgradeProposal\",\"components\":[{\"name\":\"fields\",\"type\":\"tuple\",\"internalType\":\"structUpgradeFields.Data\",\"components\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"timeout\",\"type\":\"tuple\",\"internalType\":\"structTimeout.Data\",\"components\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeUpgrade\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"upgradeFields\",\"type\":\"tuple\",\"internalType\":\"structUpgradeFields.Data\",\"components\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"timeout\",\"type\":\"tuple\",\"internalType\":\"structTimeout.Data\",\"components\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"removeUpgradeProposal\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"}]", -} - -// IbcchannelupgradablemoduleABI is the input ABI used to generate the binding from. -// Deprecated: Use IbcchannelupgradablemoduleMetaData.ABI instead. -var IbcchannelupgradablemoduleABI = IbcchannelupgradablemoduleMetaData.ABI - -// Ibcchannelupgradablemodule is an auto generated Go binding around an Ethereum contract. -type Ibcchannelupgradablemodule struct { - IbcchannelupgradablemoduleCaller // Read-only binding to the contract - IbcchannelupgradablemoduleTransactor // Write-only binding to the contract - IbcchannelupgradablemoduleFilterer // Log filterer for contract events -} - -// IbcchannelupgradablemoduleCaller is an auto generated read-only Go binding around an Ethereum contract. -type IbcchannelupgradablemoduleCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IbcchannelupgradablemoduleTransactor is an auto generated write-only Go binding around an Ethereum contract. -type IbcchannelupgradablemoduleTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IbcchannelupgradablemoduleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type IbcchannelupgradablemoduleFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IbcchannelupgradablemoduleSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type IbcchannelupgradablemoduleSession struct { - Contract *Ibcchannelupgradablemodule // 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 -} - -// IbcchannelupgradablemoduleCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type IbcchannelupgradablemoduleCallerSession struct { - Contract *IbcchannelupgradablemoduleCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// IbcchannelupgradablemoduleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type IbcchannelupgradablemoduleTransactorSession struct { - Contract *IbcchannelupgradablemoduleTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IbcchannelupgradablemoduleRaw is an auto generated low-level Go binding around an Ethereum contract. -type IbcchannelupgradablemoduleRaw struct { - Contract *Ibcchannelupgradablemodule // Generic contract binding to access the raw methods on -} - -// IbcchannelupgradablemoduleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type IbcchannelupgradablemoduleCallerRaw struct { - Contract *IbcchannelupgradablemoduleCaller // Generic read-only contract binding to access the raw methods on -} - -// IbcchannelupgradablemoduleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type IbcchannelupgradablemoduleTransactorRaw struct { - Contract *IbcchannelupgradablemoduleTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewIbcchannelupgradablemodule creates a new instance of Ibcchannelupgradablemodule, bound to a specific deployed contract. -func NewIbcchannelupgradablemodule(address common.Address, backend bind.ContractBackend) (*Ibcchannelupgradablemodule, error) { - contract, err := bindIbcchannelupgradablemodule(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Ibcchannelupgradablemodule{IbcchannelupgradablemoduleCaller: IbcchannelupgradablemoduleCaller{contract: contract}, IbcchannelupgradablemoduleTransactor: IbcchannelupgradablemoduleTransactor{contract: contract}, IbcchannelupgradablemoduleFilterer: IbcchannelupgradablemoduleFilterer{contract: contract}}, nil -} - -// NewIbcchannelupgradablemoduleCaller creates a new read-only instance of Ibcchannelupgradablemodule, bound to a specific deployed contract. -func NewIbcchannelupgradablemoduleCaller(address common.Address, caller bind.ContractCaller) (*IbcchannelupgradablemoduleCaller, error) { - contract, err := bindIbcchannelupgradablemodule(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &IbcchannelupgradablemoduleCaller{contract: contract}, nil -} - -// NewIbcchannelupgradablemoduleTransactor creates a new write-only instance of Ibcchannelupgradablemodule, bound to a specific deployed contract. -func NewIbcchannelupgradablemoduleTransactor(address common.Address, transactor bind.ContractTransactor) (*IbcchannelupgradablemoduleTransactor, error) { - contract, err := bindIbcchannelupgradablemodule(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &IbcchannelupgradablemoduleTransactor{contract: contract}, nil -} - -// NewIbcchannelupgradablemoduleFilterer creates a new log filterer instance of Ibcchannelupgradablemodule, bound to a specific deployed contract. -func NewIbcchannelupgradablemoduleFilterer(address common.Address, filterer bind.ContractFilterer) (*IbcchannelupgradablemoduleFilterer, error) { - contract, err := bindIbcchannelupgradablemodule(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &IbcchannelupgradablemoduleFilterer{contract: contract}, nil -} - -// bindIbcchannelupgradablemodule binds a generic wrapper to an already deployed contract. -func bindIbcchannelupgradablemodule(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := IbcchannelupgradablemoduleMetaData.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 (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Ibcchannelupgradablemodule.Contract.IbcchannelupgradablemoduleCaller.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 (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.IbcchannelupgradablemoduleTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.IbcchannelupgradablemoduleTransactor.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 (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Ibcchannelupgradablemodule.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 (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.contract.Transact(opts, method, params...) -} - -// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. -// -// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleCaller) GetUpgradeProposal(opts *bind.CallOpts, portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { - var out []interface{} - err := _Ibcchannelupgradablemodule.contract.Call(opts, &out, "getUpgradeProposal", portId, channelId) - - if err != nil { - return *new(IIBCChannelUpgradableModuleUpgradeProposal), err - } - - out0 := *abi.ConvertType(out[0], new(IIBCChannelUpgradableModuleUpgradeProposal)).(*IIBCChannelUpgradableModuleUpgradeProposal) - - return out0, err - -} - -// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. -// -// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleSession) GetUpgradeProposal(portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { - return _Ibcchannelupgradablemodule.Contract.GetUpgradeProposal(&_Ibcchannelupgradablemodule.CallOpts, portId, channelId) -} - -// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. -// -// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleCallerSession) GetUpgradeProposal(portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { - return _Ibcchannelupgradablemodule.Contract.GetUpgradeProposal(&_Ibcchannelupgradablemodule.CallOpts, portId, channelId) -} - -// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. -// -// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactor) AllowTransitionToFlushComplete(opts *bind.TransactOpts, portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.contract.Transact(opts, "allowTransitionToFlushComplete", portId, channelId, upgradeSequence) -} - -// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. -// -// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleSession) AllowTransitionToFlushComplete(portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.AllowTransitionToFlushComplete(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeSequence) -} - -// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. -// -// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactorSession) AllowTransitionToFlushComplete(portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.AllowTransitionToFlushComplete(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeSequence) -} - -// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. -// -// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactor) ProposeUpgrade(opts *bind.TransactOpts, portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.contract.Transact(opts, "proposeUpgrade", portId, channelId, upgradeFields, timeout) -} - -// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. -// -// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleSession) ProposeUpgrade(portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.ProposeUpgrade(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeFields, timeout) -} - -// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. -// -// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactorSession) ProposeUpgrade(portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.ProposeUpgrade(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeFields, timeout) -} - -// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. -// -// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactor) RemoveUpgradeProposal(opts *bind.TransactOpts, portId string, channelId string) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.contract.Transact(opts, "removeUpgradeProposal", portId, channelId) -} - -// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. -// -// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleSession) RemoveUpgradeProposal(portId string, channelId string) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.RemoveUpgradeProposal(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId) -} - -// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. -// -// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() -func (_Ibcchannelupgradablemodule *IbcchannelupgradablemoduleTransactorSession) RemoveUpgradeProposal(portId string, channelId string) (*types.Transaction, error) { - return _Ibcchannelupgradablemodule.Contract.RemoveUpgradeProposal(&_Ibcchannelupgradablemodule.TransactOpts, portId, channelId) -} diff --git a/pkg/contract/iibcchannelupgradablemodule/iibcchannelupgradablemodule.go b/pkg/contract/iibcchannelupgradablemodule/iibcchannelupgradablemodule.go new file mode 100644 index 0000000..ca1c132 --- /dev/null +++ b/pkg/contract/iibcchannelupgradablemodule/iibcchannelupgradablemodule.go @@ -0,0 +1,300 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package iibcchannelupgradablemodule + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// HeightData is an auto generated low-level Go binding around an user-defined struct. +type HeightData struct { + RevisionNumber uint64 + RevisionHeight uint64 +} + +// IIBCChannelUpgradableModuleUpgradeProposal is an auto generated low-level Go binding around an user-defined struct. +type IIBCChannelUpgradableModuleUpgradeProposal struct { + Fields UpgradeFieldsData + Timeout TimeoutData +} + +// TimeoutData is an auto generated low-level Go binding around an user-defined struct. +type TimeoutData struct { + Height HeightData + Timestamp uint64 +} + +// UpgradeFieldsData is an auto generated low-level Go binding around an user-defined struct. +type UpgradeFieldsData struct { + Ordering uint8 + ConnectionHops []string + Version string +} + +// IibcchannelupgradablemoduleMetaData contains all meta data concerning the Iibcchannelupgradablemodule contract. +var IibcchannelupgradablemoduleMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"function\",\"name\":\"allowTransitionToFlushComplete\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"upgradeSequence\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getUpgradeProposal\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIIBCChannelUpgradableModule.UpgradeProposal\",\"components\":[{\"name\":\"fields\",\"type\":\"tuple\",\"internalType\":\"structUpgradeFields.Data\",\"components\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"timeout\",\"type\":\"tuple\",\"internalType\":\"structTimeout.Data\",\"components\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeUpgrade\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"upgradeFields\",\"type\":\"tuple\",\"internalType\":\"structUpgradeFields.Data\",\"components\":[{\"name\":\"ordering\",\"type\":\"uint8\",\"internalType\":\"enumChannel.Order\"},{\"name\":\"connection_hops\",\"type\":\"string[]\",\"internalType\":\"string[]\"},{\"name\":\"version\",\"type\":\"string\",\"internalType\":\"string\"}]},{\"name\":\"timeout\",\"type\":\"tuple\",\"internalType\":\"structTimeout.Data\",\"components\":[{\"name\":\"height\",\"type\":\"tuple\",\"internalType\":\"structHeight.Data\",\"components\":[{\"name\":\"revision_number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"revision_height\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"removeUpgradeProposal\",\"inputs\":[{\"name\":\"portId\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"channelId\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"}]", +} + +// IibcchannelupgradablemoduleABI is the input ABI used to generate the binding from. +// Deprecated: Use IibcchannelupgradablemoduleMetaData.ABI instead. +var IibcchannelupgradablemoduleABI = IibcchannelupgradablemoduleMetaData.ABI + +// Iibcchannelupgradablemodule is an auto generated Go binding around an Ethereum contract. +type Iibcchannelupgradablemodule struct { + IibcchannelupgradablemoduleCaller // Read-only binding to the contract + IibcchannelupgradablemoduleTransactor // Write-only binding to the contract + IibcchannelupgradablemoduleFilterer // Log filterer for contract events +} + +// IibcchannelupgradablemoduleCaller is an auto generated read-only Go binding around an Ethereum contract. +type IibcchannelupgradablemoduleCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IibcchannelupgradablemoduleTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IibcchannelupgradablemoduleTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IibcchannelupgradablemoduleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IibcchannelupgradablemoduleFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IibcchannelupgradablemoduleSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IibcchannelupgradablemoduleSession struct { + Contract *Iibcchannelupgradablemodule // 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 +} + +// IibcchannelupgradablemoduleCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IibcchannelupgradablemoduleCallerSession struct { + Contract *IibcchannelupgradablemoduleCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IibcchannelupgradablemoduleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IibcchannelupgradablemoduleTransactorSession struct { + Contract *IibcchannelupgradablemoduleTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IibcchannelupgradablemoduleRaw is an auto generated low-level Go binding around an Ethereum contract. +type IibcchannelupgradablemoduleRaw struct { + Contract *Iibcchannelupgradablemodule // Generic contract binding to access the raw methods on +} + +// IibcchannelupgradablemoduleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IibcchannelupgradablemoduleCallerRaw struct { + Contract *IibcchannelupgradablemoduleCaller // Generic read-only contract binding to access the raw methods on +} + +// IibcchannelupgradablemoduleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IibcchannelupgradablemoduleTransactorRaw struct { + Contract *IibcchannelupgradablemoduleTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIibcchannelupgradablemodule creates a new instance of Iibcchannelupgradablemodule, bound to a specific deployed contract. +func NewIibcchannelupgradablemodule(address common.Address, backend bind.ContractBackend) (*Iibcchannelupgradablemodule, error) { + contract, err := bindIibcchannelupgradablemodule(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Iibcchannelupgradablemodule{IibcchannelupgradablemoduleCaller: IibcchannelupgradablemoduleCaller{contract: contract}, IibcchannelupgradablemoduleTransactor: IibcchannelupgradablemoduleTransactor{contract: contract}, IibcchannelupgradablemoduleFilterer: IibcchannelupgradablemoduleFilterer{contract: contract}}, nil +} + +// NewIibcchannelupgradablemoduleCaller creates a new read-only instance of Iibcchannelupgradablemodule, bound to a specific deployed contract. +func NewIibcchannelupgradablemoduleCaller(address common.Address, caller bind.ContractCaller) (*IibcchannelupgradablemoduleCaller, error) { + contract, err := bindIibcchannelupgradablemodule(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IibcchannelupgradablemoduleCaller{contract: contract}, nil +} + +// NewIibcchannelupgradablemoduleTransactor creates a new write-only instance of Iibcchannelupgradablemodule, bound to a specific deployed contract. +func NewIibcchannelupgradablemoduleTransactor(address common.Address, transactor bind.ContractTransactor) (*IibcchannelupgradablemoduleTransactor, error) { + contract, err := bindIibcchannelupgradablemodule(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IibcchannelupgradablemoduleTransactor{contract: contract}, nil +} + +// NewIibcchannelupgradablemoduleFilterer creates a new log filterer instance of Iibcchannelupgradablemodule, bound to a specific deployed contract. +func NewIibcchannelupgradablemoduleFilterer(address common.Address, filterer bind.ContractFilterer) (*IibcchannelupgradablemoduleFilterer, error) { + contract, err := bindIibcchannelupgradablemodule(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IibcchannelupgradablemoduleFilterer{contract: contract}, nil +} + +// bindIibcchannelupgradablemodule binds a generic wrapper to an already deployed contract. +func bindIibcchannelupgradablemodule(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IibcchannelupgradablemoduleMetaData.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 (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Iibcchannelupgradablemodule.Contract.IibcchannelupgradablemoduleCaller.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 (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.IibcchannelupgradablemoduleTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.IibcchannelupgradablemoduleTransactor.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 (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Iibcchannelupgradablemodule.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 (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.contract.Transact(opts, method, params...) +} + +// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. +// +// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleCaller) GetUpgradeProposal(opts *bind.CallOpts, portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { + var out []interface{} + err := _Iibcchannelupgradablemodule.contract.Call(opts, &out, "getUpgradeProposal", portId, channelId) + + if err != nil { + return *new(IIBCChannelUpgradableModuleUpgradeProposal), err + } + + out0 := *abi.ConvertType(out[0], new(IIBCChannelUpgradableModuleUpgradeProposal)).(*IIBCChannelUpgradableModuleUpgradeProposal) + + return out0, err + +} + +// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. +// +// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleSession) GetUpgradeProposal(portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { + return _Iibcchannelupgradablemodule.Contract.GetUpgradeProposal(&_Iibcchannelupgradablemodule.CallOpts, portId, channelId) +} + +// GetUpgradeProposal is a free data retrieval call binding the contract method 0x6df5433b. +// +// Solidity: function getUpgradeProposal(string portId, string channelId) view returns(((uint8,string[],string),((uint64,uint64),uint64))) +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleCallerSession) GetUpgradeProposal(portId string, channelId string) (IIBCChannelUpgradableModuleUpgradeProposal, error) { + return _Iibcchannelupgradablemodule.Contract.GetUpgradeProposal(&_Iibcchannelupgradablemodule.CallOpts, portId, channelId) +} + +// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. +// +// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactor) AllowTransitionToFlushComplete(opts *bind.TransactOpts, portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.contract.Transact(opts, "allowTransitionToFlushComplete", portId, channelId, upgradeSequence) +} + +// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. +// +// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleSession) AllowTransitionToFlushComplete(portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.AllowTransitionToFlushComplete(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeSequence) +} + +// AllowTransitionToFlushComplete is a paid mutator transaction binding the contract method 0x8680841e. +// +// Solidity: function allowTransitionToFlushComplete(string portId, string channelId, uint64 upgradeSequence) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactorSession) AllowTransitionToFlushComplete(portId string, channelId string, upgradeSequence uint64) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.AllowTransitionToFlushComplete(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeSequence) +} + +// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. +// +// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactor) ProposeUpgrade(opts *bind.TransactOpts, portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.contract.Transact(opts, "proposeUpgrade", portId, channelId, upgradeFields, timeout) +} + +// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. +// +// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleSession) ProposeUpgrade(portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.ProposeUpgrade(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeFields, timeout) +} + +// ProposeUpgrade is a paid mutator transaction binding the contract method 0xd6438586. +// +// Solidity: function proposeUpgrade(string portId, string channelId, (uint8,string[],string) upgradeFields, ((uint64,uint64),uint64) timeout) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactorSession) ProposeUpgrade(portId string, channelId string, upgradeFields UpgradeFieldsData, timeout TimeoutData) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.ProposeUpgrade(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId, upgradeFields, timeout) +} + +// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. +// +// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactor) RemoveUpgradeProposal(opts *bind.TransactOpts, portId string, channelId string) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.contract.Transact(opts, "removeUpgradeProposal", portId, channelId) +} + +// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. +// +// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleSession) RemoveUpgradeProposal(portId string, channelId string) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.RemoveUpgradeProposal(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId) +} + +// RemoveUpgradeProposal is a paid mutator transaction binding the contract method 0x0cc5a7af. +// +// Solidity: function removeUpgradeProposal(string portId, string channelId) returns() +func (_Iibcchannelupgradablemodule *IibcchannelupgradablemoduleTransactorSession) RemoveUpgradeProposal(portId string, channelId string) (*types.Transaction, error) { + return _Iibcchannelupgradablemodule.Contract.RemoveUpgradeProposal(&_Iibcchannelupgradablemodule.TransactOpts, portId, channelId) +} diff --git a/pkg/relay/ethereum/cmd.go b/pkg/relay/ethereum/cmd.go index 72d4cf3..475196e 100644 --- a/pkg/relay/ethereum/cmd.go +++ b/pkg/relay/ethereum/cmd.go @@ -5,7 +5,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" chantypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/contract/ibcchannelupgradablemodule" + "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/contract/iibcchannelupgradablemodule" "github.com/ethereum/go-ethereum/common" "github.com/hyperledger-labs/yui-relayer/config" "github.com/spf13/cobra" @@ -114,13 +114,13 @@ func proposeUpgradeCmd(ctx *config.Context) *cobra.Command { appAddr, ethChain.pathEnd.PortID, ethChain.pathEnd.ChannelID, - ibcchannelupgradablemodule.UpgradeFieldsData{ + iibcchannelupgradablemodule.UpgradeFieldsData{ Ordering: ordering, ConnectionHops: connHops, Version: version, }, - ibcchannelupgradablemodule.TimeoutData{ - Height: ibcchannelupgradablemodule.HeightData(timeoutHeight), + iibcchannelupgradablemodule.TimeoutData{ + Height: iibcchannelupgradablemodule.HeightData(timeoutHeight), Timestamp: timeoutTimestamp, }, ) diff --git a/pkg/relay/ethereum/upgrade.go b/pkg/relay/ethereum/upgrade.go index 5f9ddf8..6de2043 100644 --- a/pkg/relay/ethereum/upgrade.go +++ b/pkg/relay/ethereum/upgrade.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/contract/ibcchannelupgradablemodule" + "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/contract/iibcchannelupgradablemodule" "github.com/ethereum/go-ethereum/common" gethtypes "github.com/ethereum/go-ethereum/core/types" ) @@ -14,10 +14,10 @@ func (c *Chain) ProposeUpgrade( appAddr common.Address, portID string, channelID string, - upgradeFields ibcchannelupgradablemodule.UpgradeFieldsData, - timeout ibcchannelupgradablemodule.TimeoutData, + upgradeFields iibcchannelupgradablemodule.UpgradeFieldsData, + timeout iibcchannelupgradablemodule.TimeoutData, ) error { - mockApp, err := ibcchannelupgradablemodule.NewIbcchannelupgradablemodule( + mockApp, err := iibcchannelupgradablemodule.NewIibcchannelupgradablemodule( appAddr, c.client.Client, ) @@ -57,7 +57,7 @@ func (c *Chain) AllowTransitionToFlushComplete( channelID string, upgradeSequence uint64, ) error { - mockApp, err := ibcchannelupgradablemodule.NewIbcchannelupgradablemodule( + mockApp, err := iibcchannelupgradablemodule.NewIibcchannelupgradablemodule( appAddr, c.client.Client, ) diff --git a/yui-ibc-solidity b/yui-ibc-solidity index 49d88ae..32c3918 160000 --- a/yui-ibc-solidity +++ b/yui-ibc-solidity @@ -1 +1 @@ -Subproject commit 49d88ae8151a92e086e6ca7d27a2d3651889edff +Subproject commit 32c3918051d33a1354fc968c5acaa4ccc7956ff8