Commit e865d202 authored by vicotor's avatar vicotor

add swap token config support.

parent b086b896
...@@ -54,6 +54,10 @@ func (s *ChainSync) ParseTokenConfigChanged(log *types.Log) (*bridge.BridgeContr ...@@ -54,6 +54,10 @@ func (s *ChainSync) ParseTokenConfigChanged(log *types.Log) (*bridge.BridgeContr
return s.bridgeCa.ParseTokenOutConfigChanged(*log) return s.bridgeCa.ParseTokenOutConfigChanged(*log)
} }
func (s *ChainSync) ParseSwapConfigChanged(log *types.Log) (*bridge.BridgeContractSwapConfigChanged, error) {
return s.bridgeCa.ParseSwapConfigChanged(*log)
}
func (s *ChainSync) GetReceiveToken(token common.Address, toChainId int64) (string, error) { func (s *ChainSync) GetReceiveToken(token common.Address, toChainId int64) (string, error) {
callOpt := &bind.CallOpts{ callOpt := &bind.CallOpts{
BlockNumber: nil, BlockNumber: nil,
...@@ -206,6 +210,7 @@ func (s *ChainSync) SyncLogs(beginHeight, endHeight int64) error { ...@@ -206,6 +210,7 @@ func (s *ChainSync) SyncLogs(beginHeight, endHeight int64) error {
dao.TransferInRejectionEvent.ID.Hex(), dao.TransferInRejectionEvent.ID.Hex(),
dao.TransferInExecutionEvent.ID.Hex(), dao.TransferInExecutionEvent.ID.Hex(),
dao.TokenConfigChangedEvent.ID.Hex(), dao.TokenConfigChangedEvent.ID.Hex(),
dao.SwapConfigChangedEvent.ID.Hex(),
} }
logs, err := s.d.GetLogs(s.chain, beginHeight, endHeight, topics, []string{ logs, err := s.d.GetLogs(s.chain, beginHeight, endHeight, topics, []string{
......
...@@ -46,6 +46,7 @@ const ( ...@@ -46,6 +46,7 @@ const (
EVENT_TRANSFER_IN_REJECTION = "TransferInRejection" EVENT_TRANSFER_IN_REJECTION = "TransferInRejection"
EVENT_TRANSFER_IN_EXECUTION = "TransferInExecution" EVENT_TRANSFER_IN_EXECUTION = "TransferInExecution"
EVENT_TOKENCONFIGCHANGED = "TokenOutConfigChanged" EVENT_TOKENCONFIGCHANGED = "TokenOutConfigChanged"
EVENT_SWAPCONFIGCHANGED = "SwapConfigChanged"
) )
type ValidatorOp int type ValidatorOp int
......
...@@ -54,7 +54,7 @@ type BridgesubmitParams struct { ...@@ -54,7 +54,7 @@ type BridgesubmitParams struct {
// BridgeContractMetaData contains all meta data concerning the BridgeContract contract. // BridgeContractMetaData contains all meta data concerning the BridgeContract contract.
var BridgeContractMetaData = &bind.MetaData{ var BridgeContractMetaData = &bind.MetaData{
ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialOwner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"prior\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"present\",\"type\":\"uint256\"}],\"name\":\"RequirementChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"TokenOutConfigChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferIn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"TransferInConfirmation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferInExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"TransferInRejection\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"}],\"name\":\"TransferOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTreasury\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"TreasuryChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"TreasuryConfigChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"treasuryBalance\",\"type\":\"uint256\"}],\"name\":\"TreasuryTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ValidatorAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ValidatorRemoval\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_inID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_outID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"addValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"autoTransferToTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"calculateTreasuryTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canTransfer\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"willReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isBurn\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"internalType\":\"structBridge.OutConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"changeOutConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"required\",\"type\":\"uint256\"}],\"name\":\"changeValidRequired\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"confirmInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emergencyWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"getInId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"}],\"name\":\"getSupportedTokensOut\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"inTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"inTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"executed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"confirmCounter\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rejectCounter\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"isChecked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"isConfirmed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"isRejected\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTokenSupportedOut\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"}],\"name\":\"isTokenTransferEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outConfiguration\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isBurn\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"outTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"outTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"receiveAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"signature\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"rejectInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"removeValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newValidator\",\"type\":\"address\"}],\"name\":\"replaceValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"retryTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setTreasuryConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sendToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"signature\",\"type\":\"bytes32\"}],\"internalType\":\"structBridge.submitParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"submitInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"supportedTokensOut\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"treasuryConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"treasuryTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validRequired\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldReceiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newReceiver\",\"type\":\"address\"}],\"name\":\"FeeReceiverChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"prior\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"present\",\"type\":\"uint256\"}],\"name\":\"RequirementChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"swap\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"SwapConfigChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"TokenOutConfigChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferIn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"TransferInConfirmation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TransferInExecution\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"TransferInRejection\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"}],\"name\":\"TransferOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldTreasury\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"TreasuryChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"TreasuryConfigChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"treasuryBalance\",\"type\":\"uint256\"}],\"name\":\"TreasuryTransfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ValidatorAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ValidatorRemoval\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"_inID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_outID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"addValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"autoTransferToTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"calculateTreasuryTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canTransfer\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"transferAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"willReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentBalance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isBurn\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"internalType\":\"structBridge.OutConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"changeOutConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"required\",\"type\":\"uint256\"}],\"name\":\"changeValidRequired\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"confirmInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"emergencyWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeReceiver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"getInId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"}],\"name\":\"getSupportedTokensOut\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"inTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"inTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"executed\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"confirmCounter\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rejectCounter\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialOwner\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"isChecked\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"isConfirmed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"isRejected\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTokenSupportedOut\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"}],\"name\":\"isTokenTransferEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outConfiguration\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"limit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isBurn\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"outTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"outTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outTransfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"receiveToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"receiveAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"signature\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"}],\"name\":\"rejectInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"removeValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newValidator\",\"type\":\"address\"}],\"name\":\"replaceValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"inId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"retryTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newReceiver\",\"type\":\"address\"}],\"name\":\"setFeeReceiver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"setTreasuryConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"toChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"outId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fromChainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sendToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"sendAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"signature\",\"type\":\"bytes32\"}],\"internalType\":\"structBridge.submitParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"submitInTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"supportedTokensOut\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"treasuryConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"minReserve\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveRatio\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"treasuryTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validRequired\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
} }
// BridgeContractABI is the input ABI used to generate the binding from. // BridgeContractABI is the input ABI used to generate the binding from.
...@@ -320,6 +320,37 @@ func (_BridgeContract *BridgeContractCallerSession) CalculateTreasuryTransfer(to ...@@ -320,6 +320,37 @@ func (_BridgeContract *BridgeContractCallerSession) CalculateTreasuryTransfer(to
return _BridgeContract.Contract.CalculateTreasuryTransfer(&_BridgeContract.CallOpts, token) return _BridgeContract.Contract.CalculateTreasuryTransfer(&_BridgeContract.CallOpts, token)
} }
// FeeReceiver is a free data retrieval call binding the contract method 0xb3f00674.
//
// Solidity: function feeReceiver() view returns(address)
func (_BridgeContract *BridgeContractCaller) FeeReceiver(opts *bind.CallOpts) (common.Address, error) {
var out []interface{}
err := _BridgeContract.contract.Call(opts, &out, "feeReceiver")
if err != nil {
return *new(common.Address), err
}
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err
}
// FeeReceiver is a free data retrieval call binding the contract method 0xb3f00674.
//
// Solidity: function feeReceiver() view returns(address)
func (_BridgeContract *BridgeContractSession) FeeReceiver() (common.Address, error) {
return _BridgeContract.Contract.FeeReceiver(&_BridgeContract.CallOpts)
}
// FeeReceiver is a free data retrieval call binding the contract method 0xb3f00674.
//
// Solidity: function feeReceiver() view returns(address)
func (_BridgeContract *BridgeContractCallerSession) FeeReceiver() (common.Address, error) {
return _BridgeContract.Contract.FeeReceiver(&_BridgeContract.CallOpts)
}
// GetInId is a free data retrieval call binding the contract method 0x9f4faadf. // GetInId is a free data retrieval call binding the contract method 0x9f4faadf.
// //
// Solidity: function getInId(uint256 , uint256 ) view returns(uint256) // Solidity: function getInId(uint256 , uint256 ) view returns(uint256)
...@@ -896,6 +927,37 @@ func (_BridgeContract *BridgeContractCallerSession) Owner() (common.Address, err ...@@ -896,6 +927,37 @@ func (_BridgeContract *BridgeContractCallerSession) Owner() (common.Address, err
return _BridgeContract.Contract.Owner(&_BridgeContract.CallOpts) return _BridgeContract.Contract.Owner(&_BridgeContract.CallOpts)
} }
// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d.
//
// Solidity: function proxiableUUID() view returns(bytes32)
func (_BridgeContract *BridgeContractCaller) ProxiableUUID(opts *bind.CallOpts) ([32]byte, error) {
var out []interface{}
err := _BridgeContract.contract.Call(opts, &out, "proxiableUUID")
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d.
//
// Solidity: function proxiableUUID() view returns(bytes32)
func (_BridgeContract *BridgeContractSession) ProxiableUUID() ([32]byte, error) {
return _BridgeContract.Contract.ProxiableUUID(&_BridgeContract.CallOpts)
}
// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d.
//
// Solidity: function proxiableUUID() view returns(bytes32)
func (_BridgeContract *BridgeContractCallerSession) ProxiableUUID() ([32]byte, error) {
return _BridgeContract.Contract.ProxiableUUID(&_BridgeContract.CallOpts)
}
// SupportedTokensOut is a free data retrieval call binding the contract method 0xfee324de. // SupportedTokensOut is a free data retrieval call binding the contract method 0xfee324de.
// //
// Solidity: function supportedTokensOut(uint256 , uint256 ) view returns(address) // Solidity: function supportedTokensOut(uint256 , uint256 ) view returns(address)
...@@ -1196,6 +1258,27 @@ func (_BridgeContract *BridgeContractTransactorSession) EmergencyWithdraw(token ...@@ -1196,6 +1258,27 @@ func (_BridgeContract *BridgeContractTransactorSession) EmergencyWithdraw(token
return _BridgeContract.Contract.EmergencyWithdraw(&_BridgeContract.TransactOpts, token, amount, to) return _BridgeContract.Contract.EmergencyWithdraw(&_BridgeContract.TransactOpts, token, amount, to)
} }
// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8.
//
// Solidity: function initialize(address initialOwner) returns()
func (_BridgeContract *BridgeContractTransactor) Initialize(opts *bind.TransactOpts, initialOwner common.Address) (*types.Transaction, error) {
return _BridgeContract.contract.Transact(opts, "initialize", initialOwner)
}
// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8.
//
// Solidity: function initialize(address initialOwner) returns()
func (_BridgeContract *BridgeContractSession) Initialize(initialOwner common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.Initialize(&_BridgeContract.TransactOpts, initialOwner)
}
// Initialize is a paid mutator transaction binding the contract method 0xc4d66de8.
//
// Solidity: function initialize(address initialOwner) returns()
func (_BridgeContract *BridgeContractTransactorSession) Initialize(initialOwner common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.Initialize(&_BridgeContract.TransactOpts, initialOwner)
}
// OutTransfer is a paid mutator transaction binding the contract method 0xb2351737. // OutTransfer is a paid mutator transaction binding the contract method 0xb2351737.
// //
// Solidity: function outTransfer(address token, uint256 amount, uint256 toChainID, address receiver) returns() // Solidity: function outTransfer(address token, uint256 amount, uint256 toChainID, address receiver) returns()
...@@ -1322,6 +1405,27 @@ func (_BridgeContract *BridgeContractTransactorSession) RetryTransfer(inId *big. ...@@ -1322,6 +1405,27 @@ func (_BridgeContract *BridgeContractTransactorSession) RetryTransfer(inId *big.
return _BridgeContract.Contract.RetryTransfer(&_BridgeContract.TransactOpts, inId, receiver, token, amount) return _BridgeContract.Contract.RetryTransfer(&_BridgeContract.TransactOpts, inId, receiver, token, amount)
} }
// SetFeeReceiver is a paid mutator transaction binding the contract method 0xefdcd974.
//
// Solidity: function setFeeReceiver(address newReceiver) returns()
func (_BridgeContract *BridgeContractTransactor) SetFeeReceiver(opts *bind.TransactOpts, newReceiver common.Address) (*types.Transaction, error) {
return _BridgeContract.contract.Transact(opts, "setFeeReceiver", newReceiver)
}
// SetFeeReceiver is a paid mutator transaction binding the contract method 0xefdcd974.
//
// Solidity: function setFeeReceiver(address newReceiver) returns()
func (_BridgeContract *BridgeContractSession) SetFeeReceiver(newReceiver common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.SetFeeReceiver(&_BridgeContract.TransactOpts, newReceiver)
}
// SetFeeReceiver is a paid mutator transaction binding the contract method 0xefdcd974.
//
// Solidity: function setFeeReceiver(address newReceiver) returns()
func (_BridgeContract *BridgeContractTransactorSession) SetFeeReceiver(newReceiver common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.SetFeeReceiver(&_BridgeContract.TransactOpts, newReceiver)
}
// SetTreasury is a paid mutator transaction binding the contract method 0xf0f44260. // SetTreasury is a paid mutator transaction binding the contract method 0xf0f44260.
// //
// Solidity: function setTreasury(address newTreasury) returns() // Solidity: function setTreasury(address newTreasury) returns()
...@@ -1399,11 +1503,485 @@ func (_BridgeContract *BridgeContractSession) TransferOwnership(newOwner common. ...@@ -1399,11 +1503,485 @@ func (_BridgeContract *BridgeContractSession) TransferOwnership(newOwner common.
return _BridgeContract.Contract.TransferOwnership(&_BridgeContract.TransactOpts, newOwner) return _BridgeContract.Contract.TransferOwnership(&_BridgeContract.TransactOpts, newOwner)
} }
// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b.
//
// Solidity: function transferOwnership(address newOwner) returns()
func (_BridgeContract *BridgeContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.TransferOwnership(&_BridgeContract.TransactOpts, newOwner)
}
// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6.
//
// Solidity: function upgradeTo(address newImplementation) returns()
func (_BridgeContract *BridgeContractTransactor) UpgradeTo(opts *bind.TransactOpts, newImplementation common.Address) (*types.Transaction, error) {
return _BridgeContract.contract.Transact(opts, "upgradeTo", newImplementation)
}
// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6.
//
// Solidity: function upgradeTo(address newImplementation) returns()
func (_BridgeContract *BridgeContractSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.UpgradeTo(&_BridgeContract.TransactOpts, newImplementation)
}
// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6.
//
// Solidity: function upgradeTo(address newImplementation) returns()
func (_BridgeContract *BridgeContractTransactorSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) {
return _BridgeContract.Contract.UpgradeTo(&_BridgeContract.TransactOpts, newImplementation)
}
// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286.
//
// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns()
func (_BridgeContract *BridgeContractTransactor) UpgradeToAndCall(opts *bind.TransactOpts, newImplementation common.Address, data []byte) (*types.Transaction, error) {
return _BridgeContract.contract.Transact(opts, "upgradeToAndCall", newImplementation, data)
}
// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286.
//
// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns()
func (_BridgeContract *BridgeContractSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) {
return _BridgeContract.Contract.UpgradeToAndCall(&_BridgeContract.TransactOpts, newImplementation, data)
}
// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286.
//
// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns()
func (_BridgeContract *BridgeContractTransactorSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) {
return _BridgeContract.Contract.UpgradeToAndCall(&_BridgeContract.TransactOpts, newImplementation, data)
}
// BridgeContractAdminChangedIterator is returned from FilterAdminChanged and is used to iterate over the raw logs and unpacked data for AdminChanged events raised by the BridgeContract contract.
type BridgeContractAdminChangedIterator struct {
Event *BridgeContractAdminChanged // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *BridgeContractAdminChangedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(BridgeContractAdminChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(BridgeContractAdminChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *BridgeContractAdminChangedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *BridgeContractAdminChangedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// BridgeContractAdminChanged represents a AdminChanged event raised by the BridgeContract contract.
type BridgeContractAdminChanged struct {
PreviousAdmin common.Address
NewAdmin common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterAdminChanged is a free log retrieval operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f.
//
// Solidity: event AdminChanged(address previousAdmin, address newAdmin)
func (_BridgeContract *BridgeContractFilterer) FilterAdminChanged(opts *bind.FilterOpts) (*BridgeContractAdminChangedIterator, error) {
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "AdminChanged")
if err != nil {
return nil, err
}
return &BridgeContractAdminChangedIterator{contract: _BridgeContract.contract, event: "AdminChanged", logs: logs, sub: sub}, nil
}
// WatchAdminChanged is a free log subscription operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f.
//
// Solidity: event AdminChanged(address previousAdmin, address newAdmin)
func (_BridgeContract *BridgeContractFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *BridgeContractAdminChanged) (event.Subscription, error) {
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "AdminChanged")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(BridgeContractAdminChanged)
if err := _BridgeContract.contract.UnpackLog(event, "AdminChanged", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseAdminChanged is a log parse operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f.
//
// Solidity: event AdminChanged(address previousAdmin, address newAdmin)
func (_BridgeContract *BridgeContractFilterer) ParseAdminChanged(log types.Log) (*BridgeContractAdminChanged, error) {
event := new(BridgeContractAdminChanged)
if err := _BridgeContract.contract.UnpackLog(event, "AdminChanged", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}
// BridgeContractBeaconUpgradedIterator is returned from FilterBeaconUpgraded and is used to iterate over the raw logs and unpacked data for BeaconUpgraded events raised by the BridgeContract contract.
type BridgeContractBeaconUpgradedIterator struct {
Event *BridgeContractBeaconUpgraded // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *BridgeContractBeaconUpgradedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(BridgeContractBeaconUpgraded)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(BridgeContractBeaconUpgraded)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *BridgeContractBeaconUpgradedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *BridgeContractBeaconUpgradedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// BridgeContractBeaconUpgraded represents a BeaconUpgraded event raised by the BridgeContract contract.
type BridgeContractBeaconUpgraded struct {
Beacon common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterBeaconUpgraded is a free log retrieval operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e.
//
// Solidity: event BeaconUpgraded(address indexed beacon)
func (_BridgeContract *BridgeContractFilterer) FilterBeaconUpgraded(opts *bind.FilterOpts, beacon []common.Address) (*BridgeContractBeaconUpgradedIterator, error) {
var beaconRule []interface{}
for _, beaconItem := range beacon {
beaconRule = append(beaconRule, beaconItem)
}
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "BeaconUpgraded", beaconRule)
if err != nil {
return nil, err
}
return &BridgeContractBeaconUpgradedIterator{contract: _BridgeContract.contract, event: "BeaconUpgraded", logs: logs, sub: sub}, nil
}
// WatchBeaconUpgraded is a free log subscription operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e.
//
// Solidity: event BeaconUpgraded(address indexed beacon)
func (_BridgeContract *BridgeContractFilterer) WatchBeaconUpgraded(opts *bind.WatchOpts, sink chan<- *BridgeContractBeaconUpgraded, beacon []common.Address) (event.Subscription, error) {
var beaconRule []interface{}
for _, beaconItem := range beacon {
beaconRule = append(beaconRule, beaconItem)
}
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "BeaconUpgraded", beaconRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(BridgeContractBeaconUpgraded)
if err := _BridgeContract.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseBeaconUpgraded is a log parse operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e.
//
// Solidity: event BeaconUpgraded(address indexed beacon)
func (_BridgeContract *BridgeContractFilterer) ParseBeaconUpgraded(log types.Log) (*BridgeContractBeaconUpgraded, error) {
event := new(BridgeContractBeaconUpgraded)
if err := _BridgeContract.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}
// BridgeContractFeeReceiverChangedIterator is returned from FilterFeeReceiverChanged and is used to iterate over the raw logs and unpacked data for FeeReceiverChanged events raised by the BridgeContract contract.
type BridgeContractFeeReceiverChangedIterator struct {
Event *BridgeContractFeeReceiverChanged // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *BridgeContractFeeReceiverChangedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(BridgeContractFeeReceiverChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(BridgeContractFeeReceiverChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *BridgeContractFeeReceiverChangedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *BridgeContractFeeReceiverChangedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// BridgeContractFeeReceiverChanged represents a FeeReceiverChanged event raised by the BridgeContract contract.
type BridgeContractFeeReceiverChanged struct {
OldReceiver common.Address
NewReceiver common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterFeeReceiverChanged is a free log retrieval operation binding the contract event 0xa4b009cc442411b602eaf94bc0579b6abdb8fd90b4ef5b9426e270038906bd03.
//
// Solidity: event FeeReceiverChanged(address indexed oldReceiver, address indexed newReceiver)
func (_BridgeContract *BridgeContractFilterer) FilterFeeReceiverChanged(opts *bind.FilterOpts, oldReceiver []common.Address, newReceiver []common.Address) (*BridgeContractFeeReceiverChangedIterator, error) {
var oldReceiverRule []interface{}
for _, oldReceiverItem := range oldReceiver {
oldReceiverRule = append(oldReceiverRule, oldReceiverItem)
}
var newReceiverRule []interface{}
for _, newReceiverItem := range newReceiver {
newReceiverRule = append(newReceiverRule, newReceiverItem)
}
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "FeeReceiverChanged", oldReceiverRule, newReceiverRule)
if err != nil {
return nil, err
}
return &BridgeContractFeeReceiverChangedIterator{contract: _BridgeContract.contract, event: "FeeReceiverChanged", logs: logs, sub: sub}, nil
}
// WatchFeeReceiverChanged is a free log subscription operation binding the contract event 0xa4b009cc442411b602eaf94bc0579b6abdb8fd90b4ef5b9426e270038906bd03.
//
// Solidity: event FeeReceiverChanged(address indexed oldReceiver, address indexed newReceiver)
func (_BridgeContract *BridgeContractFilterer) WatchFeeReceiverChanged(opts *bind.WatchOpts, sink chan<- *BridgeContractFeeReceiverChanged, oldReceiver []common.Address, newReceiver []common.Address) (event.Subscription, error) {
var oldReceiverRule []interface{}
for _, oldReceiverItem := range oldReceiver {
oldReceiverRule = append(oldReceiverRule, oldReceiverItem)
}
var newReceiverRule []interface{}
for _, newReceiverItem := range newReceiver {
newReceiverRule = append(newReceiverRule, newReceiverItem)
}
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "FeeReceiverChanged", oldReceiverRule, newReceiverRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(BridgeContractFeeReceiverChanged)
if err := _BridgeContract.contract.UnpackLog(event, "FeeReceiverChanged", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseFeeReceiverChanged is a log parse operation binding the contract event 0xa4b009cc442411b602eaf94bc0579b6abdb8fd90b4ef5b9426e270038906bd03.
// //
// Solidity: function transferOwnership(address newOwner) returns() // Solidity: event FeeReceiverChanged(address indexed oldReceiver, address indexed newReceiver)
func (_BridgeContract *BridgeContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { func (_BridgeContract *BridgeContractFilterer) ParseFeeReceiverChanged(log types.Log) (*BridgeContractFeeReceiverChanged, error) {
return _BridgeContract.Contract.TransferOwnership(&_BridgeContract.TransactOpts, newOwner) event := new(BridgeContractFeeReceiverChanged)
if err := _BridgeContract.contract.UnpackLog(event, "FeeReceiverChanged", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
} }
// BridgeContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the BridgeContract contract. // BridgeContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the BridgeContract contract.
...@@ -1694,6 +2272,169 @@ func (_BridgeContract *BridgeContractFilterer) ParseRequirementChange(log types. ...@@ -1694,6 +2272,169 @@ func (_BridgeContract *BridgeContractFilterer) ParseRequirementChange(log types.
return event, nil return event, nil
} }
// BridgeContractSwapConfigChangedIterator is returned from FilterSwapConfigChanged and is used to iterate over the raw logs and unpacked data for SwapConfigChanged events raised by the BridgeContract contract.
type BridgeContractSwapConfigChangedIterator struct {
Event *BridgeContractSwapConfigChanged // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *BridgeContractSwapConfigChangedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(BridgeContractSwapConfigChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(BridgeContractSwapConfigChanged)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *BridgeContractSwapConfigChangedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *BridgeContractSwapConfigChangedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// BridgeContractSwapConfigChanged represents a SwapConfigChanged event raised by the BridgeContract contract.
type BridgeContractSwapConfigChanged struct {
FromToken common.Address
ToToken common.Address
Swap common.Address
Path []common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterSwapConfigChanged is a free log retrieval operation binding the contract event 0x5fef9e8e618fa4e60160d3721f2bae8240bd09ede236e2720aae33ae23ff85d8.
//
// Solidity: event SwapConfigChanged(address indexed fromToken, address indexed toToken, address indexed swap, address[] path)
func (_BridgeContract *BridgeContractFilterer) FilterSwapConfigChanged(opts *bind.FilterOpts, fromToken []common.Address, toToken []common.Address, swap []common.Address) (*BridgeContractSwapConfigChangedIterator, error) {
var fromTokenRule []interface{}
for _, fromTokenItem := range fromToken {
fromTokenRule = append(fromTokenRule, fromTokenItem)
}
var toTokenRule []interface{}
for _, toTokenItem := range toToken {
toTokenRule = append(toTokenRule, toTokenItem)
}
var swapRule []interface{}
for _, swapItem := range swap {
swapRule = append(swapRule, swapItem)
}
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "SwapConfigChanged", fromTokenRule, toTokenRule, swapRule)
if err != nil {
return nil, err
}
return &BridgeContractSwapConfigChangedIterator{contract: _BridgeContract.contract, event: "SwapConfigChanged", logs: logs, sub: sub}, nil
}
// WatchSwapConfigChanged is a free log subscription operation binding the contract event 0x5fef9e8e618fa4e60160d3721f2bae8240bd09ede236e2720aae33ae23ff85d8.
//
// Solidity: event SwapConfigChanged(address indexed fromToken, address indexed toToken, address indexed swap, address[] path)
func (_BridgeContract *BridgeContractFilterer) WatchSwapConfigChanged(opts *bind.WatchOpts, sink chan<- *BridgeContractSwapConfigChanged, fromToken []common.Address, toToken []common.Address, swap []common.Address) (event.Subscription, error) {
var fromTokenRule []interface{}
for _, fromTokenItem := range fromToken {
fromTokenRule = append(fromTokenRule, fromTokenItem)
}
var toTokenRule []interface{}
for _, toTokenItem := range toToken {
toTokenRule = append(toTokenRule, toTokenItem)
}
var swapRule []interface{}
for _, swapItem := range swap {
swapRule = append(swapRule, swapItem)
}
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "SwapConfigChanged", fromTokenRule, toTokenRule, swapRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(BridgeContractSwapConfigChanged)
if err := _BridgeContract.contract.UnpackLog(event, "SwapConfigChanged", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseSwapConfigChanged is a log parse operation binding the contract event 0x5fef9e8e618fa4e60160d3721f2bae8240bd09ede236e2720aae33ae23ff85d8.
//
// Solidity: event SwapConfigChanged(address indexed fromToken, address indexed toToken, address indexed swap, address[] path)
func (_BridgeContract *BridgeContractFilterer) ParseSwapConfigChanged(log types.Log) (*BridgeContractSwapConfigChanged, error) {
event := new(BridgeContractSwapConfigChanged)
if err := _BridgeContract.contract.UnpackLog(event, "SwapConfigChanged", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}
// BridgeContractTokenOutConfigChangedIterator is returned from FilterTokenOutConfigChanged and is used to iterate over the raw logs and unpacked data for TokenOutConfigChanged events raised by the BridgeContract contract. // BridgeContractTokenOutConfigChangedIterator is returned from FilterTokenOutConfigChanged and is used to iterate over the raw logs and unpacked data for TokenOutConfigChanged events raised by the BridgeContract contract.
type BridgeContractTokenOutConfigChangedIterator struct { type BridgeContractTokenOutConfigChangedIterator struct {
Event *BridgeContractTokenOutConfigChanged // Event containing the contract specifics and raw log Event *BridgeContractTokenOutConfigChanged // Event containing the contract specifics and raw log
...@@ -2477,10 +3218,23 @@ type BridgeContractTransferOut struct { ...@@ -2477,10 +3218,23 @@ type BridgeContractTransferOut struct {
// FilterTransferOut is a free log retrieval operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8. // FilterTransferOut is a free log retrieval operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8.
// //
// Solidity: event TransferOut(uint256 outId, uint256 fromChainID, address sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken) // Solidity: event TransferOut(uint256 indexed outId, uint256 indexed fromChainID, address indexed sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken)
func (_BridgeContract *BridgeContractFilterer) FilterTransferOut(opts *bind.FilterOpts) (*BridgeContractTransferOutIterator, error) { func (_BridgeContract *BridgeContractFilterer) FilterTransferOut(opts *bind.FilterOpts, outId []*big.Int, fromChainID []*big.Int, sender []common.Address) (*BridgeContractTransferOutIterator, error) {
var outIdRule []interface{}
for _, outIdItem := range outId {
outIdRule = append(outIdRule, outIdItem)
}
var fromChainIDRule []interface{}
for _, fromChainIDItem := range fromChainID {
fromChainIDRule = append(fromChainIDRule, fromChainIDItem)
}
var senderRule []interface{}
for _, senderItem := range sender {
senderRule = append(senderRule, senderItem)
}
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "TransferOut") logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "TransferOut", outIdRule, fromChainIDRule, senderRule)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -2489,10 +3243,23 @@ func (_BridgeContract *BridgeContractFilterer) FilterTransferOut(opts *bind.Filt ...@@ -2489,10 +3243,23 @@ func (_BridgeContract *BridgeContractFilterer) FilterTransferOut(opts *bind.Filt
// WatchTransferOut is a free log subscription operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8. // WatchTransferOut is a free log subscription operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8.
// //
// Solidity: event TransferOut(uint256 outId, uint256 fromChainID, address sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken) // Solidity: event TransferOut(uint256 indexed outId, uint256 indexed fromChainID, address indexed sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken)
func (_BridgeContract *BridgeContractFilterer) WatchTransferOut(opts *bind.WatchOpts, sink chan<- *BridgeContractTransferOut) (event.Subscription, error) { func (_BridgeContract *BridgeContractFilterer) WatchTransferOut(opts *bind.WatchOpts, sink chan<- *BridgeContractTransferOut, outId []*big.Int, fromChainID []*big.Int, sender []common.Address) (event.Subscription, error) {
var outIdRule []interface{}
for _, outIdItem := range outId {
outIdRule = append(outIdRule, outIdItem)
}
var fromChainIDRule []interface{}
for _, fromChainIDItem := range fromChainID {
fromChainIDRule = append(fromChainIDRule, fromChainIDItem)
}
var senderRule []interface{}
for _, senderItem := range sender {
senderRule = append(senderRule, senderItem)
}
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "TransferOut") logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "TransferOut", outIdRule, fromChainIDRule, senderRule)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -2526,7 +3293,7 @@ func (_BridgeContract *BridgeContractFilterer) WatchTransferOut(opts *bind.Watch ...@@ -2526,7 +3293,7 @@ func (_BridgeContract *BridgeContractFilterer) WatchTransferOut(opts *bind.Watch
// ParseTransferOut is a log parse operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8. // ParseTransferOut is a log parse operation binding the contract event 0x031758eba572a89e462cda6992d6b6ed8755f4c4d432b242a95cfccc0b38f8e8.
// //
// Solidity: event TransferOut(uint256 outId, uint256 fromChainID, address sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken) // Solidity: event TransferOut(uint256 indexed outId, uint256 indexed fromChainID, address indexed sender, address token, uint256 amount, uint256 fee, uint256 toChainID, address receiver, address receiveToken)
func (_BridgeContract *BridgeContractFilterer) ParseTransferOut(log types.Log) (*BridgeContractTransferOut, error) { func (_BridgeContract *BridgeContractFilterer) ParseTransferOut(log types.Log) (*BridgeContractTransferOut, error) {
event := new(BridgeContractTransferOut) event := new(BridgeContractTransferOut)
if err := _BridgeContract.contract.UnpackLog(event, "TransferOut", log); err != nil { if err := _BridgeContract.contract.UnpackLog(event, "TransferOut", log); err != nil {
...@@ -2983,6 +3750,150 @@ func (_BridgeContract *BridgeContractFilterer) ParseTreasuryTransfer(log types.L ...@@ -2983,6 +3750,150 @@ func (_BridgeContract *BridgeContractFilterer) ParseTreasuryTransfer(log types.L
return event, nil return event, nil
} }
// BridgeContractUpgradedIterator is returned from FilterUpgraded and is used to iterate over the raw logs and unpacked data for Upgraded events raised by the BridgeContract contract.
type BridgeContractUpgradedIterator struct {
Event *BridgeContractUpgraded // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *BridgeContractUpgradedIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(BridgeContractUpgraded)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(BridgeContractUpgraded)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *BridgeContractUpgradedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *BridgeContractUpgradedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// BridgeContractUpgraded represents a Upgraded event raised by the BridgeContract contract.
type BridgeContractUpgraded struct {
Implementation common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterUpgraded is a free log retrieval operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b.
//
// Solidity: event Upgraded(address indexed implementation)
func (_BridgeContract *BridgeContractFilterer) FilterUpgraded(opts *bind.FilterOpts, implementation []common.Address) (*BridgeContractUpgradedIterator, error) {
var implementationRule []interface{}
for _, implementationItem := range implementation {
implementationRule = append(implementationRule, implementationItem)
}
logs, sub, err := _BridgeContract.contract.FilterLogs(opts, "Upgraded", implementationRule)
if err != nil {
return nil, err
}
return &BridgeContractUpgradedIterator{contract: _BridgeContract.contract, event: "Upgraded", logs: logs, sub: sub}, nil
}
// WatchUpgraded is a free log subscription operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b.
//
// Solidity: event Upgraded(address indexed implementation)
func (_BridgeContract *BridgeContractFilterer) WatchUpgraded(opts *bind.WatchOpts, sink chan<- *BridgeContractUpgraded, implementation []common.Address) (event.Subscription, error) {
var implementationRule []interface{}
for _, implementationItem := range implementation {
implementationRule = append(implementationRule, implementationItem)
}
logs, sub, err := _BridgeContract.contract.WatchLogs(opts, "Upgraded", implementationRule)
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(BridgeContractUpgraded)
if err := _BridgeContract.contract.UnpackLog(event, "Upgraded", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseUpgraded is a log parse operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b.
//
// Solidity: event Upgraded(address indexed implementation)
func (_BridgeContract *BridgeContractFilterer) ParseUpgraded(log types.Log) (*BridgeContractUpgraded, error) {
event := new(BridgeContractUpgraded)
if err := _BridgeContract.contract.UnpackLog(event, "Upgraded", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}
// BridgeContractValidatorAdditionIterator is returned from FilterValidatorAddition and is used to iterate over the raw logs and unpacked data for ValidatorAddition events raised by the BridgeContract contract. // BridgeContractValidatorAdditionIterator is returned from FilterValidatorAddition and is used to iterate over the raw logs and unpacked data for ValidatorAddition events raised by the BridgeContract contract.
type BridgeContractValidatorAdditionIterator struct { type BridgeContractValidatorAdditionIterator struct {
Event *BridgeContractValidatorAddition // Event containing the contract specifics and raw log Event *BridgeContractValidatorAddition // Event containing the contract specifics and raw log
......
[ [
{ {
"anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": false,
"internalType": "address", "internalType": "address",
"name": "initialOwner", "name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address" "type": "address"
} }
], ],
"stateMutability": "nonpayable", "name": "AdminChanged",
"type": "constructor" "type": "event"
}, },
{ {
"anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true,
"internalType": "address", "internalType": "address",
"name": "owner", "name": "beacon",
"type": "address" "type": "address"
} }
], ],
"name": "OwnableInvalidOwner", "name": "BeaconUpgraded",
"type": "error" "type": "event"
}, },
{ {
"anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true,
"internalType": "address",
"name": "oldReceiver",
"type": "address"
},
{
"indexed": true,
"internalType": "address", "internalType": "address",
"name": "account", "name": "newReceiver",
"type": "address" "type": "address"
} }
], ],
"name": "OwnableUnauthorizedAccount", "name": "FeeReceiverChanged",
"type": "error" "type": "event"
}, },
{ {
"anonymous": false, "anonymous": false,
...@@ -70,6 +88,37 @@ ...@@ -70,6 +88,37 @@
"name": "RequirementChange", "name": "RequirementChange",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "swap",
"type": "address"
},
{
"indexed": false,
"internalType": "address[]",
"name": "path",
"type": "address[]"
}
],
"name": "SwapConfigChanged",
"type": "event"
},
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
...@@ -211,19 +260,19 @@ ...@@ -211,19 +260,19 @@
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": false, "indexed": true,
"internalType": "uint256", "internalType": "uint256",
"name": "outId", "name": "outId",
"type": "uint256" "type": "uint256"
}, },
{ {
"indexed": false, "indexed": true,
"internalType": "uint256", "internalType": "uint256",
"name": "fromChainID", "name": "fromChainID",
"type": "uint256" "type": "uint256"
}, },
{ {
"indexed": false, "indexed": true,
"internalType": "address", "internalType": "address",
"name": "sender", "name": "sender",
"type": "address" "type": "address"
...@@ -349,6 +398,19 @@ ...@@ -349,6 +398,19 @@
"name": "TreasuryTransfer", "name": "TreasuryTransfer",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
...@@ -560,6 +622,19 @@ ...@@ -560,6 +622,19 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "feeReceiver",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -686,6 +761,19 @@ ...@@ -686,6 +761,19 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "initialOwner",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -993,6 +1081,19 @@ ...@@ -993,6 +1081,19 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -1072,6 +1173,19 @@ ...@@ -1072,6 +1173,19 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "newReceiver",
"type": "address"
}
],
"name": "setFeeReceiver",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -1276,6 +1390,37 @@ ...@@ -1276,6 +1390,37 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "upgradeToAndCall",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{ {
"inputs": [], "inputs": [],
"name": "validRequired", "name": "validRequired",
......
...@@ -23,6 +23,7 @@ type ChainInterface interface { ...@@ -23,6 +23,7 @@ type ChainInterface interface {
ParseTransferInRejection(log *types.Log) (*bridge.BridgeContractTransferInRejection, error) ParseTransferInRejection(log *types.Log) (*bridge.BridgeContractTransferInRejection, error)
ParseTransferInConfirmation(log *types.Log) (*bridge.BridgeContractTransferInConfirmation, error) ParseTransferInConfirmation(log *types.Log) (*bridge.BridgeContractTransferInConfirmation, error)
ParseTokenConfigChanged(log *types.Log) (*bridge.BridgeContractTokenOutConfigChanged, error) ParseTokenConfigChanged(log *types.Log) (*bridge.BridgeContractTokenOutConfigChanged, error)
ParseSwapConfigChanged(log *types.Log) (*bridge.BridgeContractSwapConfigChanged, error)
GetReceiveToken(token common.Address, toChainId int64) (string, error) GetReceiveToken(token common.Address, toChainId int64) (string, error)
} }
...@@ -34,6 +35,7 @@ var ( ...@@ -34,6 +35,7 @@ var (
TransferInRejectionEvent = bridgeAbi.Events[EVENT_TRANSFER_IN_REJECTION] TransferInRejectionEvent = bridgeAbi.Events[EVENT_TRANSFER_IN_REJECTION]
TransferInConfirmationEvent = bridgeAbi.Events[EVENT_TRANSFER_IN_CONFIRMATION] TransferInConfirmationEvent = bridgeAbi.Events[EVENT_TRANSFER_IN_CONFIRMATION]
TokenConfigChangedEvent = bridgeAbi.Events[EVENT_TOKENCONFIGCHANGED] TokenConfigChangedEvent = bridgeAbi.Events[EVENT_TOKENCONFIGCHANGED]
SwapConfigChangedEvent = bridgeAbi.Events[EVENT_SWAPCONFIGCHANGED]
) )
func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error { func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error {
...@@ -43,6 +45,7 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error { ...@@ -43,6 +45,7 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error {
var allTransferOut = make([]types.Log, 0) var allTransferOut = make([]types.Log, 0)
var allTransferIn = make([]types.Log, 0) var allTransferIn = make([]types.Log, 0)
var allTokenConfigChanged = make([]types.Log, 0) var allTokenConfigChanged = make([]types.Log, 0)
var allSwapConfigChanged = make([]types.Log, 0)
var allExecuted = make([]types.Log, 0) var allExecuted = make([]types.Log, 0)
var allRejected = make([]types.Log, 0) var allRejected = make([]types.Log, 0)
var allConfirmed = make([]types.Log, 0) var allConfirmed = make([]types.Log, 0)
...@@ -55,6 +58,8 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error { ...@@ -55,6 +58,8 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error {
allTransferIn = append(allTransferIn, lg) allTransferIn = append(allTransferIn, lg)
case TokenConfigChangedEvent.ID.Hex(): case TokenConfigChangedEvent.ID.Hex():
allTokenConfigChanged = append(allTokenConfigChanged, lg) allTokenConfigChanged = append(allTokenConfigChanged, lg)
case SwapConfigChangedEvent.ID.Hex():
allSwapConfigChanged = append(allSwapConfigChanged, lg)
case TransferInExecutionEvent.ID.Hex(): case TransferInExecutionEvent.ID.Hex():
allExecuted = append(allExecuted, lg) allExecuted = append(allExecuted, lg)
case TransferInRejectionEvent.ID.Hex(): case TransferInRejectionEvent.ID.Hex():
...@@ -70,6 +75,7 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error { ...@@ -70,6 +75,7 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error {
allLogs = append(allLogs, allRejected...) allLogs = append(allLogs, allRejected...)
allLogs = append(allLogs, allConfirmed...) allLogs = append(allLogs, allConfirmed...)
allLogs = append(allLogs, allExecuted...) allLogs = append(allLogs, allExecuted...)
allLogs = append(allLogs, allSwapConfigChanged...)
// disable the code. // disable the code.
if false { if false {
...@@ -128,6 +134,10 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error { ...@@ -128,6 +134,10 @@ func (s *Dao) HandleEvents(chain ChainInterface, logs []types.Log) error {
ormTxErr = err ormTxErr = err
break break
} }
if err := s.filterSwapConfigChanged(chain, txLog, ctx); err != nil {
ormTxErr = err
break
}
} }
// commit or rollback. // commit or rollback.
...@@ -394,3 +404,44 @@ func (s *Dao) filterTokenConfigChanged(chain ChainInterface, txLog *types.Log, c ...@@ -394,3 +404,44 @@ func (s *Dao) filterTokenConfigChanged(chain ChainInterface, txLog *types.Log, c
} }
return nil return nil
} }
func (s *Dao) filterSwapConfigChanged(chain ChainInterface, txLog *types.Log, ctx context.Context) error {
if len(txLog.Topics) == 0 {
return nil
}
if txLog.Topics[0].Hex() == SwapConfigChangedEvent.ID.Hex() {
configure, err := chain.ParseSwapConfigChanged(txLog)
if err != nil {
return err
}
info := &dbModel.SwapTokenInfo{
ChainId: chain.GetChain().ChainId,
Contract: strings.ToLower(txLog.Address.String()),
Token: strings.ToLower(configure.FromToken.String()),
SwapContract: strings.ToLower(configure.Swap.String()),
ToToken: strings.ToLower(configure.ToToken.String()),
SwapPath: make([]string, 0),
}
for _, addr := range configure.Path {
info.SwapPath = append(info.SwapPath, strings.ToLower(addr.String()))
}
if tokenInfo, err := s.tokenRepo.RetriveTokenInfo(chain.GetChain().ChainId, configure.FromToken.Hex()); err == nil {
info.TokenName = tokenInfo.Symbol
}
err = s.CreateSwapTokenInfo(ctx, info)
if err != nil {
log.WithFields(log.Fields{
"chain": chain.Name(),
"token": configure.FromToken.Hex(),
"toToken": configure.ToToken.Hex(),
"swap": configure.Swap.Hex(),
"swapPath": info.SwapPath,
}).WithError(err).Error("db create or update token config failed")
return err
}
}
return nil
}
...@@ -191,3 +191,73 @@ func (d *Dao) GetHistoryInfo(user string) (history apiModel.History, err error) ...@@ -191,3 +191,73 @@ func (d *Dao) GetHistoryInfo(user string) (history apiModel.History, err error)
return history, nil return history, nil
} }
func (d *Dao) GetSwapConfig(chainId int64) (config apiModel.SwapConfigs, err error) {
collection := d.db.Collection(new(dbModel.SwapTokenInfo).TableName())
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// Find all swap token info fillter by chain_id.
cursor, err := collection.Find(ctx, bson.M{})
if err != nil {
return config, err
}
defer cursor.Close(ctx)
var swaps []dbModel.SwapTokenInfo
err = cursor.All(ctx, &swaps)
if err != nil {
return config, err
}
config.SwapPairs = make(map[string]apiModel.SwapPair)
// Convert database model to API model
for _, info := range swaps {
if info.ChainId != chainId {
continue
}
swap := apiModel.SwapPair{
From: apiModel.TokenInfo{
Contract: info.Token,
Name: info.TokenName,
},
To: apiModel.TokenInfo{
Contract: info.ToToken,
Name: "",
},
SwapContract: info.SwapContract,
SwapPath: make([]string, 0),
}
for _, pathToken := range info.SwapPath {
swap.SwapPath = append(swap.SwapPath, pathToken)
}
if swap.From.Name == "" {
tokenInfo, err := d.tokenRepo.RetriveTokenInfo(info.ChainId, info.Token)
if err != nil {
log.WithFields(log.Fields{
"chain_id": info.ChainId,
"token": info.Token,
"error": err,
}).Error("not found token info with tokenrepo, skip symbol info")
} else {
swap.From.Name = tokenInfo.Symbol
}
}
if swap.To.Name == "" {
toTokenInfo, err := d.tokenRepo.RetriveTokenInfo(info.ChainId, info.ToToken)
if err != nil {
log.WithFields(log.Fields{
"chain_id": info.ChainId,
"token": info.ToToken,
"error": err,
}).Error("not found token info with tokenrepo, skip symbol info")
} else {
swap.To.Name = toTokenInfo.Symbol
}
}
config.SwapPairs[swap.From.Name] = swap
}
return config, nil
}
...@@ -228,3 +228,16 @@ func (d *Dao) GetTokenInfo(address string) (info dbModel.TokenInfo, err error) { ...@@ -228,3 +228,16 @@ func (d *Dao) GetTokenInfo(address string) (info dbModel.TokenInfo, err error) {
} }
return info, err return info, err
} }
func (d *Dao) CreateSwapTokenInfo(ctx context.Context, info *dbModel.SwapTokenInfo) error {
collection := d.db.Collection(info.TableName())
filter := bson.M{"chain_id": info.ChainId, "token": info.Token, "contract": info.Contract}
update := bson.D{
{"$set", info},
}
opts := options.Update().SetUpsert(true)
_, err := collection.UpdateOne(ctx, filter, update, opts)
return err
}
...@@ -15,6 +15,22 @@ type ChainConfig struct { ...@@ -15,6 +15,22 @@ type ChainConfig struct {
RpcUrl string `json:"rpc" bson:"rpc"` RpcUrl string `json:"rpc" bson:"rpc"`
} }
type TokenInfo struct {
Name string `json:"name" bson:"name"`
Contract string `json:"contract" bson:"contract"`
}
type SwapPair struct {
From TokenInfo `json:"from" bson:"from"`
To TokenInfo `json:"to" bson:"to"`
SwapContract string `json:"swap_contract" bson:"swap_contract"`
SwapPath []string `json:"swap_path" bson:"swap_path"`
}
type SwapConfigs struct {
SwapPairs map[string]SwapPair `json:"swap_pairs" bson:"swap_pairs"`
}
type BridgeConfig struct { type BridgeConfig struct {
Chains map[string]ChainConfig `json:"chains" bson:"chains"` Chains map[string]ChainConfig `json:"chains" bson:"chains"`
} }
...@@ -42,5 +58,6 @@ type History struct { ...@@ -42,5 +58,6 @@ type History struct {
type Querier interface { type Querier interface {
GetBridgeConfig() (config BridgeConfig, err error) GetBridgeConfig() (config BridgeConfig, err error)
GetSwapConfig(chainId int64) (config SwapConfigs, err error)
GetHistoryInfo(user string) (history History, err error) GetHistoryInfo(user string) (history History, err error)
} }
...@@ -92,6 +92,21 @@ func (b *BridgeTokenInfo) TableName() string { ...@@ -92,6 +92,21 @@ func (b *BridgeTokenInfo) TableName() string {
return "bridge_token_info" return "bridge_token_info"
} }
type SwapTokenInfo struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
ChainId int64 `bson:"chain_id"`
Contract string `bson:"contract"`
Token string `bson:"token"`
TokenName string `bson:"token_name"`
SwapContract string `bson:"swap_contract"`
ToToken string `bson:"to_token"`
SwapPath []string `bson:"swap_path"`
}
func (b *SwapTokenInfo) TableName() string {
return "swap_token_info"
}
type TokenInfo struct { type TokenInfo struct {
ID primitive.ObjectID `bson:"_id,omitempty"` ID primitive.ObjectID `bson:"_id,omitempty"`
Address string `bson:"address"` Address string `bson:"address"`
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"code.wuban.net.cn/movabridge/bridge-backend/constant" "code.wuban.net.cn/movabridge/bridge-backend/constant"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"strconv"
"strings" "strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
...@@ -45,3 +46,26 @@ func getHistory(c *gin.Context) { ...@@ -45,3 +46,26 @@ func getHistory(c *gin.Context) {
} }
c.JSON(200, withSuccess(history)) c.JSON(200, withSuccess(history))
} }
func getSwapConfig(c *gin.Context) {
chainIdStr := c.DefaultQuery("chain", "")
chainId, err := strconv.ParseInt(chainIdStr, 10, 64)
if err != nil {
log.Errorf("convert chainId(%s) to int error: %v", chainIdStr, err)
c.JSON(200, withError(constant.InvalidParam))
}
if _querier == nil {
log.Error("querier is nil")
c.JSON(500, withError(constant.InternalError))
return
}
configs, err := _querier.GetSwapConfig(chainId)
if err != nil {
log.Errorf("get swap config error: %v", err)
c.JSON(500, withError(constant.InternalError))
return
}
c.JSON(200, withSuccess(configs))
}
...@@ -16,4 +16,5 @@ func initRouter(conf *config.Config, e *gin.Engine) { ...@@ -16,4 +16,5 @@ func initRouter(conf *config.Config, e *gin.Engine) {
user.GET("/history", getHistory) user.GET("/history", getHistory)
} }
v1.GET("/params", getParam) v1.GET("/params", getParam)
v1.GET("/swapconfig", getSwapConfig)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment