diff --git a/packages/relayer/TaikoL1.json b/packages/relayer/TaikoL1.json index 4fd493ae58c..8283d891722 100644 --- a/packages/relayer/TaikoL1.json +++ b/packages/relayer/TaikoL1.json @@ -344,7 +344,7 @@ }, { "internalType": "uint256", - "name": "feePremiumLamda", + "name": "slotSmoothingFactor", "type": "uint256" }, { diff --git a/packages/relayer/TokenVault.json b/packages/relayer/TokenVault.json new file mode 100644 index 00000000000..b0dab10055d --- /dev/null +++ b/packages/relayer/TokenVault.json @@ -0,0 +1,675 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "srcChainId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "canonicalToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "bridgedToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "canonicalTokenSymbol", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "canonicalTokenName", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "canonicalTokenDecimal", + "type": "uint8" + } + ], + "name": "BridgedERC20Deployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "srcChainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20Received", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20Released", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "destChainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ERC20Sent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "destChainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "EtherSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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" + }, + { + "inputs": [], + "name": "addressManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "bridgedToCanonical", + "outputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canonicalToBridged", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addressManager", + "type": "address" + } + ], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isBridgedToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "messageDeposits", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "uint8", + "name": "decimals", + "type": "uint8" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "internalType": "struct TokenVault.CanonicalERC20", + "name": "canonicalToken", + "type": "tuple" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "receiveERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "srcChainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "callValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "processingFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "string", + "name": "memo", + "type": "string" + } + ], + "internalType": "struct IBridge.Message", + "name": "message", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "releaseERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bool", + "name": "allowZeroAddress", + "type": "bool" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "bool", + "name": "allowZeroAddress", + "type": "bool" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "processingFee", + "type": "uint256" + }, + { + "internalType": "address", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "memo", + "type": "string" + } + ], + "name": "sendERC20", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destChainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "processingFee", + "type": "uint256" + }, + { + "internalType": "address", + "name": "refundAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "memo", + "type": "string" + } + ], + "name": "sendEther", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/relayer/abigen.sh b/packages/relayer/abigen.sh index 9fe24d098e6..be749e32307 100755 --- a/packages/relayer/abigen.sh +++ b/packages/relayer/abigen.sh @@ -5,9 +5,9 @@ if [ ! -d "../protocol/artifacts" ]; then exit 1 fi -paths=("bridge/Bridge.sol" "common/IHeaderSync.sol" "L2/TaikoL2.sol" "L1/TaikoL1.sol") +paths=("bridge/TokenVault.sol" "bridge/Bridge.sol" "common/IHeaderSync.sol" "L2/TaikoL2.sol" "L1/TaikoL1.sol") -names=("Bridge" "IHeaderSync" "TaikoL2" "TaikoL1") +names=("TokenVault" "Bridge" "IHeaderSync" "TaikoL2" "TaikoL1") for (( i = 0; i < ${#paths[@]}; ++i )); do diff --git a/packages/relayer/cli/cli.go b/packages/relayer/cli/cli.go index 0ea2690cf6c..0fd2657bc65 100644 --- a/packages/relayer/cli/cli.go +++ b/packages/relayer/cli/cli.go @@ -88,7 +88,17 @@ func Run( log.Fatal(err) } - srv, err := newHTTPServer(db) + l1EthClient, err := ethclient.Dial(os.Getenv("L1_RPC_URL")) + if err != nil { + log.Fatal(err) + } + + l2EthClient, err := ethclient.Dial(os.Getenv("L2_RPC_URL")) + if err != nil { + log.Fatal(err) + } + + srv, err := newHTTPServer(db, l1EthClient, l2EthClient) if err != nil { log.Fatal(err) } @@ -169,12 +179,12 @@ func makeIndexers( l1EthClient, err := ethclient.Dial(os.Getenv("L1_RPC_URL")) if err != nil { - return nil, nil, err + log.Fatal(err) } l2EthClient, err := ethclient.Dial(os.Getenv("L2_RPC_URL")) if err != nil { - return nil, nil, err + log.Fatal(err) } l1RpcClient, err := rpc.DialContext(context.Background(), os.Getenv("L1_RPC_URL")) @@ -341,16 +351,24 @@ func loadAndValidateEnv() error { return errors.Errorf("Missing env vars: %v", missing) } -func newHTTPServer(db relayer.DB) (*http.Server, error) { +func newHTTPServer(db relayer.DB, l1EthClient relayer.EthClient, l2EthClient relayer.EthClient) (*http.Server, error) { eventRepo, err := repo.NewEventRepository(db) if err != nil { return nil, err } + blockRepo, err := repo.NewBlockRepository(db) + if err != nil { + return nil, err + } + srv, err := http.NewServer(http.NewServerOpts{ EventRepo: eventRepo, Echo: echo.New(), CorsOrigins: strings.Split(os.Getenv("CORS_ORIGINS"), ","), + L1EthClient: l1EthClient, + L2EthClient: l2EthClient, + BlockRepo: blockRepo, }) if err != nil { return nil, err diff --git a/packages/relayer/cli/cli_test.go b/packages/relayer/cli/cli_test.go index ecb41afb718..3ba1ee1181a 100644 --- a/packages/relayer/cli/cli_test.go +++ b/packages/relayer/cli/cli_test.go @@ -1,13 +1,13 @@ package cli import ( - "errors" "os" "strings" "testing" "github.com/stretchr/testify/assert" "github.com/taikoxyz/taiko-mono/packages/relayer" + "github.com/taikoxyz/taiko-mono/packages/relayer/mock" ) var dummyEcdsaKey = "8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f" @@ -93,29 +93,6 @@ func Test_makeIndexers(t *testing.T) { wantIndexers int wantErr error }{ - { - "missingL1RPCUrl", - relayer.Both, - dbFunc, - func() func() { - return nil - }, - 0, - errors.New("dial unix valid: connect: no such file or directory"), - }, - { - "missingL2RPCUrl", - relayer.Both, - dbFunc, - func() func() { - os.Setenv("L1_RPC_URL", "https://l1rpc.a1.taiko.xyz") - return func() { - os.Setenv("L1_RPC_URL", "") - } - }, - 0, - errors.New("dial unix valid: connect: no such file or directory"), - }, { "successL1", relayer.L1, @@ -226,12 +203,12 @@ func Test_newHTTPServer(t *testing.T) { defer cancel() - srv, err := newHTTPServer(db) + srv, err := newHTTPServer(db, &mock.EthClient{}, &mock.EthClient{}) assert.Nil(t, err) assert.NotNil(t, srv) } func Test_newHTTPServer_nilDB(t *testing.T) { - _, err := newHTTPServer(nil) + _, err := newHTTPServer(nil, &mock.EthClient{}, &mock.EthClient{}) assert.NotNil(t, err) } diff --git a/packages/relayer/contracts/bridge/Bridge.go b/packages/relayer/contracts/bridge/Bridge.go index 37eebc0b630..e8f0fc7a3e7 100644 --- a/packages/relayer/contracts/bridge/Bridge.go +++ b/packages/relayer/contracts/bridge/Bridge.go @@ -51,7 +51,7 @@ type IBridgeMessage struct { } // BridgeABI is the input ABI used to generate the binding from. -const BridgeABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"DestChainEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EtherReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"MessageStatusChanged\",\"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\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"SignalSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"context\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"}],\"internalType\":\"structIBridge.Context\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatus\",\"outputs\":[{\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatusSlot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"hashMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"isDestChainEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageFailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"isMessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"processMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"releaseEther\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"isLastAttempt\",\"type\":\"bool\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]" +const BridgeABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"DestChainEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EtherReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"MessageStatusChanged\",\"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\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"SignalSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"context\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"}],\"internalType\":\"structIBridge.Context\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatus\",\"outputs\":[{\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatusSlot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"hashMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"isDestChainEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageFailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"isMessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"processMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"releaseEther\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"isLastAttempt\",\"type\":\"bool\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]" // Bridge is an auto generated Go binding around an Ethereum contract. type Bridge struct { @@ -352,7 +352,7 @@ func (_Bridge *BridgeCallerSession) HashMessage(message IBridgeMessage) ([32]byt // IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool) +// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) func (_Bridge *BridgeCaller) IsDestChainEnabled(opts *bind.CallOpts, _chainId *big.Int) (bool, error) { var out []interface{} err := _Bridge.contract.Call(opts, &out, "isDestChainEnabled", _chainId) @@ -369,14 +369,14 @@ func (_Bridge *BridgeCaller) IsDestChainEnabled(opts *bind.CallOpts, _chainId *b // IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool) +// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) func (_Bridge *BridgeSession) IsDestChainEnabled(_chainId *big.Int) (bool, error) { return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, _chainId) } // IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool) +// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) func (_Bridge *BridgeCallerSession) IsDestChainEnabled(_chainId *big.Int) (bool, error) { return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, _chainId) } diff --git a/packages/relayer/contracts/taikol1/TaikoL1.go b/packages/relayer/contracts/taikol1/TaikoL1.go index 6b4bfff7cd2..3679afafb56 100644 --- a/packages/relayer/contracts/taikol1/TaikoL1.go +++ b/packages/relayer/contracts/taikol1/TaikoL1.go @@ -69,7 +69,7 @@ type TaikoDataConfig struct { MaxBytesPerTxList *big.Int MinTxGasLimit *big.Int AnchorTxGasLimit *big.Int - FeePremiumLamda *big.Int + SlotSmoothingFactor *big.Int RewardBurnBips *big.Int ProposerDepositPctg *big.Int FeeBaseMAF *big.Int @@ -104,7 +104,7 @@ type TaikoDataProposedBlock struct { } // TaikoL1ABI is the input ABI used to generate the binding from. -const TaikoL1ABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"BlockCommitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1Height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"mixHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"gasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"}],\"name\":\"BlockProven\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"halted\",\"type\":\"bool\"}],\"name\":\"Halted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"srcHash\",\"type\":\"bytes32\"}],\"name\":\"HeaderSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"commitBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxNumBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockHashHistory\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zkProofsPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxVerificationsPerTx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitConfirmations\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxProofsPerForkChoice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockMaxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTransactionsPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBytesPerTxList\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minTxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"anchorTxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feePremiumLamda\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardBurnBips\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proposerDepositPctg\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeBaseMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockTimeMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proofTimeMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"rewardMultiplierPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"feeGracePeriodPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"feeMaxPeriodPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"blockTimeCap\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proofTimeCap\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"bootstrapDiscountHalvingPeriod\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"initialUncleDelay\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"enableTokenomics\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enablePublicInputsCheck\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enableProofValidation\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enableOracleProver\",\"type\":\"bool\"}],\"internalType\":\"structTaikoData.Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"getForkChoice\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"internalType\":\"address[]\",\"name\":\"provers\",\"type\":\"address[]\"}],\"internalType\":\"structTaikoData.ForkChoice\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"}],\"name\":\"getProofReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getProposedBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"metaHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.ProposedBlock\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStateVariables\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"statusBits\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"feeBase\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"nextBlockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastProposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgBlockTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgProofTime\",\"type\":\"uint64\"}],\"internalType\":\"structLibUtils.StateVariables\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"}],\"name\":\"getUncleProofDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"toHalt\",\"type\":\"bool\"}],\"name\":\"halt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_feeBase\",\"type\":\"uint256\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"isBlockVerifiable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"commitSlot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitHeight\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"isCommitValid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isHalted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proposeBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlockInvalid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signWithGoldenTouch\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__reservedA1\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"statusBits\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"feeBase\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"nextBlockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastProposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgBlockTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__avgGasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgProofTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__reservedC1\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxBlocks\",\"type\":\"uint256\"}],\"name\":\"verifyBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" +const TaikoL1ABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"BlockCommitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1Height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"mixHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"gasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"}],\"name\":\"BlockProven\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"halted\",\"type\":\"bool\"}],\"name\":\"Halted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"srcHash\",\"type\":\"bytes32\"}],\"name\":\"HeaderSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"commitBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxNumBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockHashHistory\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"zkProofsPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxVerificationsPerTx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitConfirmations\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxProofsPerForkChoice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockMaxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTransactionsPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBytesPerTxList\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minTxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"anchorTxGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slotSmoothingFactor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rewardBurnBips\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proposerDepositPctg\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeBaseMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockTimeMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proofTimeMAF\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"rewardMultiplierPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"feeGracePeriodPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"feeMaxPeriodPctg\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"blockTimeCap\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proofTimeCap\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"bootstrapDiscountHalvingPeriod\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"initialUncleDelay\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"enableTokenomics\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enablePublicInputsCheck\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enableProofValidation\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"enableOracleProver\",\"type\":\"bool\"}],\"internalType\":\"structTaikoData.Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"getForkChoice\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"internalType\":\"address[]\",\"name\":\"provers\",\"type\":\"address[]\"}],\"internalType\":\"structTaikoData.ForkChoice\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"}],\"name\":\"getProofReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getProposedBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"metaHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"deposit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.ProposedBlock\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStateVariables\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"statusBits\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"feeBase\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"nextBlockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastProposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgBlockTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgProofTime\",\"type\":\"uint64\"}],\"internalType\":\"structLibUtils.StateVariables\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"}],\"name\":\"getUncleProofDelay\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"toHalt\",\"type\":\"bool\"}],\"name\":\"halt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_feeBase\",\"type\":\"uint256\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"isBlockVerifiable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"commitSlot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitHeight\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"isCommitValid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isHalted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proposeBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlockInvalid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signWithGoldenTouch\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__reservedA1\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"statusBits\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"feeBase\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"nextBlockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastProposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgBlockTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__avgGasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"avgProofTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"__reservedC1\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxBlocks\",\"type\":\"uint256\"}],\"name\":\"verifyBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" // TaikoL1 is an auto generated Go binding around an Ethereum contract. type TaikoL1 struct { diff --git a/packages/relayer/contracts/tokenvault/TokenVault.go b/packages/relayer/contracts/tokenvault/TokenVault.go new file mode 100644 index 00000000000..4f6aa7f0da4 --- /dev/null +++ b/packages/relayer/contracts/tokenvault/TokenVault.go @@ -0,0 +1,1737 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package tokenvault + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// IBridgeMessage is an auto generated low-level Go binding around an user-defined struct. +type IBridgeMessage struct { + Id *big.Int + Sender common.Address + SrcChainId *big.Int + DestChainId *big.Int + Owner common.Address + To common.Address + RefundAddress common.Address + DepositValue *big.Int + CallValue *big.Int + ProcessingFee *big.Int + GasLimit *big.Int + Data []byte + Memo string +} + +// TokenVaultCanonicalERC20 is an auto generated low-level Go binding around an user-defined struct. +type TokenVaultCanonicalERC20 struct { + ChainId *big.Int + Addr common.Address + Decimals uint8 + Symbol string + Name string +} + +// TokenVaultABI is the input ABI used to generate the binding from. +const TokenVaultABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"canonicalToken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgedToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"canonicalTokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"canonicalTokenName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"canonicalTokenDecimal\",\"type\":\"uint8\"}],\"name\":\"BridgedERC20Deployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20Received\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20Released\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ERC20Sent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EtherSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"messageDeposits\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structTokenVault.CanonicalERC20\",\"name\":\"canonicalToken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"depositValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"releaseERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"name\":\"sendERC20\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"processingFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"name\":\"sendEther\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +// TokenVault is an auto generated Go binding around an Ethereum contract. +type TokenVault struct { + TokenVaultCaller // Read-only binding to the contract + TokenVaultTransactor // Write-only binding to the contract + TokenVaultFilterer // Log filterer for contract events +} + +// TokenVaultCaller is an auto generated read-only Go binding around an Ethereum contract. +type TokenVaultCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenVaultTransactor is an auto generated write-only Go binding around an Ethereum contract. +type TokenVaultTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenVaultFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TokenVaultFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TokenVaultSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TokenVaultSession struct { + Contract *TokenVault // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TokenVaultCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TokenVaultCallerSession struct { + Contract *TokenVaultCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TokenVaultTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TokenVaultTransactorSession struct { + Contract *TokenVaultTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TokenVaultRaw is an auto generated low-level Go binding around an Ethereum contract. +type TokenVaultRaw struct { + Contract *TokenVault // Generic contract binding to access the raw methods on +} + +// TokenVaultCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TokenVaultCallerRaw struct { + Contract *TokenVaultCaller // Generic read-only contract binding to access the raw methods on +} + +// TokenVaultTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TokenVaultTransactorRaw struct { + Contract *TokenVaultTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewTokenVault creates a new instance of TokenVault, bound to a specific deployed contract. +func NewTokenVault(address common.Address, backend bind.ContractBackend) (*TokenVault, error) { + contract, err := bindTokenVault(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &TokenVault{TokenVaultCaller: TokenVaultCaller{contract: contract}, TokenVaultTransactor: TokenVaultTransactor{contract: contract}, TokenVaultFilterer: TokenVaultFilterer{contract: contract}}, nil +} + +// NewTokenVaultCaller creates a new read-only instance of TokenVault, bound to a specific deployed contract. +func NewTokenVaultCaller(address common.Address, caller bind.ContractCaller) (*TokenVaultCaller, error) { + contract, err := bindTokenVault(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TokenVaultCaller{contract: contract}, nil +} + +// NewTokenVaultTransactor creates a new write-only instance of TokenVault, bound to a specific deployed contract. +func NewTokenVaultTransactor(address common.Address, transactor bind.ContractTransactor) (*TokenVaultTransactor, error) { + contract, err := bindTokenVault(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TokenVaultTransactor{contract: contract}, nil +} + +// NewTokenVaultFilterer creates a new log filterer instance of TokenVault, bound to a specific deployed contract. +func NewTokenVaultFilterer(address common.Address, filterer bind.ContractFilterer) (*TokenVaultFilterer, error) { + contract, err := bindTokenVault(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TokenVaultFilterer{contract: contract}, nil +} + +// bindTokenVault binds a generic wrapper to an already deployed contract. +func bindTokenVault(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(TokenVaultABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TokenVault *TokenVaultRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TokenVault.Contract.TokenVaultCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TokenVault *TokenVaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TokenVault.Contract.TokenVaultTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TokenVault *TokenVaultRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TokenVault.Contract.TokenVaultTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TokenVault *TokenVaultCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TokenVault.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TokenVault *TokenVaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TokenVault.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TokenVault *TokenVaultTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TokenVault.Contract.contract.Transact(opts, method, params...) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TokenVault *TokenVaultCaller) AddressManager(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "addressManager") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TokenVault *TokenVaultSession) AddressManager() (common.Address, error) { + return _TokenVault.Contract.AddressManager(&_TokenVault.CallOpts) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TokenVault *TokenVaultCallerSession) AddressManager() (common.Address, error) { + return _TokenVault.Contract.AddressManager(&_TokenVault.CallOpts) +} + +// BridgedToCanonical is a free data retrieval call binding the contract method 0x9aa8605c. +// +// Solidity: function bridgedToCanonical(address ) view returns(uint256 chainId, address addr, uint8 decimals, string symbol, string name) +func (_TokenVault *TokenVaultCaller) BridgedToCanonical(opts *bind.CallOpts, arg0 common.Address) (struct { + ChainId *big.Int + Addr common.Address + Decimals uint8 + Symbol string + Name string +}, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "bridgedToCanonical", arg0) + + outstruct := new(struct { + ChainId *big.Int + Addr common.Address + Decimals uint8 + Symbol string + Name string + }) + if err != nil { + return *outstruct, err + } + + outstruct.ChainId = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + outstruct.Addr = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) + outstruct.Decimals = *abi.ConvertType(out[2], new(uint8)).(*uint8) + outstruct.Symbol = *abi.ConvertType(out[3], new(string)).(*string) + outstruct.Name = *abi.ConvertType(out[4], new(string)).(*string) + + return *outstruct, err + +} + +// BridgedToCanonical is a free data retrieval call binding the contract method 0x9aa8605c. +// +// Solidity: function bridgedToCanonical(address ) view returns(uint256 chainId, address addr, uint8 decimals, string symbol, string name) +func (_TokenVault *TokenVaultSession) BridgedToCanonical(arg0 common.Address) (struct { + ChainId *big.Int + Addr common.Address + Decimals uint8 + Symbol string + Name string +}, error) { + return _TokenVault.Contract.BridgedToCanonical(&_TokenVault.CallOpts, arg0) +} + +// BridgedToCanonical is a free data retrieval call binding the contract method 0x9aa8605c. +// +// Solidity: function bridgedToCanonical(address ) view returns(uint256 chainId, address addr, uint8 decimals, string symbol, string name) +func (_TokenVault *TokenVaultCallerSession) BridgedToCanonical(arg0 common.Address) (struct { + ChainId *big.Int + Addr common.Address + Decimals uint8 + Symbol string + Name string +}, error) { + return _TokenVault.Contract.BridgedToCanonical(&_TokenVault.CallOpts, arg0) +} + +// CanonicalToBridged is a free data retrieval call binding the contract method 0x67090ccf. +// +// Solidity: function canonicalToBridged(uint256 , address ) view returns(address) +func (_TokenVault *TokenVaultCaller) CanonicalToBridged(opts *bind.CallOpts, arg0 *big.Int, arg1 common.Address) (common.Address, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "canonicalToBridged", arg0, arg1) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// CanonicalToBridged is a free data retrieval call binding the contract method 0x67090ccf. +// +// Solidity: function canonicalToBridged(uint256 , address ) view returns(address) +func (_TokenVault *TokenVaultSession) CanonicalToBridged(arg0 *big.Int, arg1 common.Address) (common.Address, error) { + return _TokenVault.Contract.CanonicalToBridged(&_TokenVault.CallOpts, arg0, arg1) +} + +// CanonicalToBridged is a free data retrieval call binding the contract method 0x67090ccf. +// +// Solidity: function canonicalToBridged(uint256 , address ) view returns(address) +func (_TokenVault *TokenVaultCallerSession) CanonicalToBridged(arg0 *big.Int, arg1 common.Address) (common.Address, error) { + return _TokenVault.Contract.CanonicalToBridged(&_TokenVault.CallOpts, arg0, arg1) +} + +// IsBridgedToken is a free data retrieval call binding the contract method 0xc287e578. +// +// Solidity: function isBridgedToken(address ) view returns(bool) +func (_TokenVault *TokenVaultCaller) IsBridgedToken(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "isBridgedToken", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsBridgedToken is a free data retrieval call binding the contract method 0xc287e578. +// +// Solidity: function isBridgedToken(address ) view returns(bool) +func (_TokenVault *TokenVaultSession) IsBridgedToken(arg0 common.Address) (bool, error) { + return _TokenVault.Contract.IsBridgedToken(&_TokenVault.CallOpts, arg0) +} + +// IsBridgedToken is a free data retrieval call binding the contract method 0xc287e578. +// +// Solidity: function isBridgedToken(address ) view returns(bool) +func (_TokenVault *TokenVaultCallerSession) IsBridgedToken(arg0 common.Address) (bool, error) { + return _TokenVault.Contract.IsBridgedToken(&_TokenVault.CallOpts, arg0) +} + +// MessageDeposits is a free data retrieval call binding the contract method 0x780b64f0. +// +// Solidity: function messageDeposits(bytes32 ) view returns(address token, uint256 amount) +func (_TokenVault *TokenVaultCaller) MessageDeposits(opts *bind.CallOpts, arg0 [32]byte) (struct { + Token common.Address + Amount *big.Int +}, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "messageDeposits", arg0) + + outstruct := new(struct { + Token common.Address + Amount *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Token = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + outstruct.Amount = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// MessageDeposits is a free data retrieval call binding the contract method 0x780b64f0. +// +// Solidity: function messageDeposits(bytes32 ) view returns(address token, uint256 amount) +func (_TokenVault *TokenVaultSession) MessageDeposits(arg0 [32]byte) (struct { + Token common.Address + Amount *big.Int +}, error) { + return _TokenVault.Contract.MessageDeposits(&_TokenVault.CallOpts, arg0) +} + +// MessageDeposits is a free data retrieval call binding the contract method 0x780b64f0. +// +// Solidity: function messageDeposits(bytes32 ) view returns(address token, uint256 amount) +func (_TokenVault *TokenVaultCallerSession) MessageDeposits(arg0 [32]byte) (struct { + Token common.Address + Amount *big.Int +}, error) { + return _TokenVault.Contract.MessageDeposits(&_TokenVault.CallOpts, arg0) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TokenVault *TokenVaultCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TokenVault *TokenVaultSession) Owner() (common.Address, error) { + return _TokenVault.Contract.Owner(&_TokenVault.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TokenVault *TokenVaultCallerSession) Owner() (common.Address, error) { + return _TokenVault.Contract.Owner(&_TokenVault.CallOpts) +} + +// Resolve is a free data retrieval call binding the contract method 0x0ca4dffd. +// +// Solidity: function resolve(string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultCaller) Resolve(opts *bind.CallOpts, name string, allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "resolve", name, allowZeroAddress) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve is a free data retrieval call binding the contract method 0x0ca4dffd. +// +// Solidity: function resolve(string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultSession) Resolve(name string, allowZeroAddress bool) (common.Address, error) { + return _TokenVault.Contract.Resolve(&_TokenVault.CallOpts, name, allowZeroAddress) +} + +// Resolve is a free data retrieval call binding the contract method 0x0ca4dffd. +// +// Solidity: function resolve(string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultCallerSession) Resolve(name string, allowZeroAddress bool) (common.Address, error) { + return _TokenVault.Contract.Resolve(&_TokenVault.CallOpts, name, allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0x1be2bfa7. +// +// Solidity: function resolve(uint256 chainId, string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultCaller) Resolve0(opts *bind.CallOpts, chainId *big.Int, name string, allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _TokenVault.contract.Call(opts, &out, "resolve0", chainId, name, allowZeroAddress) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve0 is a free data retrieval call binding the contract method 0x1be2bfa7. +// +// Solidity: function resolve(uint256 chainId, string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultSession) Resolve0(chainId *big.Int, name string, allowZeroAddress bool) (common.Address, error) { + return _TokenVault.Contract.Resolve0(&_TokenVault.CallOpts, chainId, name, allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0x1be2bfa7. +// +// Solidity: function resolve(uint256 chainId, string name, bool allowZeroAddress) view returns(address) +func (_TokenVault *TokenVaultCallerSession) Resolve0(chainId *big.Int, name string, allowZeroAddress bool) (common.Address, error) { + return _TokenVault.Contract.Resolve0(&_TokenVault.CallOpts, chainId, name, allowZeroAddress) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address addressManager) returns() +func (_TokenVault *TokenVaultTransactor) Init(opts *bind.TransactOpts, addressManager common.Address) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "init", addressManager) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address addressManager) returns() +func (_TokenVault *TokenVaultSession) Init(addressManager common.Address) (*types.Transaction, error) { + return _TokenVault.Contract.Init(&_TokenVault.TransactOpts, addressManager) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address addressManager) returns() +func (_TokenVault *TokenVaultTransactorSession) Init(addressManager common.Address) (*types.Transaction, error) { + return _TokenVault.Contract.Init(&_TokenVault.TransactOpts, addressManager) +} + +// ReceiveERC20 is a paid mutator transaction binding the contract method 0x0c6fab82. +// +// Solidity: function receiveERC20((uint256,address,uint8,string,string) canonicalToken, address from, address to, uint256 amount) returns() +func (_TokenVault *TokenVaultTransactor) ReceiveERC20(opts *bind.TransactOpts, canonicalToken TokenVaultCanonicalERC20, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "receiveERC20", canonicalToken, from, to, amount) +} + +// ReceiveERC20 is a paid mutator transaction binding the contract method 0x0c6fab82. +// +// Solidity: function receiveERC20((uint256,address,uint8,string,string) canonicalToken, address from, address to, uint256 amount) returns() +func (_TokenVault *TokenVaultSession) ReceiveERC20(canonicalToken TokenVaultCanonicalERC20, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _TokenVault.Contract.ReceiveERC20(&_TokenVault.TransactOpts, canonicalToken, from, to, amount) +} + +// ReceiveERC20 is a paid mutator transaction binding the contract method 0x0c6fab82. +// +// Solidity: function receiveERC20((uint256,address,uint8,string,string) canonicalToken, address from, address to, uint256 amount) returns() +func (_TokenVault *TokenVaultTransactorSession) ReceiveERC20(canonicalToken TokenVaultCanonicalERC20, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _TokenVault.Contract.ReceiveERC20(&_TokenVault.TransactOpts, canonicalToken, from, to, amount) +} + +// ReleaseERC20 is a paid mutator transaction binding the contract method 0x9754149b. +// +// Solidity: function releaseERC20((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_TokenVault *TokenVaultTransactor) ReleaseERC20(opts *bind.TransactOpts, message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "releaseERC20", message, proof) +} + +// ReleaseERC20 is a paid mutator transaction binding the contract method 0x9754149b. +// +// Solidity: function releaseERC20((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_TokenVault *TokenVaultSession) ReleaseERC20(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _TokenVault.Contract.ReleaseERC20(&_TokenVault.TransactOpts, message, proof) +} + +// ReleaseERC20 is a paid mutator transaction binding the contract method 0x9754149b. +// +// Solidity: function releaseERC20((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_TokenVault *TokenVaultTransactorSession) ReleaseERC20(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _TokenVault.Contract.ReleaseERC20(&_TokenVault.TransactOpts, message, proof) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TokenVault *TokenVaultTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TokenVault *TokenVaultSession) RenounceOwnership() (*types.Transaction, error) { + return _TokenVault.Contract.RenounceOwnership(&_TokenVault.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TokenVault *TokenVaultTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _TokenVault.Contract.RenounceOwnership(&_TokenVault.TransactOpts) +} + +// SendERC20 is a paid mutator transaction binding the contract method 0xee1490b2. +// +// Solidity: function sendERC20(uint256 destChainId, address to, address token, uint256 amount, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultTransactor) SendERC20(opts *bind.TransactOpts, destChainId *big.Int, to common.Address, token common.Address, amount *big.Int, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "sendERC20", destChainId, to, token, amount, gasLimit, processingFee, refundAddress, memo) +} + +// SendERC20 is a paid mutator transaction binding the contract method 0xee1490b2. +// +// Solidity: function sendERC20(uint256 destChainId, address to, address token, uint256 amount, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultSession) SendERC20(destChainId *big.Int, to common.Address, token common.Address, amount *big.Int, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.Contract.SendERC20(&_TokenVault.TransactOpts, destChainId, to, token, amount, gasLimit, processingFee, refundAddress, memo) +} + +// SendERC20 is a paid mutator transaction binding the contract method 0xee1490b2. +// +// Solidity: function sendERC20(uint256 destChainId, address to, address token, uint256 amount, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultTransactorSession) SendERC20(destChainId *big.Int, to common.Address, token common.Address, amount *big.Int, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.Contract.SendERC20(&_TokenVault.TransactOpts, destChainId, to, token, amount, gasLimit, processingFee, refundAddress, memo) +} + +// SendEther is a paid mutator transaction binding the contract method 0x39da33ba. +// +// Solidity: function sendEther(uint256 destChainId, address to, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultTransactor) SendEther(opts *bind.TransactOpts, destChainId *big.Int, to common.Address, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "sendEther", destChainId, to, gasLimit, processingFee, refundAddress, memo) +} + +// SendEther is a paid mutator transaction binding the contract method 0x39da33ba. +// +// Solidity: function sendEther(uint256 destChainId, address to, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultSession) SendEther(destChainId *big.Int, to common.Address, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.Contract.SendEther(&_TokenVault.TransactOpts, destChainId, to, gasLimit, processingFee, refundAddress, memo) +} + +// SendEther is a paid mutator transaction binding the contract method 0x39da33ba. +// +// Solidity: function sendEther(uint256 destChainId, address to, uint256 gasLimit, uint256 processingFee, address refundAddress, string memo) payable returns() +func (_TokenVault *TokenVaultTransactorSession) SendEther(destChainId *big.Int, to common.Address, gasLimit *big.Int, processingFee *big.Int, refundAddress common.Address, memo string) (*types.Transaction, error) { + return _TokenVault.Contract.SendEther(&_TokenVault.TransactOpts, destChainId, to, gasLimit, processingFee, refundAddress, memo) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TokenVault *TokenVaultTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _TokenVault.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TokenVault *TokenVaultSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TokenVault.Contract.TransferOwnership(&_TokenVault.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TokenVault *TokenVaultTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TokenVault.Contract.TransferOwnership(&_TokenVault.TransactOpts, newOwner) +} + +// TokenVaultBridgedERC20DeployedIterator is returned from FilterBridgedERC20Deployed and is used to iterate over the raw logs and unpacked data for BridgedERC20Deployed events raised by the TokenVault contract. +type TokenVaultBridgedERC20DeployedIterator struct { + Event *TokenVaultBridgedERC20Deployed // 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 *TokenVaultBridgedERC20DeployedIterator) 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(TokenVaultBridgedERC20Deployed) + 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(TokenVaultBridgedERC20Deployed) + 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 *TokenVaultBridgedERC20DeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultBridgedERC20DeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultBridgedERC20Deployed represents a BridgedERC20Deployed event raised by the TokenVault contract. +type TokenVaultBridgedERC20Deployed struct { + SrcChainId *big.Int + CanonicalToken common.Address + BridgedToken common.Address + CanonicalTokenSymbol string + CanonicalTokenName string + CanonicalTokenDecimal uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBridgedERC20Deployed is a free log retrieval operation binding the contract event 0x9e465b29e576a3e01584e31d607353f21b80c055e813af907c0a495f6cf4f7bc. +// +// Solidity: event BridgedERC20Deployed(uint256 indexed srcChainId, address indexed canonicalToken, address indexed bridgedToken, string canonicalTokenSymbol, string canonicalTokenName, uint8 canonicalTokenDecimal) +func (_TokenVault *TokenVaultFilterer) FilterBridgedERC20Deployed(opts *bind.FilterOpts, srcChainId []*big.Int, canonicalToken []common.Address, bridgedToken []common.Address) (*TokenVaultBridgedERC20DeployedIterator, error) { + + var srcChainIdRule []interface{} + for _, srcChainIdItem := range srcChainId { + srcChainIdRule = append(srcChainIdRule, srcChainIdItem) + } + var canonicalTokenRule []interface{} + for _, canonicalTokenItem := range canonicalToken { + canonicalTokenRule = append(canonicalTokenRule, canonicalTokenItem) + } + var bridgedTokenRule []interface{} + for _, bridgedTokenItem := range bridgedToken { + bridgedTokenRule = append(bridgedTokenRule, bridgedTokenItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "BridgedERC20Deployed", srcChainIdRule, canonicalTokenRule, bridgedTokenRule) + if err != nil { + return nil, err + } + return &TokenVaultBridgedERC20DeployedIterator{contract: _TokenVault.contract, event: "BridgedERC20Deployed", logs: logs, sub: sub}, nil +} + +// WatchBridgedERC20Deployed is a free log subscription operation binding the contract event 0x9e465b29e576a3e01584e31d607353f21b80c055e813af907c0a495f6cf4f7bc. +// +// Solidity: event BridgedERC20Deployed(uint256 indexed srcChainId, address indexed canonicalToken, address indexed bridgedToken, string canonicalTokenSymbol, string canonicalTokenName, uint8 canonicalTokenDecimal) +func (_TokenVault *TokenVaultFilterer) WatchBridgedERC20Deployed(opts *bind.WatchOpts, sink chan<- *TokenVaultBridgedERC20Deployed, srcChainId []*big.Int, canonicalToken []common.Address, bridgedToken []common.Address) (event.Subscription, error) { + + var srcChainIdRule []interface{} + for _, srcChainIdItem := range srcChainId { + srcChainIdRule = append(srcChainIdRule, srcChainIdItem) + } + var canonicalTokenRule []interface{} + for _, canonicalTokenItem := range canonicalToken { + canonicalTokenRule = append(canonicalTokenRule, canonicalTokenItem) + } + var bridgedTokenRule []interface{} + for _, bridgedTokenItem := range bridgedToken { + bridgedTokenRule = append(bridgedTokenRule, bridgedTokenItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "BridgedERC20Deployed", srcChainIdRule, canonicalTokenRule, bridgedTokenRule) + 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(TokenVaultBridgedERC20Deployed) + if err := _TokenVault.contract.UnpackLog(event, "BridgedERC20Deployed", 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 +} + +// ParseBridgedERC20Deployed is a log parse operation binding the contract event 0x9e465b29e576a3e01584e31d607353f21b80c055e813af907c0a495f6cf4f7bc. +// +// Solidity: event BridgedERC20Deployed(uint256 indexed srcChainId, address indexed canonicalToken, address indexed bridgedToken, string canonicalTokenSymbol, string canonicalTokenName, uint8 canonicalTokenDecimal) +func (_TokenVault *TokenVaultFilterer) ParseBridgedERC20Deployed(log types.Log) (*TokenVaultBridgedERC20Deployed, error) { + event := new(TokenVaultBridgedERC20Deployed) + if err := _TokenVault.contract.UnpackLog(event, "BridgedERC20Deployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultERC20ReceivedIterator is returned from FilterERC20Received and is used to iterate over the raw logs and unpacked data for ERC20Received events raised by the TokenVault contract. +type TokenVaultERC20ReceivedIterator struct { + Event *TokenVaultERC20Received // 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 *TokenVaultERC20ReceivedIterator) 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(TokenVaultERC20Received) + 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(TokenVaultERC20Received) + 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 *TokenVaultERC20ReceivedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultERC20ReceivedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultERC20Received represents a ERC20Received event raised by the TokenVault contract. +type TokenVaultERC20Received struct { + MsgHash [32]byte + From common.Address + To common.Address + SrcChainId *big.Int + Token common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterERC20Received is a free log retrieval operation binding the contract event 0xe5da926519fc972010fe65b35c1e3339e6dc72b35ffaec203999c2a2a2593eac. +// +// Solidity: event ERC20Received(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 srcChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) FilterERC20Received(opts *bind.FilterOpts, msgHash [][32]byte, from []common.Address, to []common.Address) (*TokenVaultERC20ReceivedIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "ERC20Received", msgHashRule, fromRule, toRule) + if err != nil { + return nil, err + } + return &TokenVaultERC20ReceivedIterator{contract: _TokenVault.contract, event: "ERC20Received", logs: logs, sub: sub}, nil +} + +// WatchERC20Received is a free log subscription operation binding the contract event 0xe5da926519fc972010fe65b35c1e3339e6dc72b35ffaec203999c2a2a2593eac. +// +// Solidity: event ERC20Received(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 srcChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) WatchERC20Received(opts *bind.WatchOpts, sink chan<- *TokenVaultERC20Received, msgHash [][32]byte, from []common.Address, to []common.Address) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "ERC20Received", msgHashRule, fromRule, toRule) + 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(TokenVaultERC20Received) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Received", 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 +} + +// ParseERC20Received is a log parse operation binding the contract event 0xe5da926519fc972010fe65b35c1e3339e6dc72b35ffaec203999c2a2a2593eac. +// +// Solidity: event ERC20Received(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 srcChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) ParseERC20Received(log types.Log) (*TokenVaultERC20Received, error) { + event := new(TokenVaultERC20Received) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Received", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultERC20ReleasedIterator is returned from FilterERC20Released and is used to iterate over the raw logs and unpacked data for ERC20Released events raised by the TokenVault contract. +type TokenVaultERC20ReleasedIterator struct { + Event *TokenVaultERC20Released // 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 *TokenVaultERC20ReleasedIterator) 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(TokenVaultERC20Released) + 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(TokenVaultERC20Released) + 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 *TokenVaultERC20ReleasedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultERC20ReleasedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultERC20Released represents a ERC20Released event raised by the TokenVault contract. +type TokenVaultERC20Released struct { + MsgHash [32]byte + From common.Address + Token common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterERC20Released is a free log retrieval operation binding the contract event 0xc5d9f7cd7998e24ecf12ad69eca9339764e2cb13788d5d9616f502601b219af6. +// +// Solidity: event ERC20Released(bytes32 indexed msgHash, address indexed from, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) FilterERC20Released(opts *bind.FilterOpts, msgHash [][32]byte, from []common.Address) (*TokenVaultERC20ReleasedIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "ERC20Released", msgHashRule, fromRule) + if err != nil { + return nil, err + } + return &TokenVaultERC20ReleasedIterator{contract: _TokenVault.contract, event: "ERC20Released", logs: logs, sub: sub}, nil +} + +// WatchERC20Released is a free log subscription operation binding the contract event 0xc5d9f7cd7998e24ecf12ad69eca9339764e2cb13788d5d9616f502601b219af6. +// +// Solidity: event ERC20Released(bytes32 indexed msgHash, address indexed from, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) WatchERC20Released(opts *bind.WatchOpts, sink chan<- *TokenVaultERC20Released, msgHash [][32]byte, from []common.Address) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "ERC20Released", msgHashRule, fromRule) + 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(TokenVaultERC20Released) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Released", 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 +} + +// ParseERC20Released is a log parse operation binding the contract event 0xc5d9f7cd7998e24ecf12ad69eca9339764e2cb13788d5d9616f502601b219af6. +// +// Solidity: event ERC20Released(bytes32 indexed msgHash, address indexed from, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) ParseERC20Released(log types.Log) (*TokenVaultERC20Released, error) { + event := new(TokenVaultERC20Released) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Released", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultERC20SentIterator is returned from FilterERC20Sent and is used to iterate over the raw logs and unpacked data for ERC20Sent events raised by the TokenVault contract. +type TokenVaultERC20SentIterator struct { + Event *TokenVaultERC20Sent // 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 *TokenVaultERC20SentIterator) 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(TokenVaultERC20Sent) + 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(TokenVaultERC20Sent) + 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 *TokenVaultERC20SentIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultERC20SentIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultERC20Sent represents a ERC20Sent event raised by the TokenVault contract. +type TokenVaultERC20Sent struct { + MsgHash [32]byte + From common.Address + To common.Address + DestChainId *big.Int + Token common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterERC20Sent is a free log retrieval operation binding the contract event 0x325cab7553038374e17f39bb45e2a2c90f66c6a52798cb5f95c20d94c11c95e2. +// +// Solidity: event ERC20Sent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) FilterERC20Sent(opts *bind.FilterOpts, msgHash [][32]byte, from []common.Address, to []common.Address) (*TokenVaultERC20SentIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "ERC20Sent", msgHashRule, fromRule, toRule) + if err != nil { + return nil, err + } + return &TokenVaultERC20SentIterator{contract: _TokenVault.contract, event: "ERC20Sent", logs: logs, sub: sub}, nil +} + +// WatchERC20Sent is a free log subscription operation binding the contract event 0x325cab7553038374e17f39bb45e2a2c90f66c6a52798cb5f95c20d94c11c95e2. +// +// Solidity: event ERC20Sent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) WatchERC20Sent(opts *bind.WatchOpts, sink chan<- *TokenVaultERC20Sent, msgHash [][32]byte, from []common.Address, to []common.Address) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "ERC20Sent", msgHashRule, fromRule, toRule) + 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(TokenVaultERC20Sent) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Sent", 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 +} + +// ParseERC20Sent is a log parse operation binding the contract event 0x325cab7553038374e17f39bb45e2a2c90f66c6a52798cb5f95c20d94c11c95e2. +// +// Solidity: event ERC20Sent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, address token, uint256 amount) +func (_TokenVault *TokenVaultFilterer) ParseERC20Sent(log types.Log) (*TokenVaultERC20Sent, error) { + event := new(TokenVaultERC20Sent) + if err := _TokenVault.contract.UnpackLog(event, "ERC20Sent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultEtherSentIterator is returned from FilterEtherSent and is used to iterate over the raw logs and unpacked data for EtherSent events raised by the TokenVault contract. +type TokenVaultEtherSentIterator struct { + Event *TokenVaultEtherSent // 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 *TokenVaultEtherSentIterator) 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(TokenVaultEtherSent) + 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(TokenVaultEtherSent) + 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 *TokenVaultEtherSentIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultEtherSentIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultEtherSent represents a EtherSent event raised by the TokenVault contract. +type TokenVaultEtherSent struct { + MsgHash [32]byte + From common.Address + To common.Address + DestChainId *big.Int + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEtherSent is a free log retrieval operation binding the contract event 0xe2f39179c279514a7b46983846e33f95a561128e0660602a211cc1e61cddb9bd. +// +// Solidity: event EtherSent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, uint256 amount) +func (_TokenVault *TokenVaultFilterer) FilterEtherSent(opts *bind.FilterOpts, msgHash [][32]byte, from []common.Address, to []common.Address) (*TokenVaultEtherSentIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "EtherSent", msgHashRule, fromRule, toRule) + if err != nil { + return nil, err + } + return &TokenVaultEtherSentIterator{contract: _TokenVault.contract, event: "EtherSent", logs: logs, sub: sub}, nil +} + +// WatchEtherSent is a free log subscription operation binding the contract event 0xe2f39179c279514a7b46983846e33f95a561128e0660602a211cc1e61cddb9bd. +// +// Solidity: event EtherSent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, uint256 amount) +func (_TokenVault *TokenVaultFilterer) WatchEtherSent(opts *bind.WatchOpts, sink chan<- *TokenVaultEtherSent, msgHash [][32]byte, from []common.Address, to []common.Address) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "EtherSent", msgHashRule, fromRule, toRule) + 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(TokenVaultEtherSent) + if err := _TokenVault.contract.UnpackLog(event, "EtherSent", 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 +} + +// ParseEtherSent is a log parse operation binding the contract event 0xe2f39179c279514a7b46983846e33f95a561128e0660602a211cc1e61cddb9bd. +// +// Solidity: event EtherSent(bytes32 indexed msgHash, address indexed from, address indexed to, uint256 destChainId, uint256 amount) +func (_TokenVault *TokenVaultFilterer) ParseEtherSent(log types.Log) (*TokenVaultEtherSent, error) { + event := new(TokenVaultEtherSent) + if err := _TokenVault.contract.UnpackLog(event, "EtherSent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the TokenVault contract. +type TokenVaultInitializedIterator struct { + Event *TokenVaultInitialized // 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 *TokenVaultInitializedIterator) 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(TokenVaultInitialized) + 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(TokenVaultInitialized) + 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 *TokenVaultInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultInitialized represents a Initialized event raised by the TokenVault contract. +type TokenVaultInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TokenVault *TokenVaultFilterer) FilterInitialized(opts *bind.FilterOpts) (*TokenVaultInitializedIterator, error) { + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &TokenVaultInitializedIterator{contract: _TokenVault.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TokenVault *TokenVaultFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *TokenVaultInitialized) (event.Subscription, error) { + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "Initialized") + 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(TokenVaultInitialized) + if err := _TokenVault.contract.UnpackLog(event, "Initialized", 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 +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TokenVault *TokenVaultFilterer) ParseInitialized(log types.Log) (*TokenVaultInitialized, error) { + event := new(TokenVaultInitialized) + if err := _TokenVault.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TokenVaultOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the TokenVault contract. +type TokenVaultOwnershipTransferredIterator struct { + Event *TokenVaultOwnershipTransferred // 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 *TokenVaultOwnershipTransferredIterator) 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(TokenVaultOwnershipTransferred) + 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(TokenVaultOwnershipTransferred) + 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 *TokenVaultOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TokenVaultOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TokenVaultOwnershipTransferred represents a OwnershipTransferred event raised by the TokenVault contract. +type TokenVaultOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TokenVault *TokenVaultFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*TokenVaultOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TokenVault.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &TokenVaultOwnershipTransferredIterator{contract: _TokenVault.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TokenVault *TokenVaultFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *TokenVaultOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TokenVault.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TokenVaultOwnershipTransferred) + if err := _TokenVault.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TokenVault *TokenVaultFilterer) ParseOwnershipTransferred(log types.Log) (*TokenVaultOwnershipTransferred, error) { + event := new(TokenVaultOwnershipTransferred) + if err := _TokenVault.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/packages/relayer/event.go b/packages/relayer/event.go index 96bda10f9a2..8b2737aef66 100644 --- a/packages/relayer/event.go +++ b/packages/relayer/event.go @@ -23,28 +23,51 @@ const ( EventStatusNewOnlyOwner ) +type EventType int + +const ( + EventTypeSendETH EventType = iota + EventTypeSendERC20 +) + // String returns string representation of an event status for logging func (e EventStatus) String() string { return [...]string{"new", "retriable", "done", "onlyOwner"}[e] } +func (e EventType) String() string { + return [...]string{"sendETH", "sendERC20"}[e] +} + // Event represents a stored EVM event. The fields will be serialized // into the Data field to be unmarshalled into a concrete struct // dependant on the name of the event type Event struct { - ID int `json:"id"` - Name string `json:"name"` - Data datatypes.JSON `json:"data"` - Status EventStatus `json:"status"` - ChainID int64 `json:"chainID"` + ID int `json:"id"` + Name string `json:"name"` + Data datatypes.JSON `json:"data"` + Status EventStatus `json:"status"` + EventType EventType `json:"eventType"` + ChainID int64 `json:"chainID"` + CanonicalTokenAddress string `json:"canonicalTokenAddress"` + CanonicalTokenSymbol string `json:"canonicalTokenSymbol"` + CanonicalTokenName string `json:"canonicalTokenName"` + CanonicalTokenDecimals uint8 `json:"canonicalTokenDecimals"` + Amount string `json:"amount"` } // SaveEventOpts type SaveEventOpts struct { - Name string - Data string - ChainID *big.Int - Status EventStatus + Name string + Data string + ChainID *big.Int + Status EventStatus + EventType EventType + CanonicalTokenAddress string + CanonicalTokenSymbol string + CanonicalTokenName string + CanonicalTokenDecimals uint8 + Amount string } // EventRepository is used to interact with events in the store diff --git a/packages/relayer/event_test.go b/packages/relayer/event_test.go index a58c33eebc5..564ab671392 100644 --- a/packages/relayer/event_test.go +++ b/packages/relayer/event_test.go @@ -40,3 +40,28 @@ func Test_EventStatus_String(t *testing.T) { }) } } + +func Test_EventType_String(t *testing.T) { + tests := []struct { + name string + eventType EventType + want string + }{ + { + "sendETH", + EventTypeSendETH, + "sendETH", + }, + { + "sendERC20", + EventTypeSendERC20, + "sendERC20", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, tt.eventType.String()) + }) + } +} diff --git a/packages/relayer/http/get_block_info.go b/packages/relayer/http/get_block_info.go new file mode 100644 index 00000000000..0a87ea12478 --- /dev/null +++ b/packages/relayer/http/get_block_info.go @@ -0,0 +1,68 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-mono/packages/relayer" +) + +type blockInfo struct { + ChainID int64 `json:"chainID"` + LatestProcessedBlock int64 `json:"latestProcessedBlock"` + LatestBlock int64 `json:"latestBlock"` +} + +type getBlockInfoResponse struct { + Data []blockInfo `json:"data"` +} + +func (srv *Server) GetBlockInfo(c echo.Context) error { + l1ChainID, err := srv.l1EthClient.ChainID(c.Request().Context()) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + l2ChainID, err := srv.l2EthClient.ChainID(c.Request().Context()) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + latestL1Block, err := srv.l1EthClient.BlockNumber(c.Request().Context()) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + latestL2Block, err := srv.l2EthClient.BlockNumber(c.Request().Context()) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + latestProcessedL1Block, err := srv.blockRepo.GetLatestBlockProcessedForEvent(relayer.EventNameMessageSent, l1ChainID) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + latestProcessedL2Block, err := srv.blockRepo.GetLatestBlockProcessedForEvent(relayer.EventNameMessageSent, l2ChainID) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + resp := getBlockInfoResponse{ + Data: []blockInfo{ + { + ChainID: l1ChainID.Int64(), + LatestProcessedBlock: int64(latestProcessedL1Block.Height), + LatestBlock: int64(latestL1Block), + }, + { + ChainID: l2ChainID.Int64(), + LatestProcessedBlock: int64(latestProcessedL2Block.Height), + LatestBlock: int64(latestL2Block), + }, + }, + } + + return c.JSON(http.StatusOK, resp) +} diff --git a/packages/relayer/http/routes.go b/packages/relayer/http/routes.go index e6a074db1f6..4fd1904b167 100644 --- a/packages/relayer/http/routes.go +++ b/packages/relayer/http/routes.go @@ -5,4 +5,5 @@ func (srv *Server) configureRoutes() { srv.echo.GET("/", srv.Health) srv.echo.GET("/events", srv.GetEventsByAddress) + srv.echo.GET("/blockInfo", srv.GetBlockInfo) } diff --git a/packages/relayer/http/server.go b/packages/relayer/http/server.go index 8ab615f66b9..8f8f888a9a1 100644 --- a/packages/relayer/http/server.go +++ b/packages/relayer/http/server.go @@ -14,14 +14,20 @@ import ( ) type Server struct { - echo *echo.Echo - eventRepo relayer.EventRepository + echo *echo.Echo + eventRepo relayer.EventRepository + blockRepo relayer.BlockRepository + l1EthClient relayer.EthClient + l2EthClient relayer.EthClient } type NewServerOpts struct { Echo *echo.Echo EventRepo relayer.EventRepository + BlockRepo relayer.BlockRepository CorsOrigins []string + L1EthClient relayer.EthClient + L2EthClient relayer.EthClient } func (opts NewServerOpts) Validate() error { @@ -37,6 +43,18 @@ func (opts NewServerOpts) Validate() error { return relayer.ErrNoCORSOrigins } + if opts.L1EthClient == nil { + return relayer.ErrNoEthClient + } + + if opts.L2EthClient == nil { + return relayer.ErrNoEthClient + } + + if opts.BlockRepo == nil { + return relayer.ErrNoBlockRepository + } + return nil } @@ -46,8 +64,11 @@ func NewServer(opts NewServerOpts) (*Server, error) { } srv := &Server{ - echo: opts.Echo, - eventRepo: opts.EventRepo, + blockRepo: opts.BlockRepo, + echo: opts.Echo, + eventRepo: opts.EventRepo, + l1EthClient: opts.L1EthClient, + l2EthClient: opts.L2EthClient, } corsOrigins := opts.CorsOrigins diff --git a/packages/relayer/http/server_test.go b/packages/relayer/http/server_test.go index cd20ec0158f..a3928b7818f 100644 --- a/packages/relayer/http/server_test.go +++ b/packages/relayer/http/server_test.go @@ -41,22 +41,64 @@ func Test_NewServer(t *testing.T) { Echo: echo.New(), EventRepo: &repo.EventRepository{}, CorsOrigins: make([]string, 0), + L1EthClient: &mock.EthClient{}, + L2EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, }, nil, }, + { + "noL1EthClient", + NewServerOpts{ + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + CorsOrigins: make([]string, 0), + L2EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, + }, + relayer.ErrNoEthClient, + }, + { + "noL2EthClient", + NewServerOpts{ + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + CorsOrigins: make([]string, 0), + L1EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, + }, + relayer.ErrNoEthClient, + }, + { + "noBlockRepo", + NewServerOpts{ + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + CorsOrigins: make([]string, 0), + L1EthClient: &mock.EthClient{}, + L2EthClient: &mock.EthClient{}, + }, + relayer.ErrNoBlockRepository, + }, { "noEventRepo", NewServerOpts{ Echo: echo.New(), CorsOrigins: make([]string, 0), + L1EthClient: &mock.EthClient{}, + L2EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, }, relayer.ErrNoEventRepository, }, { "noCorsOrigins", NewServerOpts{ - Echo: echo.New(), - EventRepo: &repo.EventRepository{}, + Echo: echo.New(), + EventRepo: &repo.EventRepository{}, + L1EthClient: &mock.EthClient{}, + L2EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, }, relayer.ErrNoCORSOrigins, }, @@ -65,6 +107,9 @@ func Test_NewServer(t *testing.T) { NewServerOpts{ EventRepo: &repo.EventRepository{}, CorsOrigins: make([]string, 0), + L1EthClient: &mock.EthClient{}, + L2EthClient: &mock.EthClient{}, + BlockRepo: &mock.BlockRepository{}, }, ErrNoHTTPFramework, }, diff --git a/packages/relayer/indexer/handle_event.go b/packages/relayer/indexer/handle_event.go index 18394df2ce0..a3714ae87fd 100644 --- a/packages/relayer/indexer/handle_event.go +++ b/packages/relayer/indexer/handle_event.go @@ -5,11 +5,13 @@ import ( "encoding/json" "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" log "github.com/sirupsen/logrus" "github.com/taikoxyz/taiko-mono/packages/relayer" "github.com/taikoxyz/taiko-mono/packages/relayer/contracts/bridge" + "github.com/taikoxyz/taiko-mono/packages/relayer/contracts/tokenvault" ) // handleEvent handles an individual MessageSent event @@ -44,11 +46,22 @@ func (svc *Service) handleEvent( return errors.Wrap(err, "json.Marshal(event)") } + eventType, canonicalToken, amount, err := eventTypeAmountAndCanonicalTokenFromEvent(event) + if err != nil { + return errors.Wrap(err, "eventTypeAmountAndCanonicalTokenFromEvent(event)") + } + e, err := svc.eventRepo.Save(ctx, relayer.SaveEventOpts{ - Name: eventName, - Data: string(marshaled), - ChainID: chainID, - Status: eventStatus, + Name: eventName, + Data: string(marshaled), + ChainID: chainID, + Status: eventStatus, + EventType: eventType, + CanonicalTokenAddress: canonicalToken.Addr.Hex(), + CanonicalTokenSymbol: canonicalToken.Symbol, + CanonicalTokenName: canonicalToken.Name, + CanonicalTokenDecimals: canonicalToken.Decimals, + Amount: amount.String(), }) if err != nil { return errors.Wrap(err, "svc.eventRepo.Save") @@ -67,6 +80,57 @@ func (svc *Service) handleEvent( return nil } +func eventTypeAmountAndCanonicalTokenFromEvent( + event *bridge.BridgeMessageSent, +) (relayer.EventType, relayer.CanonicalToken, *big.Int, error) { + eventType := relayer.EventTypeSendETH + + var canonicalToken relayer.CanonicalToken + + var amount *big.Int + + if event.Message.Data != nil && common.BytesToHash(event.Message.Data) != relayer.ZeroHash { + tokenVaultMD := bind.MetaData{ + ABI: tokenvault.TokenVaultABI, + } + + tokenVaultABI, err := tokenVaultMD.GetAbi() + if err != nil { + return eventType, relayer.CanonicalToken{}, big.NewInt(0), errors.Wrap(err, "tokenVaultMD.GetAbi()") + } + + method, err := tokenVaultABI.MethodById(event.Message.Data[:4]) + if err != nil { + return eventType, relayer.CanonicalToken{}, big.NewInt(0), errors.Wrap(err, "tokenVaultABI.MethodById") + } + + inputsMap := make(map[string]interface{}) + + if err := method.Inputs.UnpackIntoMap(inputsMap, event.Message.Data[4:]); err != nil { + return eventType, relayer.CanonicalToken{}, big.NewInt(0), errors.Wrap(err, "method.Inputs.UnpackIntoMap") + } + + if method.Name == "receiveERC20" { + eventType = relayer.EventTypeSendERC20 + + canonicalToken = inputsMap["canonicalToken"].(struct { + // nolint + ChainId *big.Int `json:"chainId"` + Addr common.Address `json:"addr"` + Decimals uint8 `json:"decimals"` + Symbol string `json:"symbol"` + Name string `json:"name"` + }) + + amount = inputsMap["amount"].(*big.Int) + } + } else { + amount = event.Message.DepositValue + } + + return eventType, canonicalToken, amount, nil +} + func canProcessMessage( ctx context.Context, eventStatus relayer.EventStatus, diff --git a/packages/relayer/indexer/handle_event_test.go b/packages/relayer/indexer/handle_event_test.go index ca209ab99cc..dcad470aca5 100644 --- a/packages/relayer/indexer/handle_event_test.go +++ b/packages/relayer/indexer/handle_event_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" "github.com/taikoxyz/taiko-mono/packages/relayer" + "github.com/taikoxyz/taiko-mono/packages/relayer/contracts/bridge" "github.com/taikoxyz/taiko-mono/packages/relayer/mock" ) @@ -132,3 +133,58 @@ func Test_eventStatusFromMsgHash(t *testing.T) { }) } } + +func Test_eventTypeAmountAndCanonicalTokenFromEvent(t *testing.T) { + tests := []struct { + name string + event *bridge.BridgeMessageSent + wantEventType relayer.EventType + wantCanonicalToken relayer.CanonicalToken + wantAmount *big.Int + wantError error + }{ + { + "receiveERC20", + &bridge.BridgeMessageSent{ + Message: bridge.IBridgeMessage{ + // nolint lll + Data: common.Hex2Bytes("0c6fab8200000000000000000000000000000000000000000000000000000000000000800000000000000000000000004ec242468812b6ffc8be8ff423af7bd23108d9910000000000000000000000004ec242468812b6ffc8be8ff423af7bd23108d99100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000007a68000000000000000000000000e4337137828c93d0046212ebda8a82a24356b67b000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000004544553540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000095465737445524332300000000000000000000000000000000000000000000000"), + }, + }, + relayer.EventTypeSendERC20, + relayer.CanonicalToken{ + ChainId: big.NewInt(31336), + Addr: common.HexToAddress("0xe4337137828c93D0046212ebDa8a82a24356b67B"), + Decimals: uint8(18), + Symbol: "TEST", + Name: "TestERC20", + }, + big.NewInt(1), + nil, + }, + { + "nilData", + &bridge.BridgeMessageSent{ + Message: bridge.IBridgeMessage{ + // nolint lll + DepositValue: big.NewInt(1), + Data: common.Hex2Bytes("00"), + }, + }, + relayer.EventTypeSendETH, + relayer.CanonicalToken{}, + big.NewInt(1), + nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + eventType, canonicalToken, amount, err := eventTypeAmountAndCanonicalTokenFromEvent(tt.event) + assert.Equal(t, tt.wantEventType, eventType) + assert.Equal(t, tt.wantCanonicalToken, canonicalToken) + assert.Equal(t, tt.wantAmount, amount) + assert.Equal(t, tt.wantError, err) + }) + } +} diff --git a/packages/relayer/migrations/1666650599_create_events_table.sql b/packages/relayer/migrations/1666650599_create_events_table.sql index 3251b2989e6..827d4595739 100644 --- a/packages/relayer/migrations/1666650599_create_events_table.sql +++ b/packages/relayer/migrations/1666650599_create_events_table.sql @@ -4,8 +4,14 @@ CREATE TABLE IF NOT EXISTS events ( id int NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL, status int NOT NULL DEFAULT 0, + event_type int NOT NULL DEFAULT 0, chain_id int NOT NULL, data JSON NOT NULL, + canonical_token_address VARCHAR(255) DEFAULT "", + canonical_token_symbol VARCHAR(10) DEFAULT "", + canonical_token_name VARCHAR(255) DEFAULT "", + canonical_token_decimals int DEFAULT 0, + amount VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP , updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); diff --git a/packages/relayer/repo/event.go b/packages/relayer/repo/event.go index 58bb8c163a6..c0dd7d7bce2 100644 --- a/packages/relayer/repo/event.go +++ b/packages/relayer/repo/event.go @@ -27,10 +27,16 @@ func NewEventRepository(db relayer.DB) (*EventRepository, error) { func (r *EventRepository) Save(ctx context.Context, opts relayer.SaveEventOpts) (*relayer.Event, error) { e := &relayer.Event{ - Data: datatypes.JSON(opts.Data), - Status: opts.Status, - ChainID: opts.ChainID.Int64(), - Name: opts.Name, + Data: datatypes.JSON(opts.Data), + Status: opts.Status, + ChainID: opts.ChainID.Int64(), + Name: opts.Name, + EventType: opts.EventType, + CanonicalTokenAddress: opts.CanonicalTokenAddress, + CanonicalTokenSymbol: opts.CanonicalTokenSymbol, + CanonicalTokenName: opts.CanonicalTokenName, + CanonicalTokenDecimals: opts.CanonicalTokenDecimals, + Amount: opts.Amount, } if err := r.db.GormDB().Create(e).Error; err != nil { return nil, errors.Wrap(err, "r.db.Create") diff --git a/packages/relayer/repo/event_test.go b/packages/relayer/repo/event_test.go index 4cb68f197ae..172efa12904 100644 --- a/packages/relayer/repo/event_test.go +++ b/packages/relayer/repo/event_test.go @@ -56,9 +56,15 @@ func TestIntegration_Event_Save(t *testing.T) { { "success", relayer.SaveEventOpts{ - Name: "test", - ChainID: big.NewInt(1), - Data: "{\"data\":\"something\"}", + Name: "test", + ChainID: big.NewInt(1), + Data: "{\"data\":\"something\"}", + EventType: relayer.EventType(relayer.EventTypeSendETH), + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }, nil, }, @@ -106,9 +112,15 @@ func TestIntegration_Event_UpdateStatus(t *testing.T) { if tt.name == "success" { _, err := eventRepo.Save(context.Background(), relayer.SaveEventOpts{ - Name: "test", - ChainID: big.NewInt(1), - Data: "{\"data\":\"something\"}", + Name: "test", + ChainID: big.NewInt(1), + Data: "{\"data\":\"something\"}", + EventType: relayer.EventTypeSendETH, + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }, ) assert.Equal(t, nil, err) @@ -131,10 +143,15 @@ func TestIntegration_Event_FindAllByAddressAndChainID(t *testing.T) { addr := common.HexToAddress("0x71C7656EC7ab88b098defB751B7401B5f6d8976F") _, err = eventRepo.Save(context.Background(), relayer.SaveEventOpts{ - Name: "name", - Data: fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())), - ChainID: big.NewInt(1), - Status: relayer.EventStatusDone, + Name: "name", + Data: fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())), + ChainID: big.NewInt(1), + Status: relayer.EventStatusDone, + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }) assert.Equal(t, nil, err) tests := []struct { @@ -150,11 +167,18 @@ func TestIntegration_Event_FindAllByAddressAndChainID(t *testing.T) { addr, []*relayer.Event{ { - ID: 1, - Name: "name", - Data: datatypes.JSON([]byte(fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())))), - ChainID: 1, - Status: relayer.EventStatusDone, + ID: 1, + Name: "name", + // nolint lll + Data: datatypes.JSON([]byte(fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())))), + ChainID: 1, + Status: relayer.EventStatusDone, + EventType: relayer.EventTypeSendETH, + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }, }, nil, @@ -196,10 +220,16 @@ func TestIntegration_Event_FindAllByAddress(t *testing.T) { addr := common.HexToAddress("0x71C7656EC7ab88b098defB751B7401B5f6d8976F") _, err = eventRepo.Save(context.Background(), relayer.SaveEventOpts{ - Name: "name", - Data: fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())), - ChainID: big.NewInt(1), - Status: relayer.EventStatusDone, + Name: "name", + Data: fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())), + ChainID: big.NewInt(1), + Status: relayer.EventStatusDone, + EventType: relayer.EventTypeSendETH, + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }) assert.Equal(t, nil, err) tests := []struct { @@ -213,11 +243,18 @@ func TestIntegration_Event_FindAllByAddress(t *testing.T) { addr, []*relayer.Event{ { - ID: 1, - Name: "name", - Data: datatypes.JSON([]byte(fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())))), - ChainID: 1, - Status: relayer.EventStatusDone, + ID: 1, + Name: "name", + // nolint lll + Data: datatypes.JSON([]byte(fmt.Sprintf(`{"Message": {"Owner": "%s"}}`, strings.ToLower(addr.Hex())))), + ChainID: 1, + Status: relayer.EventStatusDone, + EventType: relayer.EventTypeSendETH, + CanonicalTokenAddress: "0x1", + CanonicalTokenSymbol: "ETH", + CanonicalTokenName: "Ethereum", + CanonicalTokenDecimals: 18, + Amount: "1", }, }, nil, diff --git a/packages/relayer/types.go b/packages/relayer/types.go index ad847ec59ba..f9d32388ff8 100644 --- a/packages/relayer/types.go +++ b/packages/relayer/types.go @@ -3,6 +3,7 @@ package relayer import ( "context" "fmt" + "math/big" "time" "github.com/ethereum/go-ethereum" @@ -88,3 +89,17 @@ func WaitConfirmations(ctx context.Context, confirmer confirmer, confirmations u } } } + +type CanonicalToken struct { + // nolint + ChainId *big.Int `json:"chainId"` + Addr common.Address `json:"addr"` + Decimals uint8 `json:"decimals"` + Symbol string `json:"symbol"` + Name string `json:"name"` +} + +type EthClient interface { + BlockNumber(ctx context.Context) (uint64, error) + ChainID(ctx context.Context) (*big.Int, error) +}