diff --git a/contract/IBridgeCallback.go b/contract/IBridgeCallback.go index f2253d9b..2985af6c 100644 --- a/contract/IBridgeCallback.go +++ b/contract/IBridgeCallback.go @@ -31,7 +31,7 @@ var ( // IBridgeCallbackMetaData contains all meta data concerning the IBridgeCallback contract. var IBridgeCallbackMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"bridgeCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_refund\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"}],\"name\":\"bridgeCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // IBridgeCallbackABI is the input ABI used to generate the binding from. @@ -182,21 +182,21 @@ func (_IBridgeCallback *IBridgeCallbackTransactorRaw) Transact(opts *bind.Transa // BridgeCallback is a paid mutator transaction binding the contract method 0x13997566. // -// Solidity: function bridgeCallback(address _sender, address _receiver, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() -func (_IBridgeCallback *IBridgeCallbackTransactor) BridgeCallback(opts *bind.TransactOpts, _sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { - return _IBridgeCallback.contract.Transact(opts, "bridgeCallback", _sender, _receiver, _tokens, _amounts, _data, _memo) +// Solidity: function bridgeCallback(address _sender, address _refund, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() +func (_IBridgeCallback *IBridgeCallbackTransactor) BridgeCallback(opts *bind.TransactOpts, _sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { + return _IBridgeCallback.contract.Transact(opts, "bridgeCallback", _sender, _refund, _tokens, _amounts, _data, _memo) } // BridgeCallback is a paid mutator transaction binding the contract method 0x13997566. // -// Solidity: function bridgeCallback(address _sender, address _receiver, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() -func (_IBridgeCallback *IBridgeCallbackSession) BridgeCallback(_sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { - return _IBridgeCallback.Contract.BridgeCallback(&_IBridgeCallback.TransactOpts, _sender, _receiver, _tokens, _amounts, _data, _memo) +// Solidity: function bridgeCallback(address _sender, address _refund, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() +func (_IBridgeCallback *IBridgeCallbackSession) BridgeCallback(_sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { + return _IBridgeCallback.Contract.BridgeCallback(&_IBridgeCallback.TransactOpts, _sender, _refund, _tokens, _amounts, _data, _memo) } // BridgeCallback is a paid mutator transaction binding the contract method 0x13997566. // -// Solidity: function bridgeCallback(address _sender, address _receiver, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() -func (_IBridgeCallback *IBridgeCallbackTransactorSession) BridgeCallback(_sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { - return _IBridgeCallback.Contract.BridgeCallback(&_IBridgeCallback.TransactOpts, _sender, _receiver, _tokens, _amounts, _data, _memo) +// Solidity: function bridgeCallback(address _sender, address _refund, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) returns() +func (_IBridgeCallback *IBridgeCallbackTransactorSession) BridgeCallback(_sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _data []byte, _memo []byte) (*types.Transaction, error) { + return _IBridgeCallback.Contract.BridgeCallback(&_IBridgeCallback.TransactOpts, _sender, _refund, _tokens, _amounts, _data, _memo) } diff --git a/contract/ICrossChain.go b/contract/ICrossChain.go index 5dd29c4b..3c092283 100644 --- a/contract/ICrossChain.go +++ b/contract/ICrossChain.go @@ -31,7 +31,7 @@ var ( // 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\":false,\"internalType\":\"string\",\"name\":\"chain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txID\",\"type\":\"uint256\"}],\"name\":\"CancelSendToExternal\",\"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\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"chain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"name\":\"IncreaseBridgeFee\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"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\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_txID\",\"type\":\"uint256\"}],\"name\":\"cancelSendToExternal\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"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\":\"address\",\"name\":\"_sender\",\"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\":\"fip20CrossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_txID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"increaseBridgeFee\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", + 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\":false,\"internalType\":\"string\",\"name\":\"chain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txID\",\"type\":\"uint256\"}],\"name\":\"CancelSendToExternal\",\"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\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"chain\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"}],\"name\":\"IncreaseBridgeFee\",\"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\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_txID\",\"type\":\"uint256\"}],\"name\":\"cancelSendToExternal\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"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\":\"address\",\"name\":\"_sender\",\"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\":\"fip20CrossChain\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_chain\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_txID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"increaseBridgeFee\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", } // ICrossChainABI is the input ABI used to generate the binding from. @@ -213,23 +213,23 @@ func (_ICrossChain *ICrossChainCallerSession) BridgeCoinAmount(_token common.Add // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // -// Solidity: function bridgeCall(string _dstChain, address _receiver, 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, _receiver 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, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// 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) } // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // -// Solidity: function bridgeCall(string _dstChain, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_ICrossChain *ICrossChainSession) BridgeCall(_dstChain string, _receiver 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, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// 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) } // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // -// Solidity: function bridgeCall(string _dstChain, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_ICrossChain *ICrossChainTransactorSession) BridgeCall(_dstChain string, _receiver 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, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// 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) } // CancelSendToExternal is a paid mutator transaction binding the contract method 0x0b56c190. diff --git a/contract/IFxBridgeLogic.go b/contract/IFxBridgeLogic.go index 240f01d1..e08c102a 100644 --- a/contract/IFxBridgeLogic.go +++ b/contract/IFxBridgeLogic.go @@ -32,7 +32,7 @@ var ( // IFxBridgeLogicBridgeCallData is an auto generated low-level Go binding around an user-defined struct. type IFxBridgeLogicBridgeCallData struct { Sender common.Address - Receiver common.Address + Refund common.Address Tokens []common.Address Amounts []*big.Int To common.Address @@ -59,7 +59,7 @@ type IFxBridgeLogicTokenStatus struct { // IFxBridgeLogicMetaData contains all meta data concerning the IFxBridgeLogic contract. var IFxBridgeLogicMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_channelIBC\",\"type\":\"bytes32\"}],\"name\":\"AddBridgeTokenEvent\",\"type\":\"event\"},{\"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\":\"uint256\",\"name\":\"_newOracleSetNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"}],\"name\":\"OracleSetUpdatedEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_targetIBC\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"SendToFxEvent\",\"type\":\"event\"},{\"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\":\"_nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_cause\",\"type\":\"bytes\"}],\"name\":\"SubmitBridgeCallEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchNonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"TransactionBatchExecutedEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"TransferOwnerEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"activeBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_channelIBC\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"_isOriginated\",\"type\":\"bool\"}],\"name\":\"addBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_dstChain\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"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\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"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\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_timeout\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"bridgeCallCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"checkAssetStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32\",\"name\":\"_theHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_powerThreshold\",\"type\":\"uint256\"}],\"name\":\"checkOracleSignatures\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"convert_decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeTokenList\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"}],\"internalType\":\"structIFxBridgeLogic.BridgeToken[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"lastBatchNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_oracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_fxBridgeId\",\"type\":\"bytes32\"}],\"name\":\"makeCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_oracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"}],\"name\":\"oracleSetCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"pauseBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_destination\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_targetIBC\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"sendToFx\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_fxBridgeId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"state_lastBatchNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"state_lastBridgeCallNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastEventNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastOracleSetCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastOracleSetNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_powerThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address[]\",\"name\":\"_destinations\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_fees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_nonceArray\",\"type\":\"uint256[2]\"},{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_batchTimeout\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_feeReceive\",\"type\":\"address\"}],\"name\":\"submitBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address[]\",\"name\":\"_destinations\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_fees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_batchNonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_batchTimeout\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_feeReceive\",\"type\":\"address\"}],\"name\":\"submitBatchCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_nonceArray\",\"type\":\"uint256[2]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"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\":\"bytes\",\"name\":\"memo\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"timeout\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"eventNonce\",\"type\":\"uint256\"}],\"internalType\":\"structIFxBridgeLogic.BridgeCallData\",\"name\":\"_input\",\"type\":\"tuple\"}],\"name\":\"submitBridgeCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"tokenStatus\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"isOriginated\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isActive\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isExist\",\"type\":\"bool\"}],\"internalType\":\"structIFxBridgeLogic.TokenStatus\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_newOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_newPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_newOracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_currentOracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"}],\"name\":\"updateOracleSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_channelIBC\",\"type\":\"bytes32\"}],\"name\":\"AddBridgeTokenEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_refund\",\"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\":\"uint256\",\"name\":\"_newOracleSetNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"}],\"name\":\"OracleSetUpdatedEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_targetIBC\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"SendToFxEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_txOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_cause\",\"type\":\"bytes\"}],\"name\":\"SubmitBridgeCallEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchNonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"TransactionBatchExecutedEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"TransferOwnerEvent\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"activeBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_channelIBC\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"_isOriginated\",\"type\":\"bool\"}],\"name\":\"addBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"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\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"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\":\"bytes\",\"name\":\"_memo\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_timeout\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_eventNonce\",\"type\":\"uint256\"}],\"name\":\"bridgeCallCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"bridgeTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"checkAssetStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32\",\"name\":\"_theHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_powerThreshold\",\"type\":\"uint256\"}],\"name\":\"checkOracleSignatures\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"convert_decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeTokenList\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"}],\"internalType\":\"structIFxBridgeLogic.BridgeToken[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"lastBatchNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_oracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_fxBridgeId\",\"type\":\"bytes32\"}],\"name\":\"makeCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_oracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_oracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_powers\",\"type\":\"uint256[]\"}],\"name\":\"oracleSetCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"pauseBridgeToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_destination\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_targetIBC\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"sendToFx\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_fxBridgeId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_erc20Address\",\"type\":\"address\"}],\"name\":\"state_lastBatchNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"state_lastBridgeCallNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastEventNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastOracleSetCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_lastOracleSetNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_powerThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address[]\",\"name\":\"_destinations\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_fees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_nonceArray\",\"type\":\"uint256[2]\"},{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_batchTimeout\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_feeReceive\",\"type\":\"address\"}],\"name\":\"submitBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_fxbridgeId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_methodName\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address[]\",\"name\":\"_destinations\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_fees\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_batchNonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_batchTimeout\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_feeReceive\",\"type\":\"address\"}],\"name\":\"submitBatchCheckpoint\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_nonceArray\",\"type\":\"uint256[2]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"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\":\"bytes\",\"name\":\"memo\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"timeout\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"eventNonce\",\"type\":\"uint256\"}],\"internalType\":\"structIFxBridgeLogic.BridgeCallData\",\"name\":\"_input\",\"type\":\"tuple\"}],\"name\":\"submitBridgeCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddr\",\"type\":\"address\"}],\"name\":\"tokenStatus\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"isOriginated\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isActive\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isExist\",\"type\":\"bool\"}],\"internalType\":\"structIFxBridgeLogic.TokenStatus\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_newOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_newPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_newOracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_currentOracles\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_currentPowers\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_currentOracleSetNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint8[]\",\"name\":\"_v\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_r\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_s\",\"type\":\"bytes32[]\"}],\"name\":\"updateOracleSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // IFxBridgeLogicABI is the input ABI used to generate the binding from. @@ -746,44 +746,44 @@ func (_IFxBridgeLogic *IFxBridgeLogicTransactorSession) AddBridgeToken(_tokenAdd // BridgeCall is a paid mutator transaction binding the contract method 0x851c42ee. // -// Solidity: function bridgeCall(string _dstChain, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_IFxBridgeLogic *IFxBridgeLogicTransactor) BridgeCall(opts *bind.TransactOpts, _dstChain string, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _IFxBridgeLogic.contract.Transact(opts, "bridgeCall", _dstChain, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) +func (_IFxBridgeLogic *IFxBridgeLogicTransactor) 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 _IFxBridgeLogic.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 _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_IFxBridgeLogic *IFxBridgeLogicSession) BridgeCall(_dstChain string, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _IFxBridgeLogic.Contract.BridgeCall(&_IFxBridgeLogic.TransactOpts, _dstChain, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) +func (_IFxBridgeLogic *IFxBridgeLogicSession) 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 _IFxBridgeLogic.Contract.BridgeCall(&_IFxBridgeLogic.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 _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) -func (_IFxBridgeLogic *IFxBridgeLogicTransactorSession) BridgeCall(_dstChain string, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _value *big.Int, _memo []byte) (*types.Transaction, error) { - return _IFxBridgeLogic.Contract.BridgeCall(&_IFxBridgeLogic.TransactOpts, _dstChain, _receiver, _tokens, _amounts, _to, _data, _value, _memo) +// Solidity: function bridgeCall(string _dstChain, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, uint256 _value, bytes _memo) payable returns(uint256 _eventNonce) +func (_IFxBridgeLogic *IFxBridgeLogicTransactorSession) 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 _IFxBridgeLogic.Contract.BridgeCall(&_IFxBridgeLogic.TransactOpts, _dstChain, _refund, _tokens, _amounts, _to, _data, _value, _memo) } // BridgeCallCheckpoint is a paid mutator transaction binding the contract method 0x5aab9b15. // -// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) -func (_IFxBridgeLogic *IFxBridgeLogicTransactor) BridgeCallCheckpoint(opts *bind.TransactOpts, _fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { - return _IFxBridgeLogic.contract.Transact(opts, "bridgeCallCheckpoint", _fxbridgeId, _methodName, _sender, _receiver, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) +// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) +func (_IFxBridgeLogic *IFxBridgeLogicTransactor) BridgeCallCheckpoint(opts *bind.TransactOpts, _fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { + return _IFxBridgeLogic.contract.Transact(opts, "bridgeCallCheckpoint", _fxbridgeId, _methodName, _sender, _refund, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) } // BridgeCallCheckpoint is a paid mutator transaction binding the contract method 0x5aab9b15. // -// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) -func (_IFxBridgeLogic *IFxBridgeLogicSession) BridgeCallCheckpoint(_fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { - return _IFxBridgeLogic.Contract.BridgeCallCheckpoint(&_IFxBridgeLogic.TransactOpts, _fxbridgeId, _methodName, _sender, _receiver, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) +// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) +func (_IFxBridgeLogic *IFxBridgeLogicSession) BridgeCallCheckpoint(_fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { + return _IFxBridgeLogic.Contract.BridgeCallCheckpoint(&_IFxBridgeLogic.TransactOpts, _fxbridgeId, _methodName, _sender, _refund, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) } // BridgeCallCheckpoint is a paid mutator transaction binding the contract method 0x5aab9b15. // -// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _receiver, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) -func (_IFxBridgeLogic *IFxBridgeLogicTransactorSession) BridgeCallCheckpoint(_fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _receiver common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { - return _IFxBridgeLogic.Contract.BridgeCallCheckpoint(&_IFxBridgeLogic.TransactOpts, _fxbridgeId, _methodName, _sender, _receiver, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) +// Solidity: function bridgeCallCheckpoint(bytes32 _fxbridgeId, bytes32 _methodName, address _sender, address _refund, address[] _tokens, uint256[] _amounts, address _to, bytes _data, bytes _memo, uint256 _nonce, uint256 _timeout, uint256 _eventNonce) returns(bytes32) +func (_IFxBridgeLogic *IFxBridgeLogicTransactorSession) BridgeCallCheckpoint(_fxbridgeId [32]byte, _methodName [32]byte, _sender common.Address, _refund common.Address, _tokens []common.Address, _amounts []*big.Int, _to common.Address, _data []byte, _memo []byte, _nonce *big.Int, _timeout *big.Int, _eventNonce *big.Int) (*types.Transaction, error) { + return _IFxBridgeLogic.Contract.BridgeCallCheckpoint(&_IFxBridgeLogic.TransactOpts, _fxbridgeId, _methodName, _sender, _refund, _tokens, _amounts, _to, _data, _memo, _nonce, _timeout, _eventNonce) } // OracleSetCheckpoint is a paid mutator transaction binding the contract method 0xa955665f. @@ -1215,7 +1215,7 @@ func (it *IFxBridgeLogicBridgeCallEventIterator) Close() error { // IFxBridgeLogicBridgeCallEvent represents a BridgeCallEvent event raised by the IFxBridgeLogic contract. type IFxBridgeLogicBridgeCallEvent struct { Sender common.Address - Receiver common.Address + Refund common.Address To common.Address TxOrigin common.Address Value *big.Int @@ -1230,23 +1230,23 @@ type IFxBridgeLogicBridgeCallEvent 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 (_IFxBridgeLogic *IFxBridgeLogicFilterer) FilterBridgeCallEvent(opts *bind.FilterOpts, _sender []common.Address, _receiver []common.Address, _to []common.Address) (*IFxBridgeLogicBridgeCallEventIterator, error) { +// Solidity: event BridgeCallEvent(address indexed _sender, address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) +func (_IFxBridgeLogic *IFxBridgeLogicFilterer) FilterBridgeCallEvent(opts *bind.FilterOpts, _sender []common.Address, _refund []common.Address, _to []common.Address) (*IFxBridgeLogicBridgeCallEventIterator, error) { var _senderRule []interface{} for _, _senderItem := range _sender { _senderRule = append(_senderRule, _senderItem) } - var _receiverRule []interface{} - for _, _receiverItem := range _receiver { - _receiverRule = append(_receiverRule, _receiverItem) + var _refundRule []interface{} + for _, _refundItem := range _refund { + _refundRule = append(_refundRule, _refundItem) } var _toRule []interface{} for _, _toItem := range _to { _toRule = append(_toRule, _toItem) } - logs, sub, err := _IFxBridgeLogic.contract.FilterLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _IFxBridgeLogic.contract.FilterLogs(opts, "BridgeCallEvent", _senderRule, _refundRule, _toRule) if err != nil { return nil, err } @@ -1255,23 +1255,23 @@ func (_IFxBridgeLogic *IFxBridgeLogicFilterer) FilterBridgeCallEvent(opts *bind. // 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 (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *IFxBridgeLogicBridgeCallEvent, _sender []common.Address, _receiver []common.Address, _to []common.Address) (event.Subscription, error) { +// Solidity: event BridgeCallEvent(address indexed _sender, address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) +func (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *IFxBridgeLogicBridgeCallEvent, _sender []common.Address, _refund []common.Address, _to []common.Address) (event.Subscription, error) { var _senderRule []interface{} for _, _senderItem := range _sender { _senderRule = append(_senderRule, _senderItem) } - var _receiverRule []interface{} - for _, _receiverItem := range _receiver { - _receiverRule = append(_receiverRule, _receiverItem) + var _refundRule []interface{} + for _, _refundItem := range _refund { + _refundRule = append(_refundRule, _refundItem) } var _toRule []interface{} for _, _toItem := range _to { _toRule = append(_toRule, _toItem) } - logs, sub, err := _IFxBridgeLogic.contract.WatchLogs(opts, "BridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _IFxBridgeLogic.contract.WatchLogs(opts, "BridgeCallEvent", _senderRule, _refundRule, _toRule) if err != nil { return nil, err } @@ -1305,7 +1305,7 @@ func (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchBridgeCallEvent(opts *bind.W // 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) +// Solidity: event BridgeCallEvent(address indexed _sender, address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, uint256 _eventNonce, string _dstChain, address[] _tokens, uint256[] _amounts, bytes _data, bytes _memo) func (_IFxBridgeLogic *IFxBridgeLogicFilterer) ParseBridgeCallEvent(log types.Log) (*IFxBridgeLogicBridgeCallEvent, error) { event := new(IFxBridgeLogicBridgeCallEvent) if err := _IFxBridgeLogic.contract.UnpackLog(event, "BridgeCallEvent", log); err != nil { @@ -1696,9 +1696,6 @@ func (it *IFxBridgeLogicSubmitBridgeCallEventIterator) Close() error { // IFxBridgeLogicSubmitBridgeCallEvent represents a SubmitBridgeCallEvent event raised by the IFxBridgeLogic contract. type IFxBridgeLogicSubmitBridgeCallEvent struct { - Sender common.Address - Receiver common.Address - To common.Address TxOrigin common.Address Nonce *big.Int EventNonce *big.Int @@ -1707,50 +1704,34 @@ type IFxBridgeLogicSubmitBridgeCallEvent struct { Raw types.Log // Blockchain specific contextual infos } -// FilterSubmitBridgeCallEvent is a free log retrieval operation binding the contract event 0x81350ffac62df257c99e23e0738671f18dd6b2cad1383dd097e7f1ff3ac1cdc5. +// FilterSubmitBridgeCallEvent is a free log retrieval operation binding the contract event 0xa274e2655558a3663f90b9ff4d5409974a0e79ba5f0fb41ec4d582d58ba70580. // -// Solidity: event SubmitBridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) -func (_IFxBridgeLogic *IFxBridgeLogicFilterer) FilterSubmitBridgeCallEvent(opts *bind.FilterOpts, _sender []common.Address, _receiver []common.Address, _to []common.Address) (*IFxBridgeLogicSubmitBridgeCallEventIterator, error) { +// Solidity: event SubmitBridgeCallEvent(address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) +func (_IFxBridgeLogic *IFxBridgeLogicFilterer) FilterSubmitBridgeCallEvent(opts *bind.FilterOpts, _txOrigin []common.Address) (*IFxBridgeLogicSubmitBridgeCallEventIterator, error) { - var _senderRule []interface{} - for _, _senderItem := range _sender { - _senderRule = append(_senderRule, _senderItem) - } - var _receiverRule []interface{} - for _, _receiverItem := range _receiver { - _receiverRule = append(_receiverRule, _receiverItem) - } - var _toRule []interface{} - for _, _toItem := range _to { - _toRule = append(_toRule, _toItem) + var _txOriginRule []interface{} + for _, _txOriginItem := range _txOrigin { + _txOriginRule = append(_txOriginRule, _txOriginItem) } - logs, sub, err := _IFxBridgeLogic.contract.FilterLogs(opts, "SubmitBridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _IFxBridgeLogic.contract.FilterLogs(opts, "SubmitBridgeCallEvent", _txOriginRule) if err != nil { return nil, err } return &IFxBridgeLogicSubmitBridgeCallEventIterator{contract: _IFxBridgeLogic.contract, event: "SubmitBridgeCallEvent", logs: logs, sub: sub}, nil } -// WatchSubmitBridgeCallEvent is a free log subscription operation binding the contract event 0x81350ffac62df257c99e23e0738671f18dd6b2cad1383dd097e7f1ff3ac1cdc5. +// WatchSubmitBridgeCallEvent is a free log subscription operation binding the contract event 0xa274e2655558a3663f90b9ff4d5409974a0e79ba5f0fb41ec4d582d58ba70580. // -// Solidity: event SubmitBridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) -func (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchSubmitBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *IFxBridgeLogicSubmitBridgeCallEvent, _sender []common.Address, _receiver []common.Address, _to []common.Address) (event.Subscription, error) { +// Solidity: event SubmitBridgeCallEvent(address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) +func (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchSubmitBridgeCallEvent(opts *bind.WatchOpts, sink chan<- *IFxBridgeLogicSubmitBridgeCallEvent, _txOrigin []common.Address) (event.Subscription, error) { - var _senderRule []interface{} - for _, _senderItem := range _sender { - _senderRule = append(_senderRule, _senderItem) - } - var _receiverRule []interface{} - for _, _receiverItem := range _receiver { - _receiverRule = append(_receiverRule, _receiverItem) - } - var _toRule []interface{} - for _, _toItem := range _to { - _toRule = append(_toRule, _toItem) + var _txOriginRule []interface{} + for _, _txOriginItem := range _txOrigin { + _txOriginRule = append(_txOriginRule, _txOriginItem) } - logs, sub, err := _IFxBridgeLogic.contract.WatchLogs(opts, "SubmitBridgeCallEvent", _senderRule, _receiverRule, _toRule) + logs, sub, err := _IFxBridgeLogic.contract.WatchLogs(opts, "SubmitBridgeCallEvent", _txOriginRule) if err != nil { return nil, err } @@ -1782,9 +1763,9 @@ func (_IFxBridgeLogic *IFxBridgeLogicFilterer) WatchSubmitBridgeCallEvent(opts * }), nil } -// ParseSubmitBridgeCallEvent is a log parse operation binding the contract event 0x81350ffac62df257c99e23e0738671f18dd6b2cad1383dd097e7f1ff3ac1cdc5. +// ParseSubmitBridgeCallEvent is a log parse operation binding the contract event 0xa274e2655558a3663f90b9ff4d5409974a0e79ba5f0fb41ec4d582d58ba70580. // -// Solidity: event SubmitBridgeCallEvent(address indexed _sender, address indexed _receiver, address indexed _to, address _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) +// Solidity: event SubmitBridgeCallEvent(address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, bytes _cause) func (_IFxBridgeLogic *IFxBridgeLogicFilterer) ParseSubmitBridgeCallEvent(log types.Log) (*IFxBridgeLogicSubmitBridgeCallEvent, error) { event := new(IFxBridgeLogicSubmitBridgeCallEvent) if err := _IFxBridgeLogic.contract.UnpackLog(event, "SubmitBridgeCallEvent", log); err != nil { diff --git a/contract/compile.sh b/contract/compile.sh index 02829d16..ff963cc9 100755 --- a/contract/compile.sh +++ b/contract/compile.sh @@ -31,7 +31,7 @@ echo "===> Compiling contracts" [[ ! -d "$project_dir/contract/artifacts" ]] && mkdir -p "$project_dir/contract/artifacts" # add core contracts -contracts=(WFXUpgradable FIP20Upgradable ICrossChain IStaking IFxBridgeLogic IBridgeCallback IRefundCallback) +contracts=(WFXUpgradable FIP20Upgradable ICrossChain IStaking IFxBridgeLogic IBridgeCallback) contracts_test=(CrossChainTest StakingTest) # add 3rd party contracts contracts+=(ERC1967Proxy) diff --git a/solidity/contracts/bridge/FxBridgeLogic.sol b/solidity/contracts/bridge/FxBridgeLogic.sol index 7b254c86..82749d8b 100644 --- a/solidity/contracts/bridge/FxBridgeLogic.sol +++ b/solidity/contracts/bridge/FxBridgeLogic.sol @@ -13,7 +13,6 @@ import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/se import {IERC20ExtensionsUpgradeable} from "./IERC20ExtensionsUpgradeable.sol"; import {IBridgeCallback} from "./IBridgeCallback.sol"; -import {IRefundCallback} from "./IRefundCallback.sol"; /* solhint-disable custom-errors */ @@ -64,7 +63,7 @@ contract FxBridgeLogic is struct BridgeCallData { address sender; - address receiver; + address refund; address[] tokens; uint256[] amounts; address to; @@ -292,7 +291,7 @@ contract FxBridgeLogic is function bridgeCall( string memory _dstChain, - address _receiver, + address _refund, address[] memory _tokens, uint256[] memory _amounts, address _to, @@ -301,11 +300,9 @@ contract FxBridgeLogic is bytes memory _memo ) external returns (uint256) { require(bytes(_dstChain).length == 0, "Invalid dstChain"); - - require( - _tokens.length > 0 || _data.length > 0, - "Token and data both empty" - ); + if (_tokens.length > 0) { + require(_refund != address(0), "Refund address is empty"); + } // transfer ERC20 _transferERC20(_msgSender(), address(this), _tokens, _amounts); @@ -313,10 +310,9 @@ contract FxBridgeLogic is // last event nonce +1 state_lastEventNonce = state_lastEventNonce.add(1); - // bridge call event emit BridgeCallEvent( _msgSender(), - _receiver, + _refund, _to, // solhint-disable-next-line avoid-tx-origin tx.origin, @@ -458,7 +454,7 @@ contract FxBridgeLogic is uint256[2] memory _nonceArray, BridgeCallData memory _input ) public nonReentrant whenNotPaused { - verifyBridgeCall( + verifySubmitBridgeCall( _currentOracles, _currentPowers, _v, @@ -486,9 +482,6 @@ contract FxBridgeLogic is { state_lastEventNonce = state_lastEventNonce.add(1); emit SubmitBridgeCallEvent( - _input.sender, - _input.receiver, - _input.to, // solhint-disable-next-line avoid-tx-origin tx.origin, _nonceArray[1], @@ -508,7 +501,7 @@ contract FxBridgeLogic is // bytes32 encoding of "bridgeCall" 0x62726964676543616c6c00000000000000000000000000000000000000000000, input.sender, - input.receiver, + input.refund, input.tokens, input.amounts, input.to, @@ -521,7 +514,7 @@ contract FxBridgeLogic is return keccak256(data); } - function verifyBridgeCall( + function verifySubmitBridgeCall( address[] memory _currentOracles, uint256[] memory _currentPowers, uint8[] memory _v, @@ -545,11 +538,6 @@ contract FxBridgeLogic is "Token not match amount" ); - require( - _input.tokens.length > 0 || _input.data.length > 0, - "Token and data both empty" - ); - require( _currentOracles.length == _currentPowers.length && _currentOracles.length == _v.length && @@ -585,11 +573,13 @@ contract FxBridgeLogic is BridgeCallData memory _input ) public onlySelf { if (_input.tokens.length > 0) { - address _receiver = _input.receiver; - bool isRefund = _input.eventNonce > 0; - if (isRefund) { - _receiver = _input.sender; + require(_input.refund != address(0), "Refund address is empty"); + + address _receiver = _input.to; + if (_input.eventNonce > 0) { + _receiver = _input.refund; } + _transferERC20( address(this), _receiver, @@ -597,22 +587,15 @@ contract FxBridgeLogic is _input.amounts ); - if (isRefund) { - if (_input.sender.isContract()) { - IRefundCallback(_input.sender).refundCallback( - _input.eventNonce, - _input.tokens, - _input.amounts - ); - } + if (_input.eventNonce > 0) { return; } } - if (_input.data.length > 0) { + if (_input.to.isContract()) { IBridgeCallback(_input.to).bridgeCallback( _input.sender, - _input.receiver, + _input.refund, _input.tokens, _input.amounts, _input.data, @@ -828,7 +811,7 @@ contract FxBridgeLogic is event BridgeCallEvent( address indexed _sender, - address indexed _receiver, + address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, @@ -841,10 +824,7 @@ contract FxBridgeLogic is ); event SubmitBridgeCallEvent( - address indexed _sender, - address indexed _receiver, - address indexed _to, - address _txOrigin, + address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, diff --git a/solidity/contracts/bridge/FxBridgeLogicETH.sol b/solidity/contracts/bridge/FxBridgeLogicETH.sol index 6a525026..5c354649 100644 --- a/solidity/contracts/bridge/FxBridgeLogicETH.sol +++ b/solidity/contracts/bridge/FxBridgeLogicETH.sol @@ -13,7 +13,6 @@ import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/se import {IERC20ExtensionsUpgradeable} from "./IERC20ExtensionsUpgradeable.sol"; import {IBridgeCallback} from "./IBridgeCallback.sol"; -import {IRefundCallback} from "./IRefundCallback.sol"; /* solhint-disable custom-errors */ @@ -75,7 +74,7 @@ contract FxBridgeLogicETH is struct BridgeCallData { address sender; - address receiver; + address refund; address[] tokens; uint256[] amounts; address to; @@ -328,7 +327,7 @@ contract FxBridgeLogicETH is function bridgeCall( string memory _dstChain, - address _receiver, + address _refund, address[] memory _tokens, uint256[] memory _amounts, address _to, @@ -337,11 +336,9 @@ contract FxBridgeLogicETH is bytes memory _memo ) external returns (uint256) { require(bytes(_dstChain).length == 0, "Invalid dstChain"); - - require( - _tokens.length > 0 || _data.length > 0, - "Token and data both empty" - ); + if (_tokens.length > 0) { + require(_refund != address(0), "Refund address is empty"); + } // transfer ERC20 _transferERC20(_msgSender(), address(this), _tokens, _amounts); @@ -349,10 +346,9 @@ contract FxBridgeLogicETH is // last event nonce +1 state_lastEventNonce = state_lastEventNonce.add(1); - // bridge call event emit BridgeCallEvent( _msgSender(), - _receiver, + _refund, _to, // solhint-disable-next-line avoid-tx-origin tx.origin, @@ -494,7 +490,7 @@ contract FxBridgeLogicETH is uint256[2] memory _nonceArray, BridgeCallData memory _input ) public nonReentrant whenNotPaused { - verifyBridgeCall( + verifySubmitBridgeCall( _currentOracles, _currentPowers, _v, @@ -522,9 +518,6 @@ contract FxBridgeLogicETH is { state_lastEventNonce = state_lastEventNonce.add(1); emit SubmitBridgeCallEvent( - _input.sender, - _input.receiver, - _input.to, // solhint-disable-next-line avoid-tx-origin tx.origin, _nonceArray[1], @@ -544,7 +537,7 @@ contract FxBridgeLogicETH is // bytes32 encoding of "bridgeCall" 0x62726964676543616c6c00000000000000000000000000000000000000000000, input.sender, - input.receiver, + input.refund, input.tokens, input.amounts, input.to, @@ -557,7 +550,7 @@ contract FxBridgeLogicETH is return keccak256(data); } - function verifyBridgeCall( + function verifySubmitBridgeCall( address[] memory _currentOracles, uint256[] memory _currentPowers, uint8[] memory _v, @@ -581,11 +574,6 @@ contract FxBridgeLogicETH is "Token not match amount" ); - require( - _input.tokens.length > 0 || _input.data.length > 0, - "Token and data both empty" - ); - require( _currentOracles.length == _currentPowers.length && _currentOracles.length == _v.length && @@ -621,11 +609,13 @@ contract FxBridgeLogicETH is BridgeCallData memory _input ) public onlySelf { if (_input.tokens.length > 0) { - address _receiver = _input.receiver; - bool isRefund = _input.eventNonce > 0; - if (isRefund) { - _receiver = _input.sender; + require(_input.refund != address(0), "Refund address is empty"); + + address _receiver = _input.to; + if (_input.eventNonce > 0) { + _receiver = _input.refund; } + _transferERC20( address(this), _receiver, @@ -633,22 +623,15 @@ contract FxBridgeLogicETH is _input.amounts ); - if (isRefund) { - if (_input.sender.isContract()) { - IRefundCallback(_input.sender).refundCallback( - _input.eventNonce, - _input.tokens, - _input.amounts - ); - } + if (_input.eventNonce > 0) { return; } } - if (_input.data.length > 0) { + if (_input.to.isContract()) { IBridgeCallback(_input.to).bridgeCallback( _input.sender, - _input.receiver, + _input.refund, _input.tokens, _input.amounts, _input.data, @@ -868,7 +851,7 @@ contract FxBridgeLogicETH is event BridgeCallEvent( address indexed _sender, - address indexed _receiver, + address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, @@ -881,10 +864,7 @@ contract FxBridgeLogicETH is ); event SubmitBridgeCallEvent( - address indexed _sender, - address indexed _receiver, - address indexed _to, - address _txOrigin, + address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, diff --git a/solidity/contracts/bridge/IBridgeCall.sol b/solidity/contracts/bridge/IBridgeCall.sol index 6de88a2c..9eaca8c1 100644 --- a/solidity/contracts/bridge/IBridgeCall.sol +++ b/solidity/contracts/bridge/IBridgeCall.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; interface IBridgeCall { function bridgeCall( string memory _dstChain, - address _receiver, + address _refund, address[] memory _tokens, uint256[] memory _amounts, address _to, diff --git a/solidity/contracts/bridge/IBridgeCallback.sol b/solidity/contracts/bridge/IBridgeCallback.sol index 00c436e9..8fc19535 100644 --- a/solidity/contracts/bridge/IBridgeCallback.sol +++ b/solidity/contracts/bridge/IBridgeCallback.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; interface IBridgeCallback { function bridgeCallback( address _sender, - address _receiver, + address _refund, address[] memory _tokens, uint256[] memory _amounts, bytes memory _data, diff --git a/solidity/contracts/bridge/IFxBridgeLogic.sol b/solidity/contracts/bridge/IFxBridgeLogic.sol index f5d1d1fc..c1aa8a89 100644 --- a/solidity/contracts/bridge/IFxBridgeLogic.sol +++ b/solidity/contracts/bridge/IFxBridgeLogic.sol @@ -49,7 +49,7 @@ interface IFxBridgeLogic is IBridgeCall { struct BridgeCallData { address sender; - address receiver; + address refund; address[] tokens; uint256[] amounts; address to; @@ -182,7 +182,7 @@ interface IFxBridgeLogic is IBridgeCall { bytes32 _fxbridgeId, bytes32 _methodName, address _sender, - address _receiver, + address _refund, address[] memory _tokens, uint256[] memory _amounts, address _to, @@ -226,7 +226,7 @@ interface IFxBridgeLogic is IBridgeCall { event BridgeCallEvent( address indexed _sender, - address indexed _receiver, + address indexed _refund, address indexed _to, address _txOrigin, uint256 _value, @@ -239,10 +239,7 @@ interface IFxBridgeLogic is IBridgeCall { ); event SubmitBridgeCallEvent( - address indexed _sender, - address indexed _receiver, - address indexed _to, - address _txOrigin, + address indexed _txOrigin, uint256 _nonce, uint256 _eventNonce, bool _success, diff --git a/solidity/contracts/bridge/IRefundCallback.sol b/solidity/contracts/bridge/IRefundCallback.sol deleted file mode 100644 index f745e958..00000000 --- a/solidity/contracts/bridge/IRefundCallback.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -interface IRefundCallback { - function refundCallback( - uint256 _eventNonce, - address[] memory _tokens, - uint256[] memory _amounts - ) external; -} diff --git a/solidity/contracts/test/BridgeCallbackTest.sol b/solidity/contracts/test/BridgeCallbackTest.sol index 17732776..6714695c 100644 --- a/solidity/contracts/test/BridgeCallbackTest.sol +++ b/solidity/contracts/test/BridgeCallbackTest.sol @@ -2,12 +2,8 @@ pragma solidity ^0.8.0; import {IBridgeCallback} from "../bridge/IBridgeCallback.sol"; -import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; -import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; contract BridgeCallbackTest is IBridgeCallback { - using SafeERC20Upgradeable for IERC20MetadataUpgradeable; - address public fxBridge; address public admin; mapping(address => bool) public whiteList; @@ -23,20 +19,12 @@ contract BridgeCallbackTest is IBridgeCallback { function bridgeCallback( address, - address _receiver, - address[] memory _tokens, - uint256[] memory _amounts, + address, + address[] memory, + uint256[] memory, bytes memory _data, bytes memory ) external override onlyFxBridge { - for (uint256 i = 0; i < _tokens.length; i++) { - IERC20MetadataUpgradeable(_tokens[i]).transferFrom( - _receiver, - address(this), - _amounts[i] - ); - } - (address to, bytes memory data) = abi.decode(_data, (address, bytes)); // solhint-disable custom-errors require(whiteList[to], "not in white list"); diff --git a/solidity/contracts/test/RefundCallbackTest.sol b/solidity/contracts/test/RefundCallbackTest.sol deleted file mode 100644 index ab939211..00000000 --- a/solidity/contracts/test/RefundCallbackTest.sol +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -import {IRefundCallback} from "../bridge/IRefundCallback.sol"; -import {IERC20MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; -import {SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; - -/* solhint-disable custom-errors */ - -contract RefundCallbackTest is IRefundCallback { - using SafeERC20Upgradeable for IERC20MetadataUpgradeable; - - address public admin; - address public fxBridge; - mapping(uint256 => address) public eventRefund; - - constructor(address _fxBridge) { - admin = msg.sender; - fxBridge = _fxBridge; - } - - function setEventNonceRefund( - uint256 _eventNonce, - address _refundAddr - ) public onlyAdmin { - eventRefund[_eventNonce] = _refundAddr; - } - - function refundCallback( - uint256 _eventNonce, - address[] memory _tokens, - uint256[] memory _amounts - ) external override onlyFxBridge { - address receiver = eventRefund[_eventNonce]; - if (receiver == address(0)) { - return; - } - for (uint256 i = 0; i < _tokens.length; i++) { - IERC20MetadataUpgradeable(_tokens[i]).safeTransfer( - receiver, - _amounts[i] - ); - } - } - - modifier onlyAdmin() { - require(msg.sender == admin, "only admin"); - _; - } - - modifier onlyFxBridge() { - require(msg.sender == fxBridge, "only fx bridge"); - _; - } -} diff --git a/solidity/test/submit_bridge_call.ts b/solidity/test/submit_bridge_call.ts index 50a07ee3..e428dc17 100644 --- a/solidity/test/submit_bridge_call.ts +++ b/solidity/test/submit_bridge_call.ts @@ -5,10 +5,9 @@ import { ERC20TokenTest, FxBridgeLogic, BridgeCallbackTest, - RefundCallbackTest, DataCallbackTest, } from "../typechain-types"; -import { ZeroAddress, MaxUint256, encodeBytes32String, AbiCoder } from "ethers"; +import { encodeBytes32String, AbiCoder } from "ethers"; import { encodeFunctionData, getSignerAddresses, @@ -24,7 +23,6 @@ describe("submit bridge call tests", function () { let fxBridge: FxBridgeLogic; let bridgeCallback: BridgeCallbackTest; let dataCallback: DataCallbackTest; - let refundCallback: RefundCallbackTest; let totalSupply = "10000"; const gravityId: string = encodeBytes32String("eth-fxcore"); @@ -112,18 +110,11 @@ describe("submit bridge call tests", function () { ); await bridgeCallback.addWhiteList(await dataCallback.getAddress()); - - const refundCallbackFactory = await ethers.getContractFactory( - "RefundCallbackTest" - ); - refundCallback = await refundCallbackFactory - .connect(admin) - .deploy(await fxBridge.getAddress()); }); async function submitBridgeCall( sender: string, - receiver: string, + refund: string, to: string, data: string, memo: string, @@ -135,7 +126,7 @@ describe("submit bridge call tests", function () { const digest = makeSubmitBridgeCallHash( gravityId, sender, - receiver, + refund, tokens, amounts, to, @@ -150,7 +141,7 @@ describe("submit bridge call tests", function () { const bridgeCallData: FxBridgeLogic.BridgeCallDataStruct = { sender: sender, - receiver: receiver, + refund: refund, tokens: tokens, amounts: amounts, to: to, @@ -178,7 +169,7 @@ describe("submit bridge call tests", function () { await submitBridgeCall( user1.address, user1.address, - ZeroAddress, + user1.address, "0x", "0x", [erc20TokenAddress], @@ -207,7 +198,6 @@ describe("submit bridge call tests", function () { await fxBridge.getAddress(), ethers.parseEther("1") ); - await erc20Token.connect(user1).approve(bridgeCallbackAddress, MaxUint256); const ownerBal1 = await erc20Token.balanceOf(bridgeCallbackAddress); expect(await dataCallback.id()).to.be.equal(0); @@ -223,29 +213,25 @@ describe("submit bridge call tests", function () { 0 ); const ownerBal2 = await erc20Token.balanceOf(bridgeCallbackAddress); - expect(ownerBal2).to.equal(ownerBal1 + amount); + expect(ownerBal2).to.equal(ownerBal1 + BigInt(amount)); expect(await dataCallback.id()).to.be.equal(99); }); - it("submit bridge call with refund callback", async function () { + it("submit bridge call with refund", async function () { const erc20TokenAddress = await erc20Token.getAddress(); const amount = "1000"; const timeout = (await ethers.provider.getBlockNumber()) + 1000; - const refundCallbackAddress = await refundCallback.getAddress(); - const eventNonce = "1"; await erc20Token.transfer( await fxBridge.getAddress(), ethers.parseEther("1") ); - await refundCallback.setEventNonceRefund(eventNonce, admin.address); - - const ownerBal1 = await erc20Token.balanceOf(admin.address); + const ownerBal1 = await erc20Token.balanceOf(user1.address); await submitBridgeCall( - refundCallbackAddress, user1.address, - ZeroAddress, + user1.address, + user1.address, "0x", "0x", [erc20TokenAddress], @@ -253,7 +239,7 @@ describe("submit bridge call tests", function () { timeout, 1 ); - const ownerBal2 = await erc20Token.balanceOf(admin.address); + const ownerBal2 = await erc20Token.balanceOf(user1.address); expect(ownerBal2).to.equal(ownerBal1 + amount); }); @@ -327,7 +313,7 @@ describe("submit bridge call tests", function () { await submitBridgeCall( user1.address, user1.address, - ZeroAddress, + user1.address, "0x", "0x", tokens, @@ -349,7 +335,7 @@ describe("submit bridge call tests", function () { await submitBridgeCall( user1.address, user1.address, - ZeroAddress, + user1.address, "0x", "0x", tokens, @@ -372,7 +358,7 @@ describe("submit bridge call tests", function () { await submitBridgeCall( user1.address, user1.address, - ZeroAddress, + user1.address, "0x", "0x", tokens, diff --git a/x/evm/precompiles/crosschain/bridge_call_test.go b/x/evm/precompiles/crosschain/bridge_call_test.go index 3f920b28..0719d87c 100644 --- a/x/evm/precompiles/crosschain/bridge_call_test.go +++ b/x/evm/precompiles/crosschain/bridge_call_test.go @@ -20,7 +20,7 @@ func TestContract_BridgeCall_Input(t *testing.T) { inputs := crosschain.BridgeCallMethod.Inputs type Args struct { DstChain string - Receiver common.Address + Refund common.Address Tokens []common.Address Amounts []*big.Int To common.Address @@ -30,7 +30,7 @@ func TestContract_BridgeCall_Input(t *testing.T) { } args := Args{ DstChain: "eth", - Receiver: helpers.GenHexAddress(), + Refund: helpers.GenHexAddress(), Tokens: []common.Address{ helpers.GenHexAddress(), }, @@ -44,7 +44,7 @@ func TestContract_BridgeCall_Input(t *testing.T) { } inputData, err := inputs.Pack( args.DstChain, - args.Receiver, + args.Refund, args.Tokens, args.Amounts, args.To,