From 74e58dbf349d95c542c118219d573991104f7cc5 Mon Sep 17 00:00:00 2001 From: zakir <80246097+zakir-code@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:41:36 +0800 Subject: [PATCH] chore: rename cross chain to crosschain (#750) --- app/keepers/keepers.go | 22 +- app/modules.go | 2 +- contract/{ICrossChain.go => ICrosschain.go} | 322 +++++++++--------- contract/compile.sh | 4 +- contract/contract.go | 2 +- solidity/contracts/bridge/BridgeFeeOracle.sol | 10 +- .../{ICrossChain.sol => ICrosschain.sol} | 2 +- ...{CrossChainTest.sol => CrosschainTest.sol} | 10 +- .../{CrossChainTest.go => CrosschainTest.go} | 184 +++++----- tests/precompile_suite.go | 6 +- x/crosschain/keeper/bridge_call_out.go | 2 +- x/crosschain/keeper/keeper_router.go | 2 +- x/crosschain/keeper/keeper_test.go | 4 +- x/crosschain/keeper/many_to_one.go | 4 +- x/crosschain/keeper/msg_server_router.go | 2 +- x/crosschain/precompile/bridge_call_test.go | 4 +- x/crosschain/precompile/contract.go | 2 +- x/crosschain/precompile/contract_test.go | 10 +- x/crosschain/precompile/crosschain.go | 28 +- x/crosschain/precompile/crosschain_test.go | 10 +- x/crosschain/precompile/expected_keepers.go | 2 +- x/crosschain/precompile/has_oracle_test.go | 2 +- .../precompile/is_oracle_online_test.go | 2 +- x/crosschain/precompile/keeper.go | 4 +- x/crosschain/types/contract.go | 12 +- x/crosschain/types/external_address.go | 8 +- x/crosschain/types/{proposal.go => legacy.go} | 2 +- x/crosschain/types/msgs.go | 84 ++--- x/crosschain/types/msgs_test.go | 40 +-- x/erc20/migrations/v8/migrate.go | 2 +- x/erc20/migrations/v8/migrations.go | 4 +- x/erc20/module.go | 6 +- x/erc20/types/token.go | 2 +- x/gov/keeper/keeper_test.go | 2 +- x/ibc/middleware/keeper/keeper.go | 6 +- x/ibc/middleware/keeper/relay.go | 7 +- x/ibc/middleware/types/expected_keepers.go | 4 +- 37 files changed, 410 insertions(+), 411 deletions(-) rename contract/{ICrossChain.go => ICrosschain.go} (72%) rename solidity/contracts/bridge/{ICrossChain.sol => ICrosschain.sol} (97%) rename solidity/contracts/test/{CrossChainTest.sol => CrosschainTest.sol} (90%) rename tests/contract/{CrossChainTest.go => CrosschainTest.go} (65%) rename x/crosschain/types/{proposal.go => legacy.go} (97%) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index eaec2c98..050d6ac7 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -88,7 +88,7 @@ import ( trontypes "github.com/functionx/fx-core/v8/x/tron/types" ) -type CrossChainKeepers struct { +type CrosschainKeepers struct { BscKeeper crosschainkeeper.Keeper PolygonKeeper crosschainkeeper.Keeper AvalancheKeeper crosschainkeeper.Keeper @@ -99,7 +99,7 @@ type CrossChainKeepers struct { Layer2Keeper crosschainkeeper.Keeper } -func (c CrossChainKeepers) ToSlice() []crosschainkeeper.Keeper { +func (c CrosschainKeepers) ToSlice() []crosschainkeeper.Keeper { return []crosschainkeeper.Keeper{ c.BscKeeper, c.PolygonKeeper, c.AvalancheKeeper, c.EthKeeper, c.TronKeeper, c.ArbitrumKeeper, c.OptimismKeeper, c.Layer2Keeper, @@ -140,7 +140,7 @@ type AppKeepers struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper CrosschainRouterKeeper crosschainkeeper.RouterKeeper - CrossChainKeepers + CrosschainKeepers EvmKeeper *fxevmkeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper @@ -329,8 +329,8 @@ func NewAppKeeper( appKeepers.GetSubspace(feemarkettypes.ModuleName), ) - // cross chain precompile - precompileRouter := crosschainprecompile.NewRouter() + // crosschain precompile + crosschainPrecompileRouter := crosschainprecompile.NewRouter() evmKeeper := evmkeeper.NewKeeper( appCodec, appKeepers.keys[evmtypes.StoreKey], @@ -345,7 +345,7 @@ func NewAppKeeper( []evmkeeper.CustomContractFn{ func(_ sdk.Context, _ ethparams.Rules) vm.PrecompiledContract { return crosschainprecompile.NewPrecompiledContract( - appKeepers.BankKeeper, appKeepers.GovKeeper, precompileRouter) + appKeepers.BankKeeper, appKeepers.GovKeeper, crosschainPrecompileRouter) }, func(_ sdk.Context, _ ethparams.Rules) vm.PrecompiledContract { return stakingprecompile.NewPrecompiledContract( @@ -371,7 +371,7 @@ func NewAppKeeper( authAddr, ) - // init cross chain module + // init crosschain module appKeepers.BscKeeper = crosschainkeeper.NewKeeper( appCodec, bsctypes.ModuleName, @@ -507,8 +507,8 @@ func NewAppKeeper( appKeepers.CrosschainRouterKeeper = crosschainkeeper.NewRouterKeeper(crosschainRouter) - // cross chain precompile - precompileRouter. + // crosschain precompile + crosschainPrecompileRouter. AddRoute(bsctypes.ModuleName, appKeepers.BscKeeper). AddRoute(polygontypes.ModuleName, appKeepers.PolygonKeeper). AddRoute(avalanchetypes.ModuleName, appKeepers.AvalancheKeeper). @@ -517,6 +517,7 @@ func NewAppKeeper( AddRoute(optimismtypes.ModuleName, appKeepers.OptimismKeeper). AddRoute(layer2types.ModuleName, appKeepers.Layer2Keeper). AddRoute(trontypes.ModuleName, appKeepers.TronKeeper) + crosschainPrecompileRouter.Seal() // register the proposal types govRouter := govv1beta1.NewRouter() @@ -550,8 +551,7 @@ func NewAppKeeper( appCodec, authAddr, ) - appKeepers.IBCMiddlewareKeeper = ibcmiddlewarekeeper.NewKeeper(appCodec, appKeepers.EvmKeeper, - appKeepers.EthKeeper) // TODO: replace by crosschain keeper + appKeepers.IBCMiddlewareKeeper = ibcmiddlewarekeeper.NewKeeper(appCodec, appKeepers.EvmKeeper, appKeepers.EthKeeper) ibcTransferModule := ibctransfer.NewIBCModule(appKeepers.IBCTransferKeeper) transferIBCModule := ibcmiddleware.NewIBCMiddleware(appKeepers.IBCMiddlewareKeeper, appKeepers.IBCKeeper.ChannelKeeper, ibcTransferModule) diff --git a/app/modules.go b/app/modules.go index c64ecd57..d6901265 100644 --- a/app/modules.go +++ b/app/modules.go @@ -129,7 +129,7 @@ func appModules( layer2.NewAppModule(app.Layer2Keeper), fxevm.NewAppModule(app.EvmKeeper, app.AccountKeeper, app.GetSubspace(evmtypes.ModuleName)), feemarket.NewAppModule(app.FeeMarketKeeper, app.GetSubspace(feemarkettypes.ModuleName)), - erc20.NewAppModule(app.GetKey(erc20types.StoreKey), appCodec, app.Erc20Keeper, app.BankKeeper, app.CrossChainKeepers.ToSlice()), + erc20.NewAppModule(app.GetKey(erc20types.StoreKey), appCodec, app.Erc20Keeper, app.BankKeeper, app.CrosschainKeepers.ToSlice()), migrate.NewAppModule(app.MigrateKeeper), ibctransfer.NewAppModule(app.IBCTransferKeeper), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), diff --git a/contract/ICrossChain.go b/contract/ICrosschain.go similarity index 72% rename from contract/ICrossChain.go rename to contract/ICrosschain.go index fb569392..a6ce33e9 100644 --- a/contract/ICrossChain.go +++ b/contract/ICrosschain.go @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// ICrossChainMetaData contains all meta data concerning the ICrossChain contract. -var ICrossChainMetaData = &bind.MetaData{ +// ICrosschainMetaData contains all meta data concerning the ICrosschain contract. +var ICrosschainMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_txOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"BridgeCallEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"receipt\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"target\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"name\":\"CrossChain\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"}],\"name\":\"ExecuteClaimEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_refund\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"bridgeCall\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"}],\"name\":\"bridgeCoinAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_receipt\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"_memo\",\"type\":\"string\"}],\"name\":\"crossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"executeClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"hasOracle\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_externalAddress\",\"type\":\"address\"}],\"name\":\"isOracleOnline\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } -// ICrossChainABI is the input ABI used to generate the binding from. -// Deprecated: Use ICrossChainMetaData.ABI instead. -var ICrossChainABI = ICrossChainMetaData.ABI +// ICrosschainABI is the input ABI used to generate the binding from. +// Deprecated: Use ICrosschainMetaData.ABI instead. +var ICrosschainABI = ICrosschainMetaData.ABI -// ICrossChain is an auto generated Go binding around an Ethereum contract. -type ICrossChain struct { - ICrossChainCaller // Read-only binding to the contract - ICrossChainTransactor // Write-only binding to the contract - ICrossChainFilterer // Log filterer for contract events +// ICrosschain is an auto generated Go binding around an Ethereum contract. +type ICrosschain struct { + ICrosschainCaller // Read-only binding to the contract + ICrosschainTransactor // Write-only binding to the contract + ICrosschainFilterer // Log filterer for contract events } -// ICrossChainCaller is an auto generated read-only Go binding around an Ethereum contract. -type ICrossChainCaller struct { +// ICrosschainCaller is an auto generated read-only Go binding around an Ethereum contract. +type ICrosschainCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ICrossChainTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ICrossChainTransactor struct { +// ICrosschainTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ICrosschainTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ICrossChainFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ICrossChainFilterer struct { +// ICrosschainFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ICrosschainFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// ICrossChainSession is an auto generated Go binding around an Ethereum contract, +// ICrosschainSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type ICrossChainSession struct { - Contract *ICrossChain // Generic contract binding to set the session for +type ICrosschainSession struct { + Contract *ICrosschain // 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 } -// ICrossChainCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// ICrosschainCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type ICrossChainCallerSession struct { - Contract *ICrossChainCaller // Generic contract caller binding to set the session for +type ICrosschainCallerSession struct { + Contract *ICrosschainCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// ICrossChainTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// ICrosschainTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type ICrossChainTransactorSession struct { - Contract *ICrossChainTransactor // Generic contract transactor binding to set the session for +type ICrosschainTransactorSession struct { + Contract *ICrosschainTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// ICrossChainRaw is an auto generated low-level Go binding around an Ethereum contract. -type ICrossChainRaw struct { - Contract *ICrossChain // Generic contract binding to access the raw methods on +// ICrosschainRaw is an auto generated low-level Go binding around an Ethereum contract. +type ICrosschainRaw struct { + Contract *ICrosschain // Generic contract binding to access the raw methods on } -// ICrossChainCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ICrossChainCallerRaw struct { - Contract *ICrossChainCaller // Generic read-only contract binding to access the raw methods on +// ICrosschainCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ICrosschainCallerRaw struct { + Contract *ICrosschainCaller // Generic read-only contract binding to access the raw methods on } -// ICrossChainTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ICrossChainTransactorRaw struct { - Contract *ICrossChainTransactor // Generic write-only contract binding to access the raw methods on +// ICrosschainTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ICrosschainTransactorRaw struct { + Contract *ICrosschainTransactor // Generic write-only contract binding to access the raw methods on } -// NewICrossChain creates a new instance of ICrossChain, bound to a specific deployed contract. -func NewICrossChain(address common.Address, backend bind.ContractBackend) (*ICrossChain, error) { - contract, err := bindICrossChain(address, backend, backend, backend) +// NewICrosschain creates a new instance of ICrosschain, bound to a specific deployed contract. +func NewICrosschain(address common.Address, backend bind.ContractBackend) (*ICrosschain, error) { + contract, err := bindICrosschain(address, backend, backend, backend) if err != nil { return nil, err } - return &ICrossChain{ICrossChainCaller: ICrossChainCaller{contract: contract}, ICrossChainTransactor: ICrossChainTransactor{contract: contract}, ICrossChainFilterer: ICrossChainFilterer{contract: contract}}, nil + return &ICrosschain{ICrosschainCaller: ICrosschainCaller{contract: contract}, ICrosschainTransactor: ICrosschainTransactor{contract: contract}, ICrosschainFilterer: ICrosschainFilterer{contract: contract}}, nil } -// NewICrossChainCaller creates a new read-only instance of ICrossChain, bound to a specific deployed contract. -func NewICrossChainCaller(address common.Address, caller bind.ContractCaller) (*ICrossChainCaller, error) { - contract, err := bindICrossChain(address, caller, nil, nil) +// NewICrosschainCaller creates a new read-only instance of ICrosschain, bound to a specific deployed contract. +func NewICrosschainCaller(address common.Address, caller bind.ContractCaller) (*ICrosschainCaller, error) { + contract, err := bindICrosschain(address, caller, nil, nil) if err != nil { return nil, err } - return &ICrossChainCaller{contract: contract}, nil + return &ICrosschainCaller{contract: contract}, nil } -// NewICrossChainTransactor creates a new write-only instance of ICrossChain, bound to a specific deployed contract. -func NewICrossChainTransactor(address common.Address, transactor bind.ContractTransactor) (*ICrossChainTransactor, error) { - contract, err := bindICrossChain(address, nil, transactor, nil) +// NewICrosschainTransactor creates a new write-only instance of ICrosschain, bound to a specific deployed contract. +func NewICrosschainTransactor(address common.Address, transactor bind.ContractTransactor) (*ICrosschainTransactor, error) { + contract, err := bindICrosschain(address, nil, transactor, nil) if err != nil { return nil, err } - return &ICrossChainTransactor{contract: contract}, nil + return &ICrosschainTransactor{contract: contract}, nil } -// NewICrossChainFilterer creates a new log filterer instance of ICrossChain, bound to a specific deployed contract. -func NewICrossChainFilterer(address common.Address, filterer bind.ContractFilterer) (*ICrossChainFilterer, error) { - contract, err := bindICrossChain(address, nil, nil, filterer) +// NewICrosschainFilterer creates a new log filterer instance of ICrosschain, bound to a specific deployed contract. +func NewICrosschainFilterer(address common.Address, filterer bind.ContractFilterer) (*ICrosschainFilterer, error) { + contract, err := bindICrosschain(address, nil, nil, filterer) if err != nil { return nil, err } - return &ICrossChainFilterer{contract: contract}, nil + return &ICrosschainFilterer{contract: contract}, nil } -// bindICrossChain binds a generic wrapper to an already deployed contract. -func bindICrossChain(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ICrossChainMetaData.GetAbi() +// bindICrosschain binds a generic wrapper to an already deployed contract. +func bindICrosschain(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ICrosschainMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindICrossChain(address common.Address, caller bind.ContractCaller, transac // 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 (_ICrossChain *ICrossChainRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ICrossChain.Contract.ICrossChainCaller.contract.Call(opts, result, method, params...) +func (_ICrosschain *ICrosschainRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ICrosschain.Contract.ICrosschainCaller.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 (_ICrossChain *ICrossChainRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ICrossChain.Contract.ICrossChainTransactor.contract.Transfer(opts) +func (_ICrosschain *ICrosschainRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ICrosschain.Contract.ICrosschainTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_ICrossChain *ICrossChainRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ICrossChain.Contract.ICrossChainTransactor.contract.Transact(opts, method, params...) +func (_ICrosschain *ICrosschainRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ICrosschain.Contract.ICrosschainTransactor.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 (_ICrossChain *ICrossChainCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ICrossChain.Contract.contract.Call(opts, result, method, params...) +func (_ICrosschain *ICrosschainCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ICrosschain.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 (_ICrossChain *ICrossChainTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ICrossChain.Contract.contract.Transfer(opts) +func (_ICrosschain *ICrosschainTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ICrosschain.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_ICrossChain *ICrossChainTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ICrossChain.Contract.contract.Transact(opts, method, params...) +func (_ICrosschain *ICrosschainTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ICrosschain.Contract.contract.Transact(opts, method, params...) } // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256 _amount) -func (_ICrossChain *ICrossChainCaller) BridgeCoinAmount(opts *bind.CallOpts, _token common.Address, _target [32]byte) (*big.Int, error) { +func (_ICrosschain *ICrosschainCaller) BridgeCoinAmount(opts *bind.CallOpts, _token common.Address, _target [32]byte) (*big.Int, error) { var out []interface{} - err := _ICrossChain.contract.Call(opts, &out, "bridgeCoinAmount", _token, _target) + err := _ICrosschain.contract.Call(opts, &out, "bridgeCoinAmount", _token, _target) if err != nil { return *new(*big.Int), err @@ -200,23 +200,23 @@ func (_ICrossChain *ICrossChainCaller) BridgeCoinAmount(opts *bind.CallOpts, _to // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256 _amount) -func (_ICrossChain *ICrossChainSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { - return _ICrossChain.Contract.BridgeCoinAmount(&_ICrossChain.CallOpts, _token, _target) +func (_ICrosschain *ICrosschainSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { + return _ICrosschain.Contract.BridgeCoinAmount(&_ICrosschain.CallOpts, _token, _target) } // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256 _amount) -func (_ICrossChain *ICrossChainCallerSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { - return _ICrossChain.Contract.BridgeCoinAmount(&_ICrossChain.CallOpts, _token, _target) +func (_ICrosschain *ICrosschainCallerSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { + return _ICrosschain.Contract.BridgeCoinAmount(&_ICrosschain.CallOpts, _token, _target) } // HasOracle is a free data retrieval call binding the contract method 0x67cfd9d6. // // Solidity: function hasOracle(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainCaller) HasOracle(opts *bind.CallOpts, _chain string, _externalAddress common.Address) (bool, error) { +func (_ICrosschain *ICrosschainCaller) HasOracle(opts *bind.CallOpts, _chain string, _externalAddress common.Address) (bool, error) { var out []interface{} - err := _ICrossChain.contract.Call(opts, &out, "hasOracle", _chain, _externalAddress) + err := _ICrosschain.contract.Call(opts, &out, "hasOracle", _chain, _externalAddress) if err != nil { return *new(bool), err @@ -231,23 +231,23 @@ func (_ICrossChain *ICrossChainCaller) HasOracle(opts *bind.CallOpts, _chain str // HasOracle is a free data retrieval call binding the contract method 0x67cfd9d6. // // Solidity: function hasOracle(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainSession) HasOracle(_chain string, _externalAddress common.Address) (bool, error) { - return _ICrossChain.Contract.HasOracle(&_ICrossChain.CallOpts, _chain, _externalAddress) +func (_ICrosschain *ICrosschainSession) HasOracle(_chain string, _externalAddress common.Address) (bool, error) { + return _ICrosschain.Contract.HasOracle(&_ICrosschain.CallOpts, _chain, _externalAddress) } // HasOracle is a free data retrieval call binding the contract method 0x67cfd9d6. // // Solidity: function hasOracle(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainCallerSession) HasOracle(_chain string, _externalAddress common.Address) (bool, error) { - return _ICrossChain.Contract.HasOracle(&_ICrossChain.CallOpts, _chain, _externalAddress) +func (_ICrosschain *ICrosschainCallerSession) HasOracle(_chain string, _externalAddress common.Address) (bool, error) { + return _ICrosschain.Contract.HasOracle(&_ICrosschain.CallOpts, _chain, _externalAddress) } // IsOracleOnline is a free data retrieval call binding the contract method 0x16c75cfa. // // Solidity: function isOracleOnline(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainCaller) IsOracleOnline(opts *bind.CallOpts, _chain string, _externalAddress common.Address) (bool, error) { +func (_ICrosschain *ICrosschainCaller) IsOracleOnline(opts *bind.CallOpts, _chain string, _externalAddress common.Address) (bool, error) { var out []interface{} - err := _ICrossChain.contract.Call(opts, &out, "isOracleOnline", _chain, _externalAddress) + err := _ICrosschain.contract.Call(opts, &out, "isOracleOnline", _chain, _externalAddress) if err != nil { return *new(bool), err @@ -262,83 +262,83 @@ func (_ICrossChain *ICrossChainCaller) IsOracleOnline(opts *bind.CallOpts, _chai // IsOracleOnline is a free data retrieval call binding the contract method 0x16c75cfa. // // Solidity: function isOracleOnline(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainSession) IsOracleOnline(_chain string, _externalAddress common.Address) (bool, error) { - return _ICrossChain.Contract.IsOracleOnline(&_ICrossChain.CallOpts, _chain, _externalAddress) +func (_ICrosschain *ICrosschainSession) IsOracleOnline(_chain string, _externalAddress common.Address) (bool, error) { + return _ICrosschain.Contract.IsOracleOnline(&_ICrosschain.CallOpts, _chain, _externalAddress) } // IsOracleOnline is a free data retrieval call binding the contract method 0x16c75cfa. // // Solidity: function isOracleOnline(string _chain, address _externalAddress) view returns(bool _result) -func (_ICrossChain *ICrossChainCallerSession) IsOracleOnline(_chain string, _externalAddress common.Address) (bool, error) { - return _ICrossChain.Contract.IsOracleOnline(&_ICrossChain.CallOpts, _chain, _externalAddress) +func (_ICrosschain *ICrosschainCallerSession) IsOracleOnline(_chain string, _externalAddress common.Address) (bool, error) { + return _ICrosschain.Contract.IsOracleOnline(&_ICrosschain.CallOpts, _chain, _externalAddress) } // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // // Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_ICrossChain *ICrossChainTransactor) BridgeCall(opts *bind.TransactOpts, _dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _ICrossChain.contract.Transact(opts, "bridgeCall", _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) +func (_ICrosschain *ICrosschainTransactor) BridgeCall(opts *bind.TransactOpts, _dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { + return _ICrosschain.contract.Transact(opts, "bridgeCall", _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) } // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // // Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_ICrossChain *ICrossChainSession) BridgeCall(_dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _ICrossChain.Contract.BridgeCall(&_ICrossChain.TransactOpts, _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) +func (_ICrosschain *ICrosschainSession) BridgeCall(_dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { + return _ICrosschain.Contract.BridgeCall(&_ICrosschain.TransactOpts, _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) } // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // // Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_ICrossChain *ICrossChainTransactorSession) BridgeCall(_dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _ICrossChain.Contract.BridgeCall(&_ICrossChain.TransactOpts, _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) +func (_ICrosschain *ICrosschainTransactorSession) BridgeCall(_dstChain string, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { + return _ICrosschain.Contract.BridgeCall(&_ICrosschain.TransactOpts, _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool _result) -func (_ICrossChain *ICrossChainTransactor) CrossChain(opts *bind.TransactOpts, _token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _ICrossChain.contract.Transact(opts, "crossChain", _token, _receipt, _amount, _fee, _target, _memo) +func (_ICrosschain *ICrosschainTransactor) CrossChain(opts *bind.TransactOpts, _token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _ICrosschain.contract.Transact(opts, "crossChain", _token, _receipt, _amount, _fee, _target, _memo) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool _result) -func (_ICrossChain *ICrossChainSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _ICrossChain.Contract.CrossChain(&_ICrossChain.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) +func (_ICrosschain *ICrosschainSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _ICrosschain.Contract.CrossChain(&_ICrosschain.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool _result) -func (_ICrossChain *ICrossChainTransactorSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _ICrossChain.Contract.CrossChain(&_ICrossChain.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) +func (_ICrosschain *ICrosschainTransactorSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _ICrosschain.Contract.CrossChain(&_ICrosschain.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) } // ExecuteClaim is a paid mutator transaction binding the contract method 0x4ac3bdc3. // // Solidity: function executeClaim(string _chain, uint256 _eventNonce) returns(bool _result) -func (_ICrossChain *ICrossChainTransactor) ExecuteClaim(opts *bind.TransactOpts, _chain string, _eventNonce *big.Int) (*types.Transaction, error) { - return _ICrossChain.contract.Transact(opts, "executeClaim", _chain, _eventNonce) +func (_ICrosschain *ICrosschainTransactor) ExecuteClaim(opts *bind.TransactOpts, _chain string, _eventNonce *big.Int) (*types.Transaction, error) { + return _ICrosschain.contract.Transact(opts, "executeClaim", _chain, _eventNonce) } // ExecuteClaim is a paid mutator transaction binding the contract method 0x4ac3bdc3. // // Solidity: function executeClaim(string _chain, uint256 _eventNonce) returns(bool _result) -func (_ICrossChain *ICrossChainSession) ExecuteClaim(_chain string, _eventNonce *big.Int) (*types.Transaction, error) { - return _ICrossChain.Contract.ExecuteClaim(&_ICrossChain.TransactOpts, _chain, _eventNonce) +func (_ICrosschain *ICrosschainSession) ExecuteClaim(_chain string, _eventNonce *big.Int) (*types.Transaction, error) { + return _ICrosschain.Contract.ExecuteClaim(&_ICrosschain.TransactOpts, _chain, _eventNonce) } // ExecuteClaim is a paid mutator transaction binding the contract method 0x4ac3bdc3. // // Solidity: function executeClaim(string _chain, uint256 _eventNonce) returns(bool _result) -func (_ICrossChain *ICrossChainTransactorSession) ExecuteClaim(_chain string, _eventNonce *big.Int) (*types.Transaction, error) { - return _ICrossChain.Contract.ExecuteClaim(&_ICrossChain.TransactOpts, _chain, _eventNonce) +func (_ICrosschain *ICrosschainTransactorSession) ExecuteClaim(_chain string, _eventNonce *big.Int) (*types.Transaction, error) { + return _ICrosschain.Contract.ExecuteClaim(&_ICrosschain.TransactOpts, _chain, _eventNonce) } -// ICrossChainBridgeCallEventIterator is returned from FilterBridgeCallEvent and is used to iterate over the raw logs and unpacked data for BridgeCallEvent events raised by the ICrossChain contract. -type ICrossChainBridgeCallEventIterator struct { - Event *ICrossChainBridgeCallEvent // Event containing the contract specifics and raw log +// ICrosschainBridgeCallEventIterator is returned from FilterBridgeCallEvent and is used to iterate over the raw logs and unpacked data for BridgeCallEvent events raised by the ICrosschain contract. +type ICrosschainBridgeCallEventIterator struct { + Event *ICrosschainBridgeCallEvent // 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 @@ -352,7 +352,7 @@ type ICrossChainBridgeCallEventIterator struct { // 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 *ICrossChainBridgeCallEventIterator) Next() bool { +func (it *ICrosschainBridgeCallEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -361,7 +361,7 @@ func (it *ICrossChainBridgeCallEventIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ICrossChainBridgeCallEvent) + it.Event = new(ICrosschainBridgeCallEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -376,7 +376,7 @@ func (it *ICrossChainBridgeCallEventIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ICrossChainBridgeCallEvent) + it.Event = new(ICrosschainBridgeCallEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -392,19 +392,19 @@ func (it *ICrossChainBridgeCallEventIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ICrossChainBridgeCallEventIterator) Error() error { +func (it *ICrosschainBridgeCallEventIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ICrossChainBridgeCallEventIterator) Close() error { +func (it *ICrosschainBridgeCallEventIterator) Close() error { it.sub.Unsubscribe() return nil } -// ICrossChainBridgeCallEvent represents a BridgeCallEvent event raised by the ICrossChain contract. -type ICrossChainBridgeCallEvent struct { +// ICrosschainBridgeCallEvent represents a BridgeCallEvent event raised by the ICrosschain contract. +type ICrosschainBridgeCallEvent struct { Sender common.Address Receiver common.Address To common.Address @@ -422,7 +422,7 @@ type ICrossChainBridgeCallEvent struct { // FilterBridgeCallEvent is a free log retrieval operation binding the contract event 0x4a9b24da6150ef33e7c41038842b7c94fe89a4fff22dccb2c3fd79f0176062c6. // // Solidity: event BridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) -func (_ICrossChain *ICrossChainFilterer) FilterBridgeCallEvent(opts *bind.FilterOpts, _sender []common.Address, _receiver []common.Address, _to []common.Address) (*ICrossChainBridgeCallEventIterator, error) { +func (_ICrosschain *ICrosschainFilterer) FilterBridgeCallEvent(opts *bind.FilterOpts, _sender []common.Address, _receiver []common.Address, _to []common.Address) (*ICrosschainBridgeCallEventIterator, error) { var _senderRule []interface{} for _, _senderItem := range _sender { @@ -437,17 +437,17 @@ func (_ICrossChain *ICrossChainFilterer) FilterBridgeCallEvent(opts *bind.Filter _toRule = append(_toRule, _toItem) } - logs, sub, err := _ICrossChain.contract.FilterLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _ICrosschain.contract.FilterLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) if err != nil { return nil, err } - return &ICrossChainBridgeCallEventIterator{contract: _ICrossChain.contract, event: "BridgeCallEvent", logs: logs, sub: sub}, nil + return &ICrosschainBridgeCallEventIterator{contract: _ICrosschain.contract, event: "BridgeCallEvent", logs: logs, sub: sub}, nil } // WatchBridgeCallEvent is a free log subscription operation binding the contract event 0x4a9b24da6150ef33e7c41038842b7c94fe89a4fff22dccb2c3fd79f0176062c6. // // Solidity: event BridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) -func (_ICrossChain *ICrossChainFilterer) WatchBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *ICrossChainBridgeCallEvent, _sender []common.Address, _receiver []common.Address, _to []common.Address) (event.Subscription, error) { +func (_ICrosschain *ICrosschainFilterer) WatchBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *ICrosschainBridgeCallEvent, _sender []common.Address, _receiver []common.Address, _to []common.Address) (event.Subscription, error) { var _senderRule []interface{} for _, _senderItem := range _sender { @@ -462,7 +462,7 @@ func (_ICrossChain *ICrossChainFilterer) WatchBridgeCallEvent(opts *bind.WatchOp _toRule = append(_toRule, _toItem) } - logs, sub, err := _ICrossChain.contract.WatchLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _ICrosschain.contract.WatchLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) if err != nil { return nil, err } @@ -472,8 +472,8 @@ func (_ICrossChain *ICrossChainFilterer) WatchBridgeCallEvent(opts *bind.WatchOp select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ICrossChainBridgeCallEvent) - if err := _ICrossChain.contract.UnpackLog(event, "BridgeCallEvent", log); err != nil { + event := new(ICrosschainBridgeCallEvent) + if err := _ICrosschain.contract.UnpackLog(event, "BridgeCallEvent", log); err != nil { return err } event.Raw = log @@ -497,18 +497,18 @@ func (_ICrossChain *ICrossChainFilterer) WatchBridgeCallEvent(opts *bind.WatchOp // ParseBridgeCallEvent is a log parse operation binding the contract event 0x4a9b24da6150ef33e7c41038842b7c94fe89a4fff22dccb2c3fd79f0176062c6. // // Solidity: event BridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) -func (_ICrossChain *ICrossChainFilterer) ParseBridgeCallEvent(log types.Log) (*ICrossChainBridgeCallEvent, error) { - event := new(ICrossChainBridgeCallEvent) - if err := _ICrossChain.contract.UnpackLog(event, "BridgeCallEvent", log); err != nil { +func (_ICrosschain *ICrosschainFilterer) ParseBridgeCallEvent(log types.Log) (*ICrosschainBridgeCallEvent, error) { + event := new(ICrosschainBridgeCallEvent) + if err := _ICrosschain.contract.UnpackLog(event, "BridgeCallEvent", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ICrossChainCrossChainIterator is returned from FilterCrossChain and is used to iterate over the raw logs and unpacked data for CrossChain events raised by the ICrossChain contract. -type ICrossChainCrossChainIterator struct { - Event *ICrossChainCrossChain // Event containing the contract specifics and raw log +// ICrosschainCrossChainIterator is returned from FilterCrossChain and is used to iterate over the raw logs and unpacked data for CrossChain events raised by the ICrosschain contract. +type ICrosschainCrossChainIterator struct { + Event *ICrosschainCrossChain // 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 @@ -522,7 +522,7 @@ type ICrossChainCrossChainIterator struct { // 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 *ICrossChainCrossChainIterator) Next() bool { +func (it *ICrosschainCrossChainIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -531,7 +531,7 @@ func (it *ICrossChainCrossChainIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ICrossChainCrossChain) + it.Event = new(ICrosschainCrossChain) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -546,7 +546,7 @@ func (it *ICrossChainCrossChainIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ICrossChainCrossChain) + it.Event = new(ICrosschainCrossChain) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -562,19 +562,19 @@ func (it *ICrossChainCrossChainIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ICrossChainCrossChainIterator) Error() error { +func (it *ICrosschainCrossChainIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ICrossChainCrossChainIterator) Close() error { +func (it *ICrosschainCrossChainIterator) Close() error { it.sub.Unsubscribe() return nil } -// ICrossChainCrossChain represents a CrossChain event raised by the ICrossChain contract. -type ICrossChainCrossChain struct { +// ICrosschainCrossChain represents a CrossChain event raised by the ICrosschain contract. +type ICrosschainCrossChain struct { Sender common.Address Token common.Address Denom string @@ -589,7 +589,7 @@ type ICrossChainCrossChain struct { // FilterCrossChain is a free log retrieval operation binding the contract event 0xb783df819ac99ca709650d67d9237a00b553c6ef941dceabeed6f4bc990d31ba. // // Solidity: event CrossChain(address indexed sender, address indexed token, string denom, string receipt, uint256 amount, uint256 fee, bytes32 target, string memo) -func (_ICrossChain *ICrossChainFilterer) FilterCrossChain(opts *bind.FilterOpts, sender []common.Address, token []common.Address) (*ICrossChainCrossChainIterator, error) { +func (_ICrosschain *ICrosschainFilterer) FilterCrossChain(opts *bind.FilterOpts, sender []common.Address, token []common.Address) (*ICrosschainCrossChainIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -600,17 +600,17 @@ func (_ICrossChain *ICrossChainFilterer) FilterCrossChain(opts *bind.FilterOpts, tokenRule = append(tokenRule, tokenItem) } - logs, sub, err := _ICrossChain.contract.FilterLogs(opts, "CrossChain", senderRule, tokenRule) + logs, sub, err := _ICrosschain.contract.FilterLogs(opts, "CrossChain", senderRule, tokenRule) if err != nil { return nil, err } - return &ICrossChainCrossChainIterator{contract: _ICrossChain.contract, event: "CrossChain", logs: logs, sub: sub}, nil + return &ICrosschainCrossChainIterator{contract: _ICrosschain.contract, event: "CrossChain", logs: logs, sub: sub}, nil } // WatchCrossChain is a free log subscription operation binding the contract event 0xb783df819ac99ca709650d67d9237a00b553c6ef941dceabeed6f4bc990d31ba. // // Solidity: event CrossChain(address indexed sender, address indexed token, string denom, string receipt, uint256 amount, uint256 fee, bytes32 target, string memo) -func (_ICrossChain *ICrossChainFilterer) WatchCrossChain(opts *bind.WatchOpts, sink chan<- *ICrossChainCrossChain, sender []common.Address, token []common.Address) (event.Subscription, error) { +func (_ICrosschain *ICrosschainFilterer) WatchCrossChain(opts *bind.WatchOpts, sink chan<- *ICrosschainCrossChain, sender []common.Address, token []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -621,7 +621,7 @@ func (_ICrossChain *ICrossChainFilterer) WatchCrossChain(opts *bind.WatchOpts, s tokenRule = append(tokenRule, tokenItem) } - logs, sub, err := _ICrossChain.contract.WatchLogs(opts, "CrossChain", senderRule, tokenRule) + logs, sub, err := _ICrosschain.contract.WatchLogs(opts, "CrossChain", senderRule, tokenRule) if err != nil { return nil, err } @@ -631,8 +631,8 @@ func (_ICrossChain *ICrossChainFilterer) WatchCrossChain(opts *bind.WatchOpts, s select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ICrossChainCrossChain) - if err := _ICrossChain.contract.UnpackLog(event, "CrossChain", log); err != nil { + event := new(ICrosschainCrossChain) + if err := _ICrosschain.contract.UnpackLog(event, "CrossChain", log); err != nil { return err } event.Raw = log @@ -656,18 +656,18 @@ func (_ICrossChain *ICrossChainFilterer) WatchCrossChain(opts *bind.WatchOpts, s // ParseCrossChain is a log parse operation binding the contract event 0xb783df819ac99ca709650d67d9237a00b553c6ef941dceabeed6f4bc990d31ba. // // Solidity: event CrossChain(address indexed sender, address indexed token, string denom, string receipt, uint256 amount, uint256 fee, bytes32 target, string memo) -func (_ICrossChain *ICrossChainFilterer) ParseCrossChain(log types.Log) (*ICrossChainCrossChain, error) { - event := new(ICrossChainCrossChain) - if err := _ICrossChain.contract.UnpackLog(event, "CrossChain", log); err != nil { +func (_ICrosschain *ICrosschainFilterer) ParseCrossChain(log types.Log) (*ICrosschainCrossChain, error) { + event := new(ICrosschainCrossChain) + if err := _ICrosschain.contract.UnpackLog(event, "CrossChain", log); err != nil { return nil, err } event.Raw = log return event, nil } -// ICrossChainExecuteClaimEventIterator is returned from FilterExecuteClaimEvent and is used to iterate over the raw logs and unpacked data for ExecuteClaimEvent events raised by the ICrossChain contract. -type ICrossChainExecuteClaimEventIterator struct { - Event *ICrossChainExecuteClaimEvent // Event containing the contract specifics and raw log +// ICrosschainExecuteClaimEventIterator is returned from FilterExecuteClaimEvent and is used to iterate over the raw logs and unpacked data for ExecuteClaimEvent events raised by the ICrosschain contract. +type ICrosschainExecuteClaimEventIterator struct { + Event *ICrosschainExecuteClaimEvent // 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 @@ -681,7 +681,7 @@ type ICrossChainExecuteClaimEventIterator struct { // 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 *ICrossChainExecuteClaimEventIterator) Next() bool { +func (it *ICrosschainExecuteClaimEventIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -690,7 +690,7 @@ func (it *ICrossChainExecuteClaimEventIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ICrossChainExecuteClaimEvent) + it.Event = new(ICrosschainExecuteClaimEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -705,7 +705,7 @@ func (it *ICrossChainExecuteClaimEventIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ICrossChainExecuteClaimEvent) + it.Event = new(ICrosschainExecuteClaimEvent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -721,19 +721,19 @@ func (it *ICrossChainExecuteClaimEventIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ICrossChainExecuteClaimEventIterator) Error() error { +func (it *ICrosschainExecuteClaimEventIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ICrossChainExecuteClaimEventIterator) Close() error { +func (it *ICrosschainExecuteClaimEventIterator) Close() error { it.sub.Unsubscribe() return nil } -// ICrossChainExecuteClaimEvent represents a ExecuteClaimEvent event raised by the ICrossChain contract. -type ICrossChainExecuteClaimEvent struct { +// ICrosschainExecuteClaimEvent represents a ExecuteClaimEvent event raised by the ICrosschain contract. +type ICrosschainExecuteClaimEvent struct { Sender common.Address EventNonce *big.Int Chain string @@ -743,31 +743,31 @@ type ICrossChainExecuteClaimEvent struct { // FilterExecuteClaimEvent is a free log retrieval operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. // // Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) -func (_ICrossChain *ICrossChainFilterer) FilterExecuteClaimEvent(opts *bind.FilterOpts, _sender []common.Address) (*ICrossChainExecuteClaimEventIterator, error) { +func (_ICrosschain *ICrosschainFilterer) FilterExecuteClaimEvent(opts *bind.FilterOpts, _sender []common.Address) (*ICrosschainExecuteClaimEventIterator, error) { var _senderRule []interface{} for _, _senderItem := range _sender { _senderRule = append(_senderRule, _senderItem) } - logs, sub, err := _ICrossChain.contract.FilterLogs(opts, "ExecuteClaimEvent", _senderRule) + logs, sub, err := _ICrosschain.contract.FilterLogs(opts, "ExecuteClaimEvent", _senderRule) if err != nil { return nil, err } - return &ICrossChainExecuteClaimEventIterator{contract: _ICrossChain.contract, event: "ExecuteClaimEvent", logs: logs, sub: sub}, nil + return &ICrosschainExecuteClaimEventIterator{contract: _ICrosschain.contract, event: "ExecuteClaimEvent", logs: logs, sub: sub}, nil } // WatchExecuteClaimEvent is a free log subscription operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. // // Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) -func (_ICrossChain *ICrossChainFilterer) WatchExecuteClaimEvent(opts *bind.WatchOpts, sink chan<- *ICrossChainExecuteClaimEvent, _sender []common.Address) (event.Subscription, error) { +func (_ICrosschain *ICrosschainFilterer) WatchExecuteClaimEvent(opts *bind.WatchOpts, sink chan<- *ICrosschainExecuteClaimEvent, _sender []common.Address) (event.Subscription, error) { var _senderRule []interface{} for _, _senderItem := range _sender { _senderRule = append(_senderRule, _senderItem) } - logs, sub, err := _ICrossChain.contract.WatchLogs(opts, "ExecuteClaimEvent", _senderRule) + logs, sub, err := _ICrosschain.contract.WatchLogs(opts, "ExecuteClaimEvent", _senderRule) if err != nil { return nil, err } @@ -777,8 +777,8 @@ func (_ICrossChain *ICrossChainFilterer) WatchExecuteClaimEvent(opts *bind.Watch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ICrossChainExecuteClaimEvent) - if err := _ICrossChain.contract.UnpackLog(event, "ExecuteClaimEvent", log); err != nil { + event := new(ICrosschainExecuteClaimEvent) + if err := _ICrosschain.contract.UnpackLog(event, "ExecuteClaimEvent", log); err != nil { return err } event.Raw = log @@ -802,9 +802,9 @@ func (_ICrossChain *ICrossChainFilterer) WatchExecuteClaimEvent(opts *bind.Watch // ParseExecuteClaimEvent is a log parse operation binding the contract event 0xa45a8d344c26216c8d81958a3688ec20b5f2e5af820e03433537687e94667a78. // // Solidity: event ExecuteClaimEvent(address indexed _sender, uint256 _eventNonce, string _chain) -func (_ICrossChain *ICrossChainFilterer) ParseExecuteClaimEvent(log types.Log) (*ICrossChainExecuteClaimEvent, error) { - event := new(ICrossChainExecuteClaimEvent) - if err := _ICrossChain.contract.UnpackLog(event, "ExecuteClaimEvent", log); err != nil { +func (_ICrosschain *ICrosschainFilterer) ParseExecuteClaimEvent(log types.Log) (*ICrosschainExecuteClaimEvent, error) { + event := new(ICrosschainExecuteClaimEvent) + if err := _ICrosschain.contract.UnpackLog(event, "ExecuteClaimEvent", log); err != nil { return nil, err } event.Raw = log diff --git a/contract/compile.sh b/contract/compile.sh index a2814f59..d5f4221b 100755 --- a/contract/compile.sh +++ b/contract/compile.sh @@ -31,8 +31,8 @@ echo "===> Compiling contracts" [[ ! -d "$project_dir/contract/artifacts" ]] && mkdir -p "$project_dir/contract/artifacts" # add core contracts -contracts=(WFXUpgradable FIP20Upgradable ICrossChain IStaking IFxBridgeLogic IBridgeCallback IError IBridgeFeeQuote) -contracts_test=(CrossChainTest StakingTest) +contracts=(WFXUpgradable FIP20Upgradable ICrosschain IStaking IFxBridgeLogic IBridgeCallback IError IBridgeFeeQuote) +contracts_test=(CrosschainTest StakingTest) # add 3rd party contracts contracts+=(ERC1967Proxy) contracts_test+=(ERC721TokenTest) diff --git a/contract/contract.go b/contract/contract.go index 55c91a28..dadecdd0 100644 --- a/contract/contract.go +++ b/contract/contract.go @@ -14,7 +14,7 @@ const ( WFXLogicAddress = "0x0000000000000000000000000000000000001002" StakingAddress = "0x0000000000000000000000000000000000001003" - CrossChainAddress = "0x0000000000000000000000000000000000001004" + CrosschainAddress = "0x0000000000000000000000000000000000001004" ) var ( diff --git a/solidity/contracts/bridge/BridgeFeeOracle.sol b/solidity/contracts/bridge/BridgeFeeOracle.sol index 10fc696d..06e50e81 100644 --- a/solidity/contracts/bridge/BridgeFeeOracle.sol +++ b/solidity/contracts/bridge/BridgeFeeOracle.sol @@ -7,7 +7,7 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {EnumerableSetUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import {IBridgeFeeOracle} from "./IBridgeFee.sol"; -import {ICrossChain} from "./ICrossChain.sol"; +import {ICrosschain} from "./ICrosschain.sol"; contract BridgeFeeOracle is IBridgeFeeOracle, @@ -20,7 +20,7 @@ contract BridgeFeeOracle is bytes32 public constant QUOTE_ROLE = keccak256("QUOTE_ROLE"); - address public crossChainContract; + address public crosschainContract; address public defaultOracle; struct State { @@ -36,7 +36,7 @@ contract BridgeFeeOracle is __UUPSUpgradeable_init(); __ReentrancyGuard_init(); - crossChainContract = _crossChain; + crosschainContract = _crossChain; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } @@ -53,11 +53,11 @@ contract BridgeFeeOracle is ) external onlyRole(QUOTE_ROLE) nonReentrant returns (bool) { if (oracleStatus[_oracle].isActive) return true; if (oracleStatus[_oracle].isBlacklisted) return false; - if (!ICrossChain(crossChainContract).hasOracle(_chainName, _oracle)) { + if (!ICrosschain(crosschainContract).hasOracle(_chainName, _oracle)) { return false; } if ( - !ICrossChain(crossChainContract).isOracleOnline(_chainName, _oracle) + !ICrosschain(crosschainContract).isOracleOnline(_chainName, _oracle) ) { return false; } diff --git a/solidity/contracts/bridge/ICrossChain.sol b/solidity/contracts/bridge/ICrosschain.sol similarity index 97% rename from solidity/contracts/bridge/ICrossChain.sol rename to solidity/contracts/bridge/ICrosschain.sol index b4072533..ef14a38b 100644 --- a/solidity/contracts/bridge/ICrossChain.sol +++ b/solidity/contracts/bridge/ICrosschain.sol @@ -6,7 +6,7 @@ import {IBridgeCall} from "./IBridgeCall.sol"; // NOTE: if using an interface to invoke the precompiled contract // need to use solidity version 0.8.10 and later. -interface ICrossChain is IBridgeCall { +interface ICrosschain is IBridgeCall { // Deprecated: please use `IBridgeCall.bridgeCall` function crossChain( address _token, diff --git a/solidity/contracts/test/CrossChainTest.sol b/solidity/contracts/test/CrosschainTest.sol similarity index 90% rename from solidity/contracts/test/CrossChainTest.sol rename to solidity/contracts/test/CrosschainTest.sol index 88925c16..fe5b1bac 100644 --- a/solidity/contracts/test/CrossChainTest.sol +++ b/solidity/contracts/test/CrosschainTest.sol @@ -3,13 +3,13 @@ pragma solidity ^0.8.0; /* solhint-disable no-global-import */ -import "../bridge/ICrossChain.sol"; +import "../bridge/ICrosschain.sol"; import "../fip20/IFIP20Upgradable.sol"; /* solhint-enable no-global-import */ /* solhint-disable custom-errors */ -contract CrossChainTest { +contract CrosschainTest { address public constant CROSS_CHAIN_ADDRESS = address(0x0000000000000000000000000000000000001004); @@ -50,7 +50,7 @@ contract CrossChainTest { } return - ICrossChain(CROSS_CHAIN_ADDRESS).crossChain{value: msg.value}( + ICrosschain(CROSS_CHAIN_ADDRESS).crossChain{value: msg.value}( _token, _receipt, _amount, @@ -65,7 +65,7 @@ contract CrossChainTest { bytes32 _target ) external view returns (uint256) { return - ICrossChain(CROSS_CHAIN_ADDRESS).bridgeCoinAmount(_token, _target); + ICrosschain(CROSS_CHAIN_ADDRESS).bridgeCoinAmount(_token, _target); } function bridgeCall( @@ -79,7 +79,7 @@ contract CrossChainTest { bytes memory _memo ) internal returns (uint256) { return - ICrossChain(CROSS_CHAIN_ADDRESS).bridgeCall( + ICrosschain(CROSS_CHAIN_ADDRESS).bridgeCall( _dstChain, _receiver, _tokens, diff --git a/tests/contract/CrossChainTest.go b/tests/contract/CrosschainTest.go similarity index 65% rename from tests/contract/CrossChainTest.go rename to tests/contract/CrosschainTest.go index 9bc543ee..201745ef 100644 --- a/tests/contract/CrossChainTest.go +++ b/tests/contract/CrosschainTest.go @@ -29,23 +29,23 @@ var ( _ = abi.ConvertType ) -// CrossChainTestMetaData contains all meta data concerning the CrossChainTest contract. -var CrossChainTestMetaData = &bind.MetaData{ +// CrosschainTestMetaData contains all meta data concerning the CrosschainTest contract. +var CrosschainTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"name\":\"CROSS_CHAIN_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"}],\"name\":\"bridgeCoinAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_receipt\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_target\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"_memo\",\"type\":\"string\"}],\"name\":\"crossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b506106da806100206000396000f3fe6080604052600436106100345760003560e01c8063160d7c73146100395780638fefb76514610061578063f73564751461008f575b600080fd5b61004c6100473660046104e7565b6100bd565b60405190151581526020015b60405180910390f35b34801561006d57600080fd5b5061008161007c366004610577565b6103ad565b604051908152602001610058565b34801561009b57600080fd5b506100a561100481565b6040516001600160a01b039091168152602001610058565b60006001600160a01b038716156101ef576001600160a01b0387166323b872dd33306100e9888a6105a1565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561013d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061016191906105c7565b506001600160a01b03871663095ea7b361100461017e87896105a1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156101c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ed91906105c7565b505b6001600160a01b038716156102d657604051636eb1769f60e11b815230600482015261100460248201526000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa15801561024d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027191906105e9565b905061027d85876105a1565b81146102d05760405162461bcd60e51b815260206004820181905260248201527f616c6c6f77616e6365206e6f7420657175616c20616d6f756e74202b2066656560448201526064015b60405180910390fd5b5061032e565b6102e084866105a1565b341461032e5760405162461bcd60e51b815260206004820181905260248201527f6d73672e76616c7565206e6f7420657175616c20616d6f756e74202b2066656560448201526064016102c7565b60405163160d7c7360e01b81526110049063160d7c7390349061035f908b908b908b908b908b908b9060040161064f565b60206040518083038185885af115801561037d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906103a291906105c7565b979650505050505050565b604051638fefb76560e01b81526001600160a01b03831660048201526024810182905260009061100490638fefb76590604401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042191906105e9565b9392505050565b80356001600160a01b038116811461043f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261046b57600080fd5b813567ffffffffffffffff8082111561048657610486610444565b604051601f8301601f19908116603f011681019082821181831017156104ae576104ae610444565b816040528381528660208588010111156104c757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561050057600080fd5b61050987610428565b9550602087013567ffffffffffffffff8082111561052657600080fd5b6105328a838b0161045a565b965060408901359550606089013594506080890135935060a089013591508082111561055d57600080fd5b5061056a89828a0161045a565b9150509295509295509295565b6000806040838503121561058a57600080fd5b61059383610428565b946020939093013593505050565b600082198211156105c257634e487b7160e01b600052601160045260246000fd5b500190565b6000602082840312156105d957600080fd5b8151801515811461042157600080fd5b6000602082840312156105fb57600080fd5b5051919050565b6000815180845260005b818110156106285760208185018101518683018201520161060c565b8181111561063a576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038716815260c06020820181905260009061067390830188610602565b86604084015285606084015284608084015282810360a08401526106978185610602565b999850505050505050505056fea2646970667358221220a7820ef250f22731ab00f08d0d3f7a29e1d9270f6947e9ea594e944b105882e964736f6c634300080a0033", + Bin: "0x608060405234801561001057600080fd5b506106da806100206000396000f3fe6080604052600436106100345760003560e01c8063160d7c73146100395780638fefb76514610061578063f73564751461008f575b600080fd5b61004c6100473660046104e7565b6100bd565b60405190151581526020015b60405180910390f35b34801561006d57600080fd5b5061008161007c366004610577565b6103ad565b604051908152602001610058565b34801561009b57600080fd5b506100a561100481565b6040516001600160a01b039091168152602001610058565b60006001600160a01b038716156101ef576001600160a01b0387166323b872dd33306100e9888a6105a1565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561013d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061016191906105c7565b506001600160a01b03871663095ea7b361100461017e87896105a1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156101c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ed91906105c7565b505b6001600160a01b038716156102d657604051636eb1769f60e11b815230600482015261100460248201526000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa15801561024d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027191906105e9565b905061027d85876105a1565b81146102d05760405162461bcd60e51b815260206004820181905260248201527f616c6c6f77616e6365206e6f7420657175616c20616d6f756e74202b2066656560448201526064015b60405180910390fd5b5061032e565b6102e084866105a1565b341461032e5760405162461bcd60e51b815260206004820181905260248201527f6d73672e76616c7565206e6f7420657175616c20616d6f756e74202b2066656560448201526064016102c7565b60405163160d7c7360e01b81526110049063160d7c7390349061035f908b908b908b908b908b908b9060040161064f565b60206040518083038185885af115801561037d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906103a291906105c7565b979650505050505050565b604051638fefb76560e01b81526001600160a01b03831660048201526024810182905260009061100490638fefb76590604401602060405180830381865afa1580156103fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042191906105e9565b9392505050565b80356001600160a01b038116811461043f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261046b57600080fd5b813567ffffffffffffffff8082111561048657610486610444565b604051601f8301601f19908116603f011681019082821181831017156104ae576104ae610444565b816040528381528660208588010111156104c757600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c0878903121561050057600080fd5b61050987610428565b9550602087013567ffffffffffffffff8082111561052657600080fd5b6105328a838b0161045a565b965060408901359550606089013594506080890135935060a089013591508082111561055d57600080fd5b5061056a89828a0161045a565b9150509295509295509295565b6000806040838503121561058a57600080fd5b61059383610428565b946020939093013593505050565b600082198211156105c257634e487b7160e01b600052601160045260246000fd5b500190565b6000602082840312156105d957600080fd5b8151801515811461042157600080fd5b6000602082840312156105fb57600080fd5b5051919050565b6000815180845260005b818110156106285760208185018101518683018201520161060c565b8181111561063a576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038716815260c06020820181905260009061067390830188610602565b86604084015285606084015284608084015282810360a08401526106978185610602565b999850505050505050505056fea264697066735822122032822efe1934dbbd11740dc0521e081e4634dd80a640db9f325cf8d131416f0664736f6c634300080a0033", } -// CrossChainTestABI is the input ABI used to generate the binding from. -// Deprecated: Use CrossChainTestMetaData.ABI instead. -var CrossChainTestABI = CrossChainTestMetaData.ABI +// CrosschainTestABI is the input ABI used to generate the binding from. +// Deprecated: Use CrosschainTestMetaData.ABI instead. +var CrosschainTestABI = CrosschainTestMetaData.ABI -// CrossChainTestBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use CrossChainTestMetaData.Bin instead. -var CrossChainTestBin = CrossChainTestMetaData.Bin +// CrosschainTestBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use CrosschainTestMetaData.Bin instead. +var CrosschainTestBin = CrosschainTestMetaData.Bin -// DeployCrossChainTest deploys a new Ethereum contract, binding an instance of CrossChainTest to it. -func DeployCrossChainTest(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CrossChainTest, error) { - parsed, err := CrossChainTestMetaData.GetAbi() +// DeployCrosschainTest deploys a new Ethereum contract, binding an instance of CrosschainTest to it. +func DeployCrosschainTest(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CrosschainTest, error) { + parsed, err := CrosschainTestMetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err } @@ -53,111 +53,111 @@ func DeployCrossChainTest(auth *bind.TransactOpts, backend bind.ContractBackend) return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CrossChainTestBin), backend) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CrosschainTestBin), backend) if err != nil { return common.Address{}, nil, nil, err } - return address, tx, &CrossChainTest{CrossChainTestCaller: CrossChainTestCaller{contract: contract}, CrossChainTestTransactor: CrossChainTestTransactor{contract: contract}, CrossChainTestFilterer: CrossChainTestFilterer{contract: contract}}, nil + return address, tx, &CrosschainTest{CrosschainTestCaller: CrosschainTestCaller{contract: contract}, CrosschainTestTransactor: CrosschainTestTransactor{contract: contract}, CrosschainTestFilterer: CrosschainTestFilterer{contract: contract}}, nil } -// CrossChainTest is an auto generated Go binding around an Ethereum contract. -type CrossChainTest struct { - CrossChainTestCaller // Read-only binding to the contract - CrossChainTestTransactor // Write-only binding to the contract - CrossChainTestFilterer // Log filterer for contract events +// CrosschainTest is an auto generated Go binding around an Ethereum contract. +type CrosschainTest struct { + CrosschainTestCaller // Read-only binding to the contract + CrosschainTestTransactor // Write-only binding to the contract + CrosschainTestFilterer // Log filterer for contract events } -// CrossChainTestCaller is an auto generated read-only Go binding around an Ethereum contract. -type CrossChainTestCaller struct { +// CrosschainTestCaller is an auto generated read-only Go binding around an Ethereum contract. +type CrosschainTestCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// CrossChainTestTransactor is an auto generated write-only Go binding around an Ethereum contract. -type CrossChainTestTransactor struct { +// CrosschainTestTransactor is an auto generated write-only Go binding around an Ethereum contract. +type CrosschainTestTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// CrossChainTestFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type CrossChainTestFilterer struct { +// CrosschainTestFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type CrosschainTestFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// CrossChainTestSession is an auto generated Go binding around an Ethereum contract, +// CrosschainTestSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type CrossChainTestSession struct { - Contract *CrossChainTest // Generic contract binding to set the session for +type CrosschainTestSession struct { + Contract *CrosschainTest // 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 } -// CrossChainTestCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// CrosschainTestCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type CrossChainTestCallerSession struct { - Contract *CrossChainTestCaller // Generic contract caller binding to set the session for +type CrosschainTestCallerSession struct { + Contract *CrosschainTestCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// CrossChainTestTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// CrosschainTestTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type CrossChainTestTransactorSession struct { - Contract *CrossChainTestTransactor // Generic contract transactor binding to set the session for +type CrosschainTestTransactorSession struct { + Contract *CrosschainTestTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// CrossChainTestRaw is an auto generated low-level Go binding around an Ethereum contract. -type CrossChainTestRaw struct { - Contract *CrossChainTest // Generic contract binding to access the raw methods on +// CrosschainTestRaw is an auto generated low-level Go binding around an Ethereum contract. +type CrosschainTestRaw struct { + Contract *CrosschainTest // Generic contract binding to access the raw methods on } -// CrossChainTestCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type CrossChainTestCallerRaw struct { - Contract *CrossChainTestCaller // Generic read-only contract binding to access the raw methods on +// CrosschainTestCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type CrosschainTestCallerRaw struct { + Contract *CrosschainTestCaller // Generic read-only contract binding to access the raw methods on } -// CrossChainTestTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type CrossChainTestTransactorRaw struct { - Contract *CrossChainTestTransactor // Generic write-only contract binding to access the raw methods on +// CrosschainTestTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type CrosschainTestTransactorRaw struct { + Contract *CrosschainTestTransactor // Generic write-only contract binding to access the raw methods on } -// NewCrossChainTest creates a new instance of CrossChainTest, bound to a specific deployed contract. -func NewCrossChainTest(address common.Address, backend bind.ContractBackend) (*CrossChainTest, error) { - contract, err := bindCrossChainTest(address, backend, backend, backend) +// NewCrosschainTest creates a new instance of CrosschainTest, bound to a specific deployed contract. +func NewCrosschainTest(address common.Address, backend bind.ContractBackend) (*CrosschainTest, error) { + contract, err := bindCrosschainTest(address, backend, backend, backend) if err != nil { return nil, err } - return &CrossChainTest{CrossChainTestCaller: CrossChainTestCaller{contract: contract}, CrossChainTestTransactor: CrossChainTestTransactor{contract: contract}, CrossChainTestFilterer: CrossChainTestFilterer{contract: contract}}, nil + return &CrosschainTest{CrosschainTestCaller: CrosschainTestCaller{contract: contract}, CrosschainTestTransactor: CrosschainTestTransactor{contract: contract}, CrosschainTestFilterer: CrosschainTestFilterer{contract: contract}}, nil } -// NewCrossChainTestCaller creates a new read-only instance of CrossChainTest, bound to a specific deployed contract. -func NewCrossChainTestCaller(address common.Address, caller bind.ContractCaller) (*CrossChainTestCaller, error) { - contract, err := bindCrossChainTest(address, caller, nil, nil) +// NewCrosschainTestCaller creates a new read-only instance of CrosschainTest, bound to a specific deployed contract. +func NewCrosschainTestCaller(address common.Address, caller bind.ContractCaller) (*CrosschainTestCaller, error) { + contract, err := bindCrosschainTest(address, caller, nil, nil) if err != nil { return nil, err } - return &CrossChainTestCaller{contract: contract}, nil + return &CrosschainTestCaller{contract: contract}, nil } -// NewCrossChainTestTransactor creates a new write-only instance of CrossChainTest, bound to a specific deployed contract. -func NewCrossChainTestTransactor(address common.Address, transactor bind.ContractTransactor) (*CrossChainTestTransactor, error) { - contract, err := bindCrossChainTest(address, nil, transactor, nil) +// NewCrosschainTestTransactor creates a new write-only instance of CrosschainTest, bound to a specific deployed contract. +func NewCrosschainTestTransactor(address common.Address, transactor bind.ContractTransactor) (*CrosschainTestTransactor, error) { + contract, err := bindCrosschainTest(address, nil, transactor, nil) if err != nil { return nil, err } - return &CrossChainTestTransactor{contract: contract}, nil + return &CrosschainTestTransactor{contract: contract}, nil } -// NewCrossChainTestFilterer creates a new log filterer instance of CrossChainTest, bound to a specific deployed contract. -func NewCrossChainTestFilterer(address common.Address, filterer bind.ContractFilterer) (*CrossChainTestFilterer, error) { - contract, err := bindCrossChainTest(address, nil, nil, filterer) +// NewCrosschainTestFilterer creates a new log filterer instance of CrosschainTest, bound to a specific deployed contract. +func NewCrosschainTestFilterer(address common.Address, filterer bind.ContractFilterer) (*CrosschainTestFilterer, error) { + contract, err := bindCrosschainTest(address, nil, nil, filterer) if err != nil { return nil, err } - return &CrossChainTestFilterer{contract: contract}, nil + return &CrosschainTestFilterer{contract: contract}, nil } -// bindCrossChainTest binds a generic wrapper to an already deployed contract. -func bindCrossChainTest(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := CrossChainTestMetaData.GetAbi() +// bindCrosschainTest binds a generic wrapper to an already deployed contract. +func bindCrosschainTest(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := CrosschainTestMetaData.GetAbi() if err != nil { return nil, err } @@ -168,46 +168,46 @@ func bindCrossChainTest(address common.Address, caller bind.ContractCaller, tran // 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 (_CrossChainTest *CrossChainTestRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CrossChainTest.Contract.CrossChainTestCaller.contract.Call(opts, result, method, params...) +func (_CrosschainTest *CrosschainTestRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _CrosschainTest.Contract.CrosschainTestCaller.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 (_CrossChainTest *CrossChainTestRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CrossChainTest.Contract.CrossChainTestTransactor.contract.Transfer(opts) +func (_CrosschainTest *CrosschainTestRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CrosschainTest.Contract.CrosschainTestTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_CrossChainTest *CrossChainTestRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CrossChainTest.Contract.CrossChainTestTransactor.contract.Transact(opts, method, params...) +func (_CrosschainTest *CrosschainTestRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CrosschainTest.Contract.CrosschainTestTransactor.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 (_CrossChainTest *CrossChainTestCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _CrossChainTest.Contract.contract.Call(opts, result, method, params...) +func (_CrosschainTest *CrosschainTestCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _CrosschainTest.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 (_CrossChainTest *CrossChainTestTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _CrossChainTest.Contract.contract.Transfer(opts) +func (_CrosschainTest *CrosschainTestTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _CrosschainTest.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_CrossChainTest *CrossChainTestTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _CrossChainTest.Contract.contract.Transact(opts, method, params...) +func (_CrosschainTest *CrosschainTestTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _CrosschainTest.Contract.contract.Transact(opts, method, params...) } // CROSSCHAINADDRESS is a free data retrieval call binding the contract method 0xf7356475. // // Solidity: function CROSS_CHAIN_ADDRESS() view returns(address) -func (_CrossChainTest *CrossChainTestCaller) CROSSCHAINADDRESS(opts *bind.CallOpts) (common.Address, error) { +func (_CrosschainTest *CrosschainTestCaller) CROSSCHAINADDRESS(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _CrossChainTest.contract.Call(opts, &out, "CROSS_CHAIN_ADDRESS") + err := _CrosschainTest.contract.Call(opts, &out, "CROSS_CHAIN_ADDRESS") if err != nil { return *new(common.Address), err @@ -222,23 +222,23 @@ func (_CrossChainTest *CrossChainTestCaller) CROSSCHAINADDRESS(opts *bind.CallOp // CROSSCHAINADDRESS is a free data retrieval call binding the contract method 0xf7356475. // // Solidity: function CROSS_CHAIN_ADDRESS() view returns(address) -func (_CrossChainTest *CrossChainTestSession) CROSSCHAINADDRESS() (common.Address, error) { - return _CrossChainTest.Contract.CROSSCHAINADDRESS(&_CrossChainTest.CallOpts) +func (_CrosschainTest *CrosschainTestSession) CROSSCHAINADDRESS() (common.Address, error) { + return _CrosschainTest.Contract.CROSSCHAINADDRESS(&_CrosschainTest.CallOpts) } // CROSSCHAINADDRESS is a free data retrieval call binding the contract method 0xf7356475. // // Solidity: function CROSS_CHAIN_ADDRESS() view returns(address) -func (_CrossChainTest *CrossChainTestCallerSession) CROSSCHAINADDRESS() (common.Address, error) { - return _CrossChainTest.Contract.CROSSCHAINADDRESS(&_CrossChainTest.CallOpts) +func (_CrosschainTest *CrosschainTestCallerSession) CROSSCHAINADDRESS() (common.Address, error) { + return _CrosschainTest.Contract.CROSSCHAINADDRESS(&_CrosschainTest.CallOpts) } // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256) -func (_CrossChainTest *CrossChainTestCaller) BridgeCoinAmount(opts *bind.CallOpts, _token common.Address, _target [32]byte) (*big.Int, error) { +func (_CrosschainTest *CrosschainTestCaller) BridgeCoinAmount(opts *bind.CallOpts, _token common.Address, _target [32]byte) (*big.Int, error) { var out []interface{} - err := _CrossChainTest.contract.Call(opts, &out, "bridgeCoinAmount", _token, _target) + err := _CrosschainTest.contract.Call(opts, &out, "bridgeCoinAmount", _token, _target) if err != nil { return *new(*big.Int), err @@ -253,34 +253,34 @@ func (_CrossChainTest *CrossChainTestCaller) BridgeCoinAmount(opts *bind.CallOpt // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256) -func (_CrossChainTest *CrossChainTestSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { - return _CrossChainTest.Contract.BridgeCoinAmount(&_CrossChainTest.CallOpts, _token, _target) +func (_CrosschainTest *CrosschainTestSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { + return _CrosschainTest.Contract.BridgeCoinAmount(&_CrosschainTest.CallOpts, _token, _target) } // BridgeCoinAmount is a free data retrieval call binding the contract method 0x8fefb765. // // Solidity: function bridgeCoinAmount(address _token, bytes32 _target) view returns(uint256) -func (_CrossChainTest *CrossChainTestCallerSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { - return _CrossChainTest.Contract.BridgeCoinAmount(&_CrossChainTest.CallOpts, _token, _target) +func (_CrosschainTest *CrosschainTestCallerSession) BridgeCoinAmount(_token common.Address, _target [32]byte) (*big.Int, error) { + return _CrosschainTest.Contract.BridgeCoinAmount(&_CrosschainTest.CallOpts, _token, _target) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool) -func (_CrossChainTest *CrossChainTestTransactor) CrossChain(opts *bind.TransactOpts, _token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _CrossChainTest.contract.Transact(opts, "crossChain", _token, _receipt, _amount, _fee, _target, _memo) +func (_CrosschainTest *CrosschainTestTransactor) CrossChain(opts *bind.TransactOpts, _token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _CrosschainTest.contract.Transact(opts, "crossChain", _token, _receipt, _amount, _fee, _target, _memo) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool) -func (_CrossChainTest *CrossChainTestSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _CrossChainTest.Contract.CrossChain(&_CrossChainTest.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) +func (_CrosschainTest *CrosschainTestSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _CrosschainTest.Contract.CrossChain(&_CrosschainTest.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) } // CrossChain is a paid mutator transaction binding the contract method 0x160d7c73. // // Solidity: function crossChain(address _token, string _receipt, uint256 _amount, uint256 _fee, bytes32 _target, string _memo) payable returns(bool) -func (_CrossChainTest *CrossChainTestTransactorSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { - return _CrossChainTest.Contract.CrossChain(&_CrossChainTest.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) +func (_CrosschainTest *CrosschainTestTransactorSession) CrossChain(_token common.Address, _receipt string, _amount *big.Int, _fee *big.Int, _target [32]byte, _memo string) (*types.Transaction, error) { + return _CrosschainTest.Contract.CrossChain(&_CrosschainTest.TransactOpts, _token, _receipt, _amount, _fee, _target, _memo) } diff --git a/tests/precompile_suite.go b/tests/precompile_suite.go index 57007624..769bc2dd 100644 --- a/tests/precompile_suite.go +++ b/tests/precompile_suite.go @@ -50,13 +50,13 @@ func (suite *PrecompileTestSuite) TransferCrossChain(token common.Address, recip func (suite *PrecompileTestSuite) CrossChainAndResponse(token common.Address, recipient string, amount, fee *big.Int, target string) *ethtypes.Transaction { privateKey := suite.privKey - crossChainContract := crosschaintypes.GetAddress() - suite.ApproveERC20(privateKey, token, crossChainContract, big.NewInt(0).Add(amount, fee)) + crosschainContract := crosschaintypes.GetAddress() + suite.ApproveERC20(privateKey, token, crosschainContract, big.NewInt(0).Add(amount, fee)) beforeBalanceOf := suite.BalanceOf(token, common.BytesToAddress(privateKey.PubKey().Address().Bytes())) pack, err := crosschaintypes.GetABI().Pack("crossChain", token, recipient, amount, fee, fxtypes.MustStrToByte32(target), "") suite.Require().NoError(err) - ethTx, err := client.BuildEthTransaction(suite.ctx, suite.EthClient(), privateKey, &crossChainContract, nil, pack) + ethTx, err := client.BuildEthTransaction(suite.ctx, suite.EthClient(), privateKey, &crosschainContract, nil, pack) suite.Require().NoError(err, target) suite.SendTransaction(ethTx) afterBalanceOf := suite.BalanceOf(token, common.BytesToAddress(privateKey.PubKey().Address().Bytes())) diff --git a/x/crosschain/keeper/bridge_call_out.go b/x/crosschain/keeper/bridge_call_out.go index a1b0cbf7..2be5feea 100644 --- a/x/crosschain/keeper/bridge_call_out.go +++ b/x/crosschain/keeper/bridge_call_out.go @@ -276,7 +276,7 @@ func (k Keeper) BridgeCallBaseCoin( return k.AddOutgoingBridgeCall(ctx, from, refund, coins, to, data, memo, 0) } -func (k Keeper) CrossChainBaseCoin( +func (k Keeper) CrosschainBaseCoin( ctx sdk.Context, from sdk.AccAddress, receipt string, diff --git a/x/crosschain/keeper/keeper_router.go b/x/crosschain/keeper/keeper_router.go index bd2b7551..4a9eb383 100644 --- a/x/crosschain/keeper/keeper_router.go +++ b/x/crosschain/keeper/keeper_router.go @@ -14,7 +14,7 @@ type RouterKeeper struct { router Router } -// NewRouterKeeper returns a new instance of the cross chain keeper +// NewRouterKeeper returns a new instance of the crosschain keeper func NewRouterKeeper(rtr Router) RouterKeeper { rtr.Seal() diff --git a/x/crosschain/keeper/keeper_test.go b/x/crosschain/keeper/keeper_test.go index ab2d6e87..ba67af82 100644 --- a/x/crosschain/keeper/keeper_test.go +++ b/x/crosschain/keeper/keeper_test.go @@ -128,7 +128,7 @@ func (s *KeeperMockSuite) SetupTest() { s.queryClient = types.NewQueryClient(queryHelper) s.msgServer = crosschainkeeper.NewMsgServerRouterImpl(crosschainRouterKeeper) - params := s.CrossChainParams() + params := s.CrosschainParams() params.EnableSendToExternalPending = true s.NoError(s.crosschainKeeper.SetParams(s.ctx, ¶ms)) } @@ -137,7 +137,7 @@ func (s *KeeperMockSuite) SetupSubTest() { s.SetupTest() } -func (s *KeeperMockSuite) CrossChainParams() types.Params { +func (s *KeeperMockSuite) CrosschainParams() types.Params { switch s.moduleName { case ethtypes.ModuleName: return ethtypes.DefaultGenesisState().Params diff --git a/x/crosschain/keeper/many_to_one.go b/x/crosschain/keeper/many_to_one.go index de83800a..abc56f10 100644 --- a/x/crosschain/keeper/many_to_one.go +++ b/x/crosschain/keeper/many_to_one.go @@ -158,9 +158,9 @@ func (k Keeper) IBCCoinRefund(ctx sdk.Context, holder sdk.AccAddress, ibcCoin sd return k.erc20Keeper.DeleteCache(ctx, ibcTransferKey) } -func (k Keeper) AfterIBCAckSuccess(ctx sdk.Context, ibcChannel string, ibcSequence uint64) { +func (k Keeper) AfterIBCAckSuccess(ctx sdk.Context, ibcChannel string, ibcSequence uint64) error { ibcTransferKey := types.NewIBCTransferKey(ibcChannel, ibcSequence) - _ = k.erc20Keeper.DeleteCache(ctx, ibcTransferKey) // todo: need to handle error + return k.erc20Keeper.DeleteCache(ctx, ibcTransferKey) } func (k Keeper) GetBridgeToken(ctx context.Context, tokenAddr string) (erc20types.BridgeToken, error) { diff --git a/x/crosschain/keeper/msg_server_router.go b/x/crosschain/keeper/msg_server_router.go index 8586e90f..48343fbc 100644 --- a/x/crosschain/keeper/msg_server_router.go +++ b/x/crosschain/keeper/msg_server_router.go @@ -119,7 +119,7 @@ func (k msgServer) UpdateChainOracles(ctx context.Context, msg *types.MsgUpdateC func (k msgServer) getMsgServerByChainName(chainName string) (types.MsgServer, error) { msgServerRouter := k.routerKeeper.Router() if !msgServerRouter.HasRoute(chainName) { - return nil, sdkerrors.ErrInvalidRequest.Wrapf("Unrecognized cross chain type:%s", chainName) + return nil, sdkerrors.ErrInvalidRequest.Wrapf("Unrecognized crosschain type:%s", chainName) } return msgServerRouter.GetRoute(chainName).MsgServer, nil } diff --git a/x/crosschain/precompile/bridge_call_test.go b/x/crosschain/precompile/bridge_call_test.go index 27df89ab..23762b66 100644 --- a/x/crosschain/precompile/bridge_call_test.go +++ b/x/crosschain/precompile/bridge_call_test.go @@ -107,7 +107,7 @@ func TestContract_BridgeCall_Event(t *testing.T) { } inputs := bridgeCall.Event.Inputs - args := contract.ICrossChainBridgeCallEvent{ + args := contract.ICrosschainBridgeCallEvent{ TxOrigin: helpers.GenHexAddress(), Value: big.NewInt(1), EventNonce: big.NewInt(1), @@ -138,7 +138,7 @@ func TestContract_BridgeCall_Event(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, inputValue) - var args2 contract.ICrossChainBridgeCallEvent + var args2 contract.ICrosschainBridgeCallEvent err = inputs.Copy(&args2, inputValue) assert.NoError(t, err) assert.EqualValues(t, args, args2) diff --git a/x/crosschain/precompile/contract.go b/x/crosschain/precompile/contract.go index 24530ece..be41e84e 100644 --- a/x/crosschain/precompile/contract.go +++ b/x/crosschain/precompile/contract.go @@ -34,7 +34,7 @@ func NewPrecompiledContract( NewHasOracleMethod(keeper), NewIsOracleOnlineMethod(keeper), - NewCrossChainMethod(keeper), + NewCrosschainMethod(keeper), NewBridgeCallMethod(keeper), NewExecuteClaimMethod(keeper), }, diff --git a/x/crosschain/precompile/contract_test.go b/x/crosschain/precompile/contract_test.go index caeb8819..a00be2ce 100644 --- a/x/crosschain/precompile/contract_test.go +++ b/x/crosschain/precompile/contract_test.go @@ -56,7 +56,7 @@ func (suite *PrecompileTestSuite) SetupTest() { suite.signer = suite.AddTestSigner(10_000) - crosschainContract, err := suite.App.EvmKeeper.DeployContract(suite.Ctx, suite.signer.Address(), contract.MustABIJson(testscontract.CrossChainTestMetaData.ABI), contract.MustDecodeHex(testscontract.CrossChainTestMetaData.Bin)) + crosschainContract, err := suite.App.EvmKeeper.DeployContract(suite.Ctx, suite.signer.Address(), contract.MustABIJson(testscontract.CrosschainTestMetaData.ABI), contract.MustDecodeHex(testscontract.CrosschainTestMetaData.Bin)) suite.Require().NoError(err) suite.crosschain = crosschainContract } @@ -113,8 +113,8 @@ func (suite *PrecompileTestSuite) RandSigner() *helpers.Signer { return signer } -func (suite *PrecompileTestSuite) CrossChainKeepers() map[string]crosschainkeeper.Keeper { - value := reflect.ValueOf(suite.App.CrossChainKeepers) +func (suite *PrecompileTestSuite) CrosschainKeepers() map[string]crosschainkeeper.Keeper { + value := reflect.ValueOf(suite.App.CrosschainKeepers) keepers := make(map[string]crosschainkeeper.Keeper) for i := 0; i < value.NumField(); i++ { res := value.Field(i).MethodByName("GetGravityID").Call([]reflect.Value{reflect.ValueOf(suite.Ctx)}) @@ -130,7 +130,7 @@ func (suite *PrecompileTestSuite) CrossChainKeepers() map[string]crosschainkeepe } func (suite *PrecompileTestSuite) GenerateModuleName() string { - keepers := suite.CrossChainKeepers() + keepers := suite.CrosschainKeepers() modules := make([]string, 0, len(keepers)) for m := range keepers { modules = append(modules, m) @@ -142,7 +142,7 @@ func (suite *PrecompileTestSuite) GenerateModuleName() string { } func (suite *PrecompileTestSuite) GenerateOracles(moduleName string, online bool, num int) []Oracle { - keeper := suite.CrossChainKeepers()[moduleName] + keeper := suite.CrosschainKeepers()[moduleName] oracles := make([]Oracle, 0, num) for i := 0; i < num; i++ { oracle := crosschaintypes.Oracle{ diff --git a/x/crosschain/precompile/crosschain.go b/x/crosschain/precompile/crosschain.go index f9e7b1e4..fa11297c 100644 --- a/x/crosschain/precompile/crosschain.go +++ b/x/crosschain/precompile/crosschain.go @@ -17,34 +17,34 @@ import ( ) // Deprecated: please use BridgeCallMethod -type CrossChainMethod struct { +type CrosschainMethod struct { *Keeper abi.Method abi.Event } // Deprecated: please use BridgeCallMethod -func NewCrossChainMethod(keeper *Keeper) *CrossChainMethod { - return &CrossChainMethod{ +func NewCrosschainMethod(keeper *Keeper) *CrosschainMethod { + return &CrosschainMethod{ Keeper: keeper, Method: crosschaintypes.GetABI().Methods["crossChain"], Event: crosschaintypes.GetABI().Events["CrossChain"], } } -func (m *CrossChainMethod) IsReadonly() bool { +func (m *CrosschainMethod) IsReadonly() bool { return false } -func (m *CrossChainMethod) GetMethodId() []byte { +func (m *CrosschainMethod) GetMethodId() []byte { return m.Method.ID } -func (m *CrossChainMethod) RequiredGas() uint64 { +func (m *CrosschainMethod) RequiredGas() uint64 { return 40_000 } -func (m *CrossChainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error) { +func (m *CrosschainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, error) { args, err := m.UnpackInput(contract.Input) if err != nil { return nil, err @@ -92,12 +92,12 @@ func (m *CrossChainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, erro amountCoin := sdk.NewCoin(baseCoin.Denom, sdkmath.NewIntFromBigInt(args.Amount)) feeCoin := sdk.NewCoin(baseCoin.Denom, sdkmath.NewIntFromBigInt(args.Fee)) - if err = crosschainKeeper.CrossChainBaseCoin(ctx, sender.Bytes(), args.Receipt, + if err = crosschainKeeper.CrosschainBaseCoin(ctx, sender.Bytes(), args.Receipt, amountCoin, feeCoin, fxTarget, args.Memo, isOriginToken); err != nil { return err } - data, topic, err := m.NewCrossChainEvent(sender, args.Token, amountCoin.Denom, args.Receipt, args.Amount, args.Fee, args.Target, args.Memo) + data, topic, err := m.NewCrosschainEvent(sender, args.Token, amountCoin.Denom, args.Receipt, args.Amount, args.Fee, args.Target, args.Memo) if err != nil { return err } @@ -111,19 +111,19 @@ func (m *CrossChainMethod) Run(evm *vm.EVM, contract *vm.Contract) ([]byte, erro return m.PackOutput(true) } -func (m *CrossChainMethod) NewCrossChainEvent(sender common.Address, token common.Address, denom, receipt string, amount, fee *big.Int, target [32]byte, memo string) (data []byte, topic []common.Hash, err error) { +func (m *CrosschainMethod) NewCrosschainEvent(sender common.Address, token common.Address, denom, receipt string, amount, fee *big.Int, target [32]byte, memo string) (data []byte, topic []common.Hash, err error) { return evmtypes.PackTopicData(m.Event, []common.Hash{sender.Hash(), token.Hash()}, denom, receipt, amount, fee, target, memo) } -func (m *CrossChainMethod) UnpackInput(data []byte) (*crosschaintypes.CrossChainArgs, error) { - args := new(crosschaintypes.CrossChainArgs) +func (m *CrosschainMethod) UnpackInput(data []byte) (*crosschaintypes.CrosschainArgs, error) { + args := new(crosschaintypes.CrosschainArgs) if err := evmtypes.ParseMethodArgs(m.Method, args, data[4:]); err != nil { return nil, err } return args, nil } -func (m *CrossChainMethod) PackInput(args crosschaintypes.CrossChainArgs) ([]byte, error) { +func (m *CrosschainMethod) PackInput(args crosschaintypes.CrosschainArgs) ([]byte, error) { data, err := m.Method.Inputs.Pack(args.Token, args.Receipt, args.Amount, args.Fee, args.Target, args.Memo) if err != nil { return nil, err @@ -131,6 +131,6 @@ func (m *CrossChainMethod) PackInput(args crosschaintypes.CrossChainArgs) ([]byt return append(m.GetMethodId(), data...), nil } -func (m *CrossChainMethod) PackOutput(success bool) ([]byte, error) { +func (m *CrosschainMethod) PackOutput(success bool) ([]byte, error) { return m.Method.Outputs.Pack(success) } diff --git a/x/crosschain/precompile/crosschain_test.go b/x/crosschain/precompile/crosschain_test.go index 86a94ef1..54c2564a 100644 --- a/x/crosschain/precompile/crosschain_test.go +++ b/x/crosschain/precompile/crosschain_test.go @@ -8,11 +8,11 @@ import ( "github.com/functionx/fx-core/v8/x/crosschain/precompile" ) -func TestCrossChainABI(t *testing.T) { - crossChain := precompile.NewCrossChainMethod(nil) +func TestCrosschainABI(t *testing.T) { + crosschain := precompile.NewCrosschainMethod(nil) - require.Equal(t, 6, len(crossChain.Method.Inputs)) - require.Equal(t, 1, len(crossChain.Method.Outputs)) + require.Equal(t, 6, len(crosschain.Method.Inputs)) + require.Equal(t, 1, len(crosschain.Method.Outputs)) - require.Equal(t, 8, len(crossChain.Event.Inputs)) + require.Equal(t, 8, len(crosschain.Event.Inputs)) } diff --git a/x/crosschain/precompile/expected_keepers.go b/x/crosschain/precompile/expected_keepers.go index 9a55003e..242c9b4b 100644 --- a/x/crosschain/precompile/expected_keepers.go +++ b/x/crosschain/precompile/expected_keepers.go @@ -21,7 +21,7 @@ type BankKeeper interface { type CrosschainKeeper interface { ExecuteClaim(ctx sdk.Context, eventNonce uint64) error BridgeCoinSupply(ctx context.Context, token, target string) (sdk.Coin, error) - CrossChainBaseCoin(ctx sdk.Context, from sdk.AccAddress, receipt string, amount, fee sdk.Coin, fxTarget *crosschaintypes.FxTarget, memo string, originToken bool) error + CrosschainBaseCoin(ctx sdk.Context, from sdk.AccAddress, receipt string, amount, fee sdk.Coin, fxTarget *crosschaintypes.FxTarget, memo string, originToken bool) error BridgeCallBaseCoin(ctx sdk.Context, from, refund, to common.Address, coins sdk.Coins, data, memo []byte, fxTarget *crosschaintypes.FxTarget, originTokenAmount sdkmath.Int) (uint64, error) GetBaseDenomByErc20(ctx sdk.Context, erc20Addr common.Address) (erc20types.ERC20Token, error) diff --git a/x/crosschain/precompile/has_oracle_test.go b/x/crosschain/precompile/has_oracle_test.go index a2f106b8..d98236ae 100644 --- a/x/crosschain/precompile/has_oracle_test.go +++ b/x/crosschain/precompile/has_oracle_test.go @@ -12,7 +12,7 @@ import ( ethtypes "github.com/functionx/fx-core/v8/x/eth/types" ) -func TestCrossChainHasOracleABI(t *testing.T) { +func TestCrosschainHasOracleABI(t *testing.T) { method := precompile.NewHasOracleMethod(nil) require.Equal(t, 2, len(method.Method.Inputs)) require.Equal(t, 1, len(method.Method.Outputs)) diff --git a/x/crosschain/precompile/is_oracle_online_test.go b/x/crosschain/precompile/is_oracle_online_test.go index 3a1f453d..839b7d42 100644 --- a/x/crosschain/precompile/is_oracle_online_test.go +++ b/x/crosschain/precompile/is_oracle_online_test.go @@ -12,7 +12,7 @@ import ( ethtypes "github.com/functionx/fx-core/v8/x/eth/types" ) -func TestCrossChainIsOracleOnlineABI(t *testing.T) { +func TestCrosschainIsOracleOnlineABI(t *testing.T) { method := precompile.NewIsOracleOnlineMethod(nil) require.Equal(t, 2, len(method.Method.Inputs)) require.Equal(t, 1, len(method.Method.Outputs)) diff --git a/x/crosschain/precompile/keeper.go b/x/crosschain/precompile/keeper.go index 2f4008a6..be0f0c2f 100644 --- a/x/crosschain/precompile/keeper.go +++ b/x/crosschain/precompile/keeper.go @@ -20,8 +20,8 @@ type Keeper struct { bankKeeper BankKeeper } -func (c *Keeper) EvmTokenToBaseCoin(ctx sdk.Context, evm *vm.EVM, crossChainKeeper CrosschainKeeper, holder, tokenAddr common.Address, amount *big.Int) (sdk.Coin, error) { - erc20Token, err := crossChainKeeper.GetBaseDenomByErc20(ctx, tokenAddr) +func (c *Keeper) EvmTokenToBaseCoin(ctx sdk.Context, evm *vm.EVM, crosschainKeeper CrosschainKeeper, holder, tokenAddr common.Address, amount *big.Int) (sdk.Coin, error) { + erc20Token, err := crosschainKeeper.GetBaseDenomByErc20(ctx, tokenAddr) if err != nil { return sdk.Coin{}, err } diff --git a/x/crosschain/types/contract.go b/x/crosschain/types/contract.go index 50a5cf59..734bbdcd 100644 --- a/x/crosschain/types/contract.go +++ b/x/crosschain/types/contract.go @@ -11,16 +11,16 @@ import ( ) var ( - crossChainAddress = common.HexToAddress(contract.CrossChainAddress) - crossChainABI = contract.MustABIJson(contract.ICrossChainMetaData.ABI) + crosschainAddress = common.HexToAddress(contract.CrosschainAddress) + crosschainABI = contract.MustABIJson(contract.ICrosschainMetaData.ABI) ) func GetAddress() common.Address { - return crossChainAddress + return crosschainAddress } func GetABI() abi.ABI { - return crossChainABI + return crosschainABI } type BridgeCoinAmountArgs struct { @@ -50,7 +50,7 @@ func (args *CancelSendToExternalArgs) Validate() error { return nil } -type CrossChainArgs struct { +type CrosschainArgs struct { Token common.Address `abi:"_token"` Receipt string `abi:"_receipt"` Amount *big.Int `abi:"_amount"` @@ -59,7 +59,7 @@ type CrossChainArgs struct { Memo string `abi:"_memo"` } -func (args *CrossChainArgs) Validate() error { +func (args *CrosschainArgs) Validate() error { if args.Receipt == "" { return errors.New("empty receipt") } diff --git a/x/crosschain/types/external_address.go b/x/crosschain/types/external_address.go index faa18ca7..f9b79f02 100644 --- a/x/crosschain/types/external_address.go +++ b/x/crosschain/types/external_address.go @@ -58,7 +58,7 @@ func RegisterExternalAddress(chainName string, validate ExternalAddress) { func ValidateExternalAddr(chainName, addr string) error { router, ok := externalAddressRouter[chainName] if !ok { - return fmt.Errorf("unrecognized cross chain name: %s", chainName) + return fmt.Errorf("unrecognized crosschain name: %s", chainName) } return router.ValidateExternalAddr(addr) } @@ -66,7 +66,7 @@ func ValidateExternalAddr(chainName, addr string) error { func ExternalAddrToAccAddr(chainName, addr string) sdk.AccAddress { router, ok := externalAddressRouter[chainName] if !ok { - panic("unrecognized cross chain name: " + chainName) + panic("unrecognized crosschain name: " + chainName) } return router.ExternalAddrToAccAddr(addr) } @@ -74,7 +74,7 @@ func ExternalAddrToAccAddr(chainName, addr string) sdk.AccAddress { func ExternalAddrToHexAddr(chainName, addr string) common.Address { router, ok := externalAddressRouter[chainName] if !ok { - panic("unrecognized cross chain name: " + chainName) + panic("unrecognized crosschain name: " + chainName) } return router.ExternalAddrToHexAddr(addr) } @@ -82,7 +82,7 @@ func ExternalAddrToHexAddr(chainName, addr string) common.Address { func ExternalAddrToStr(chainName string, bz []byte) string { router, ok := externalAddressRouter[chainName] if !ok { - panic("unrecognized cross chain name: " + chainName) + panic("unrecognized crosschain name: " + chainName) } return router.ExternalAddrToStr(bz) } diff --git a/x/crosschain/types/proposal.go b/x/crosschain/types/legacy.go similarity index 97% rename from x/crosschain/types/proposal.go rename to x/crosschain/types/legacy.go index 69110ae1..d72658a0 100644 --- a/x/crosschain/types/proposal.go +++ b/x/crosschain/types/legacy.go @@ -59,7 +59,7 @@ func (m *UpdateChainOraclesProposal) ProposalType() string { func (m *UpdateChainOraclesProposal) ValidateBasic() error { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if err := govv1betal.ValidateAbstract(m); err != nil { return err diff --git a/x/crosschain/types/msgs.go b/x/crosschain/types/msgs.go index 54d52a16..c7b4d105 100644 --- a/x/crosschain/types/msgs.go +++ b/x/crosschain/types/msgs.go @@ -14,34 +14,34 @@ import ( ) type ( - // CrossChainMsg cross msg must implement GetChainName interface.. using in router - CrossChainMsg interface { + // CrosschainMsg cross msg must implement GetChainName interface.. using in router + CrosschainMsg interface { GetChainName() string } ) var ( - _ CrossChainMsg = &MsgBondedOracle{} - _ CrossChainMsg = &MsgAddDelegate{} - _ CrossChainMsg = &MsgReDelegate{} - _ CrossChainMsg = &MsgEditBridger{} - _ CrossChainMsg = &MsgWithdrawReward{} - _ CrossChainMsg = &MsgUnbondedOracle{} - _ CrossChainMsg = &MsgOracleSetConfirm{} - _ CrossChainMsg = &MsgOracleSetUpdatedClaim{} - _ CrossChainMsg = &MsgBridgeTokenClaim{} - _ CrossChainMsg = &MsgSendToFxClaim{} - _ CrossChainMsg = &MsgSendToExternal{} - _ CrossChainMsg = &MsgCancelSendToExternal{} - _ CrossChainMsg = &MsgIncreaseBridgeFee{} - _ CrossChainMsg = &MsgSendToExternalClaim{} - _ CrossChainMsg = &MsgRequestBatch{} - _ CrossChainMsg = &MsgConfirmBatch{} - _ CrossChainMsg = &MsgBridgeCallClaim{} - _ CrossChainMsg = &MsgBridgeCallConfirm{} - _ CrossChainMsg = &MsgBridgeCallResultClaim{} - _ CrossChainMsg = &MsgUpdateParams{} - _ CrossChainMsg = &MsgUpdateChainOracles{} + _ CrosschainMsg = &MsgBondedOracle{} + _ CrosschainMsg = &MsgAddDelegate{} + _ CrosschainMsg = &MsgReDelegate{} + _ CrosschainMsg = &MsgEditBridger{} + _ CrosschainMsg = &MsgWithdrawReward{} + _ CrosschainMsg = &MsgUnbondedOracle{} + _ CrosschainMsg = &MsgOracleSetConfirm{} + _ CrosschainMsg = &MsgOracleSetUpdatedClaim{} + _ CrosschainMsg = &MsgBridgeTokenClaim{} + _ CrosschainMsg = &MsgSendToFxClaim{} + _ CrosschainMsg = &MsgSendToExternal{} + _ CrosschainMsg = &MsgCancelSendToExternal{} + _ CrosschainMsg = &MsgIncreaseBridgeFee{} + _ CrosschainMsg = &MsgSendToExternalClaim{} + _ CrosschainMsg = &MsgRequestBatch{} + _ CrosschainMsg = &MsgConfirmBatch{} + _ CrosschainMsg = &MsgBridgeCallClaim{} + _ CrosschainMsg = &MsgBridgeCallConfirm{} + _ CrosschainMsg = &MsgBridgeCallResultClaim{} + _ CrosschainMsg = &MsgUpdateParams{} + _ CrosschainMsg = &MsgUpdateChainOracles{} ) var ( @@ -71,7 +71,7 @@ var ( func (m *MsgBondedOracle) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -93,7 +93,7 @@ func (m *MsgBondedOracle) ValidateBasic() (err error) { func (m *MsgAddDelegate) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -106,7 +106,7 @@ func (m *MsgAddDelegate) ValidateBasic() (err error) { func (m *MsgReDelegate) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -119,7 +119,7 @@ func (m *MsgReDelegate) ValidateBasic() (err error) { func (m *MsgEditBridger) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -135,7 +135,7 @@ func (m *MsgEditBridger) ValidateBasic() (err error) { func (m *MsgWithdrawReward) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -145,7 +145,7 @@ func (m *MsgWithdrawReward) ValidateBasic() (err error) { func (m *MsgUnbondedOracle) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.OracleAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid oracle address: %s", err) @@ -168,7 +168,7 @@ var ( func (m *MsgOracleSetConfirm) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -187,7 +187,7 @@ func (m *MsgOracleSetConfirm) ValidateBasic() (err error) { func (m *MsgSendToExternal) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.Sender); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid sender address: %s", err) @@ -209,7 +209,7 @@ func (m *MsgSendToExternal) ValidateBasic() (err error) { func (m *MsgConfirmBatch) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -231,7 +231,7 @@ func (m *MsgConfirmBatch) ValidateBasic() (err error) { func (m *MsgBridgeCallConfirm) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -290,7 +290,7 @@ func MustUnpackAttestationClaim(cdc codectypes.AnyUnpacker, att *Attestation) Ex func (m *MsgClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if m.Claim == nil { return sdkerrors.ErrInvalidRequest.Wrap("empty claim") @@ -316,7 +316,7 @@ func (m *MsgSendToFxClaim) GetType() ClaimType { func (m *MsgSendToFxClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -360,7 +360,7 @@ func (m *MsgBridgeCallClaim) GetType() ClaimType { func (m *MsgBridgeCallClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if len(m.TokenContracts) != len(m.Amounts) { return sdkerrors.ErrInvalidRequest.Wrap("mismatched token contracts and amounts") @@ -481,7 +481,7 @@ func (m *MsgBridgeCallResultClaim) GetType() ClaimType { func (m *MsgBridgeCallResultClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -525,7 +525,7 @@ func (m *MsgSendToExternalClaim) GetType() ClaimType { func (m *MsgSendToExternalClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -556,7 +556,7 @@ func (m *MsgSendToExternalClaim) GetClaimer() sdk.AccAddress { func (m *MsgBridgeTokenClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -601,7 +601,7 @@ func (m *MsgOracleSetUpdatedClaim) GetType() ClaimType { func (m *MsgOracleSetUpdatedClaim) ValidateBasic() (err error) { if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if _, err = sdk.AccAddressFromBech32(m.BridgerAddress); err != nil { return sdkerrors.ErrInvalidAddress.Wrapf("invalid bridger address: %s", err) @@ -640,7 +640,7 @@ func (m *MsgUpdateParams) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrapf("authority") } if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if err := m.Params.ValidateBasic(); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("params err: %s", err.Error()) @@ -656,7 +656,7 @@ func (m *MsgUpdateChainOracles) ValidateBasic() error { return sdkerrors.ErrInvalidAddress.Wrap("authority") } if _, ok := externalAddressRouter[m.ChainName]; !ok { - return sdkerrors.ErrInvalidRequest.Wrap("unrecognized cross chain name") + return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name") } if len(m.Oracles) == 0 { return sdkerrors.ErrInvalidRequest.Wrap("empty oracles") diff --git a/x/crosschain/types/msgs_test.go b/x/crosschain/types/msgs_test.go index c388e529..2a2d0b2e 100644 --- a/x/crosschain/types/msgs_test.go +++ b/x/crosschain/types/msgs_test.go @@ -48,7 +48,7 @@ func TestMsgBondedOracle_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -57,7 +57,7 @@ func TestMsgBondedOracle_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty oracle address", @@ -205,7 +205,7 @@ func TestMsgAddDelegate_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -214,7 +214,7 @@ func TestMsgAddDelegate_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty oracle address", @@ -301,7 +301,7 @@ func TestMsgOracleSetConfirm_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -310,7 +310,7 @@ func TestMsgOracleSetConfirm_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty bridger address", @@ -433,7 +433,7 @@ func TestMsgOracleSetUpdatedClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -442,7 +442,7 @@ func TestMsgOracleSetUpdatedClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty bridge address", @@ -618,7 +618,7 @@ func TestMsgBridgeTokenClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -627,7 +627,7 @@ func TestMsgBridgeTokenClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty bridge address", @@ -813,7 +813,7 @@ func TestMsgSendToFxClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -822,7 +822,7 @@ func TestMsgSendToFxClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty bridge address", @@ -1036,7 +1036,7 @@ func TestMsgSendToExternal_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -1045,7 +1045,7 @@ func TestMsgSendToExternal_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - error prefix sender address", @@ -1170,7 +1170,7 @@ func TestMsgSendToExternalClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -1179,7 +1179,7 @@ func TestMsgSendToExternalClaim_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - error prefix bridger address", @@ -1306,7 +1306,7 @@ func TestMsgConfirmBatch_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - invalid chain name", @@ -1315,7 +1315,7 @@ func TestMsgConfirmBatch_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty bridge address", @@ -1467,7 +1467,7 @@ func TestUpdateChainOraclesProposal_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "err - empty oracle", @@ -1561,7 +1561,7 @@ func TestMsgBridgeCallConfirm_ValidateBasic(t *testing.T) { }, expectPass: false, err: sdkerrors.ErrInvalidRequest, - errReason: "unrecognized cross chain name: invalid request", + errReason: "unrecognized crosschain name: invalid request", }, { testName: "success", diff --git a/x/erc20/migrations/v8/migrate.go b/x/erc20/migrations/v8/migrate.go index ad709de8..81ff2b2d 100644 --- a/x/erc20/migrations/v8/migrate.go +++ b/x/erc20/migrations/v8/migrate.go @@ -68,7 +68,7 @@ func (m Migrator) addBridgeToken( if getExcludeBridgeToken(ctx, alias) { return nil } - for _, ck := range m.crossChainKeepers { + for _, ck := range m.crosschainKeepers { canAddFxBridgeToken := base == fxtypes.DefaultDenom && ck.ModuleName() == ethtypes.ModuleName canAddBridgeToken := strings.HasPrefix(alias, ck.ModuleName()) excludeModule := ck.ModuleName() != arbitrumtypes.ModuleName && ck.ModuleName() != optimismtypes.ModuleName diff --git a/x/erc20/migrations/v8/migrations.go b/x/erc20/migrations/v8/migrations.go index 5fe5bd7e..60c8db2b 100644 --- a/x/erc20/migrations/v8/migrations.go +++ b/x/erc20/migrations/v8/migrations.go @@ -15,7 +15,7 @@ type Migrator struct { cdc codec.BinaryCodec keeper keeper.Keeper bankKeeper bankkeeper.Keeper - crossChainKeepers []crosschainkeeper.Keeper + crosschainKeepers []crosschainkeeper.Keeper } func NewMigrator(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, keeper keeper.Keeper, bk bankkeeper.Keeper, cks []crosschainkeeper.Keeper) Migrator { @@ -24,7 +24,7 @@ func NewMigrator(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, keeper kee cdc: cdc, keeper: keeper, bankKeeper: bk, - crossChainKeepers: cks, + crosschainKeepers: cks, } } diff --git a/x/erc20/module.go b/x/erc20/module.go index a537c45c..2fb95648 100644 --- a/x/erc20/module.go +++ b/x/erc20/module.go @@ -81,7 +81,7 @@ type AppModule struct { cdc codec.BinaryCodec keeper keeper.Keeper bankKeeper bankkeeper.Keeper - crossChainKeepers []crosschainkeeper.Keeper + crosschainKeepers []crosschainkeeper.Keeper } // NewAppModule creates a new AppModule Object @@ -92,7 +92,7 @@ func NewAppModule(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, keeper ke cdc: cdc, keeper: keeper, bankKeeper: bk, - crossChainKeepers: cks, + crosschainKeepers: cks, } } @@ -111,7 +111,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.keeper)) - m := v8.NewMigrator(am.storeKey, am.cdc, am.keeper, am.bankKeeper, am.crossChainKeepers) + m := v8.NewMigrator(am.storeKey, am.cdc, am.keeper, am.bankKeeper, am.crosschainKeepers) if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil { panic(fmt.Sprintf("failed to migrate x/erc20 from version 3 to 4: %v", err)) } diff --git a/x/erc20/types/token.go b/x/erc20/types/token.go index 2b16361e..ec3f5a49 100644 --- a/x/erc20/types/token.go +++ b/x/erc20/types/token.go @@ -26,7 +26,7 @@ func (m *BridgeToken) BridgeDenom() string { if m.IsOrigin() { return m.Denom } - return fmt.Sprintf("%s%s", m.ChainName, m.Contract) // todo: replace with crosschaintypes.NewBridgeToken + return fmt.Sprintf("%s%s", m.ChainName, m.Contract) // TODO: replace with crosschaintypes.NewBridgeToken } func (m *BridgeToken) IsOrigin() bool { diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index 33610f0b..387cb9d1 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -257,7 +257,7 @@ func (suite *KeeperTestSuite) TestUpdateParams() { expectedErr: "authority", }, { - testName: "set CrossChainParam", + testName: "set CrosschainParam", amount: sdk.NewCoins(sdk.NewCoin(fxtypes.DefaultDenom, sdkmath.NewInt(10*1e3).MulRaw(1e18))), msg: []sdk.Msg{&crosschaintypes.MsgUpdateParams{ChainName: "eth", Authority: suite.govAcct, Params: crosschaintypes.DefaultParams()}}, result: true, diff --git a/x/ibc/middleware/keeper/keeper.go b/x/ibc/middleware/keeper/keeper.go index f2095adb..1fe87c18 100644 --- a/x/ibc/middleware/keeper/keeper.go +++ b/x/ibc/middleware/keeper/keeper.go @@ -12,14 +12,14 @@ import ( type Keeper struct { cdc codec.Codec evmKeeper types.EvmKeeper - crossChainKeeper types.CrossChainKeeper + crosschainKeeper types.CrosschainKeeper } -func NewKeeper(cdc codec.Codec, evmKeeper types.EvmKeeper, crossChainKeeper types.CrossChainKeeper) Keeper { +func NewKeeper(cdc codec.Codec, evmKeeper types.EvmKeeper, crosschainKeeper types.CrosschainKeeper) Keeper { return Keeper{ cdc: cdc, evmKeeper: evmKeeper, - crossChainKeeper: crossChainKeeper, + crosschainKeeper: crosschainKeeper, } } diff --git a/x/ibc/middleware/keeper/relay.go b/x/ibc/middleware/keeper/relay.go index 3ed2e890..d2f21751 100644 --- a/x/ibc/middleware/keeper/relay.go +++ b/x/ibc/middleware/keeper/relay.go @@ -36,7 +36,7 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t if !isEvmAddr { return sdkerrors.ErrInvalidAddress.Wrap("only support hex address") } - if err = k.crossChainKeeper.IBCCoinToEvm(ctx, receiver, receiveCoin); err != nil { + if err = k.crosschainKeeper.IBCCoinToEvm(ctx, receiver, receiveCoin); err != nil { return err } } @@ -55,10 +55,9 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac case *channeltypes.Acknowledgement_Error: return k.refundPacketTokenHook(ctx, packet, data) default: - k.crossChainKeeper.AfterIBCAckSuccess(ctx, packet.SourceChannel, packet.Sequence) // the acknowledgement succeeded on the receiving chain so nothing // needs to be executed and no error needs to be returned - return nil + return k.crosschainKeeper.AfterIBCAckSuccess(ctx, packet.SourceChannel, packet.Sequence) } } @@ -82,5 +81,5 @@ func (k Keeper) refundPacketTokenHook(ctx sdk.Context, packet channeltypes.Packe if err != nil { return err } - return k.crossChainKeeper.IBCCoinRefund(ctx, sender, token, packet.SourceChannel, packet.Sequence) + return k.crosschainKeeper.IBCCoinRefund(ctx, sender, token, packet.SourceChannel, packet.Sequence) } diff --git a/x/ibc/middleware/types/expected_keepers.go b/x/ibc/middleware/types/expected_keepers.go index 29947fde..4dc8b584 100644 --- a/x/ibc/middleware/types/expected_keepers.go +++ b/x/ibc/middleware/types/expected_keepers.go @@ -12,8 +12,8 @@ type EvmKeeper interface { CallEVM(ctx sdk.Context, from common.Address, contract *common.Address, value *big.Int, gasLimit uint64, data []byte, commit bool) (*evmtypes.MsgEthereumTxResponse, error) } -type CrossChainKeeper interface { +type CrosschainKeeper interface { IBCCoinToEvm(ctx sdk.Context, holder sdk.AccAddress, ibcCoin sdk.Coin) error IBCCoinRefund(ctx sdk.Context, holder sdk.AccAddress, ibcCoin sdk.Coin, ibcChannel string, ibcSequence uint64) error - AfterIBCAckSuccess(ctx sdk.Context, sourceChannel string, sequence uint64) + AfterIBCAckSuccess(ctx sdk.Context, sourceChannel string, sequence uint64) error }