diff --git a/packages/eventindexer/.default.env b/packages/eventindexer/.default.env index 9bd08910b28..da7c410fb5b 100644 --- a/packages/eventindexer/.default.env +++ b/packages/eventindexer/.default.env @@ -8,6 +8,8 @@ MYSQL_MAX_IDLE_CONNS=50 MYSQL_MAX_OPEN_CONNS=3000 MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 L1_TAIKO_ADDRESS=0x7B3AF414448ba906f02a1CA307C56c4ADFF27ce7 -L1_RPC_URL=wss://l1ws.a2.taiko.xyz +BRIDGE_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 +SWAP_ADDRESS=0x501f63210aE6D7Eeb50DaE74DA5Ae407515ee246 +RPC_URL=wss://l1ws.a2.taiko.xyz CORS_ORIGINS=* BLOCK_BATCH_SIZE=10 \ No newline at end of file diff --git a/packages/eventindexer/.l1.env b/packages/eventindexer/.l1.env new file mode 100644 index 00000000000..e13f1d9c7a1 --- /dev/null +++ b/packages/eventindexer/.l1.env @@ -0,0 +1,16 @@ +HTTP_PORT=4100 +PROMETHEUS_HTTP_PORT=6063 +MYSQL_USER=root +MYSQL_PASSWORD=root +MYSQL_DATABASE=eventindexer +MYSQL_HOST=localhost:3306 +MYSQL_MAX_IDLE_CONNS=50 +MYSQL_MAX_OPEN_CONNS=3000 +MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 +L1_TAIKO_ADDRESS=0x6375394335f34848b850114b66A49D6F47f2cdA8 +BRIDGE_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 +PROVER_POOL_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 +RPC_URL=wss://l1ws.test.taiko.xyz +CORS_ORIGINS=* +BLOCK_BATCH_SIZE=100 +CACHE_INTERVAL_IN_SECONDS=60 diff --git a/packages/eventindexer/.l2.env b/packages/eventindexer/.l2.env new file mode 100644 index 00000000000..0823cf0143c --- /dev/null +++ b/packages/eventindexer/.l2.env @@ -0,0 +1,15 @@ +HTTP_PORT=4100 +PROMETHEUS_HTTP_PORT=6063 +MYSQL_USER=root +MYSQL_PASSWORD=root +MYSQL_DATABASE=eventindexer +MYSQL_HOST=localhost:3306 +MYSQL_MAX_IDLE_CONNS=50 +MYSQL_MAX_OPEN_CONNS=3000 +MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 +PROVER_POOL_ADDRESS=0x7D992599E1B8b4508Ba6E2Ba97893b4C36C23A28 +SWAP_ADDRESS=0x501f63210aE6D7Eeb50DaE74DA5Ae407515ee246 +RPC_URL=wss://ws.test.taiko.xyz +CORS_ORIGINS=* +BLOCK_BATCH_SIZE=1000 +CACHE_INTERVAL_IN_SECONDS=60 diff --git a/packages/eventindexer/Swap.json b/packages/eventindexer/Swap.json new file mode 100644 index 00000000000..299a14b756b --- /dev/null +++ b/packages/eventindexer/Swap.json @@ -0,0 +1,1010 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_factory", + "type": "address" + }, + { + "internalType": "address", + "name": "_WETH", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountADesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "addLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountTokenDesired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETHMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "addLiquidityETH", + "outputs": [ + { + "internalType": "uint256", + "name": "amountToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveOut", + "type": "uint256" + } + ], + "name": "getAmountIn", + "outputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveOut", + "type": "uint256" + } + ], + "name": "getAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + } + ], + "name": "getAmountsIn", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + } + ], + "name": "getAmountsOut", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "reserveB", + "type": "uint256" + } + ], + "name": "quote", + "outputs": [ + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "removeLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETHMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "removeLiquidityETH", + "outputs": [ + { + "internalType": "uint256", + "name": "amountToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETH", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETHMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "removeLiquidityETHSupportingFeeOnTransferTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "amountETH", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETHMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "approveMax", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "removeLiquidityETHWithPermit", + "outputs": [ + { + "internalType": "uint256", + "name": "amountToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETH", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountTokenMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountETHMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "approveMax", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "amountETH", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint256", + "name": "liquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAMin", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountBMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "approveMax", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "removeLiquidityWithPermit", + "outputs": [ + { + "internalType": "uint256", + "name": "amountA", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountB", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapETHForExactTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactETHForTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForETH", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMax", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapTokensForExactETH", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMax", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapTokensForExactTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "type": "event", + "name": "Swap", + "inputs": [ + { + "type": "address", + "name": "sender", + "indexed": true + }, + { + "type": "uint256", + "name": "amount0In", + "indexed": false + }, + { + "type": "uint256", + "name": "amount1In", + "indexed": false + }, + { + "type": "uint256", + "name": "amount0Out", + "indexed": false + }, + { + "type": "uint256", + "name": "amount1Out", + "indexed": false + }, + { + "type": "address", + "name": "to", + "indexed": true + } + ], + "anonymous": false + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/packages/eventindexer/TaikoL1.json b/packages/eventindexer/TaikoL1.json index 8056f6f6b52..98c46e9f628 100644 --- a/packages/eventindexer/TaikoL1.json +++ b/packages/eventindexer/TaikoL1.json @@ -66,21 +66,6 @@ "name": "L1_FORK_CHOICE_NOT_FOUND", "type": "error" }, - { - "inputs": [], - "name": "L1_INSUFFICIENT_TOKEN", - "type": "error" - }, - { - "inputs": [], - "name": "L1_INSUFFICIENT_TOKEN", - "type": "error" - }, - { - "inputs": [], - "name": "L1_INSUFFICIENT_TOKEN", - "type": "error" - }, { "inputs": [], "name": "L1_INVALID_CONFIG", @@ -246,11 +231,6 @@ "name": "L1_TX_LIST_RANGE", "type": "error" }, - { - "inputs": [], - "name": "Overflow", - "type": "error" - }, { "inputs": [], "name": "RESOLVER_DENIED", @@ -394,6 +374,153 @@ "name": "BlockProposed", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "id", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "l1Height", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "l1Hash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "mixHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "txListHash", + "type": "bytes32" + }, + { + "internalType": "uint24", + "name": "txListByteStart", + "type": "uint24" + }, + { + "internalType": "uint24", + "name": "txListByteEnd", + "type": "uint24" + }, + { + "internalType": "uint32", + "name": "gasLimit", + "type": "uint32" + }, + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "address", + "name": "treasury", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "id", + "type": "uint64" + } + ], + "internalType": "struct TaikoData.EthDeposit[]", + "name": "depositsProcessed", + "type": "tuple[]" + } + ], + "indexed": false, + "internalType": "struct TaikoData.BlockMetadata", + "name": "meta", + "type": "tuple" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "blockFee", + "type": "uint64" + } + ], + "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": "bytes32", + "name": "signalRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "prover", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "parentGasUsed", + "type": "uint32" + } + ], + "name": "BlockProven", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -462,6 +589,56 @@ "name": "BlockVerified", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "reward", + "type": "uint64" + } + ], + "name": "BlockVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "srcHeight", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "signalRoot", + "type": "bytes32" + } + ], + "name": "CrossChainSynced", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -517,6 +694,36 @@ "name": "EthDeposited", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "id", + "type": "uint64" + } + ], + "indexed": false, + "internalType": "struct TaikoData.EthDeposit", + "name": "deposit", + "type": "tuple" + } + ], + "name": "EthDeposited", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -593,13 +800,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "depositEtherToL2", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, { "inputs": [ { @@ -608,9 +808,28 @@ "type": "uint256" } ], - "name": "depositTaikoToken", + "name": "canDepositEthToL2", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "depositEtherToL2", "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" }, { @@ -726,24 +945,29 @@ "name": "ethDepositMaxFee", "type": "uint256" }, + { + "internalType": "uint256", + "name": "ethDepositRingBufferSize", + "type": "uint256" + }, { "internalType": "uint64", - "name": "minEthDepositsPerBlock", + "name": "ethDepositMinCountPerBlock", "type": "uint64" }, { "internalType": "uint64", - "name": "maxEthDepositsPerBlock", + "name": "ethDepositMaxCountPerBlock", "type": "uint64" }, { "internalType": "uint96", - "name": "maxEthDepositAmount", + "name": "ethDepositMaxAmount", "type": "uint96" }, { "internalType": "uint96", - "name": "minEthDepositAmount", + "name": "ethDepositMinAmount", "type": "uint96" }, { @@ -859,25 +1083,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "proofTime", - "type": "uint64" - } - ], - "name": "getProofReward", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "getStateVariables", @@ -889,11 +1094,6 @@ "name": "blockFee", "type": "uint64" }, - { - "internalType": "uint64", - "name": "accBlockFees", - "type": "uint64" - }, { "internalType": "uint64", "name": "genesisHeight", @@ -909,26 +1109,11 @@ "name": "numBlocks", "type": "uint64" }, - { - "internalType": "uint64", - "name": "proofTimeIssued", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "proofTimeTarget", - "type": "uint64" - }, { "internalType": "uint64", "name": "lastVerifiedBlockId", "type": "uint64" }, - { - "internalType": "uint64", - "name": "accProposedAt", - "type": "uint64" - }, { "internalType": "uint64", "name": "nextEthDepositToProcess", @@ -1002,21 +1187,6 @@ "internalType": "uint64", "name": "_initBlockFee", "type": "uint64" - }, - { - "internalType": "uint64", - "name": "_initProofTimeTarget", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "_initProofTimeIssued", - "type": "uint64" - }, - { - "internalType": "uint16", - "name": "_adjustmentQuotient", - "type": "uint16" } ], "name": "init", @@ -1231,34 +1401,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "newProofTimeTarget", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "newProofTimeIssued", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "newBlockFee", - "type": "uint64" - }, - { - "internalType": "uint16", - "name": "newAdjustmentQuotient", - "type": "uint16" - } - ], - "name": "setProofParams", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "state", @@ -1275,7 +1417,7 @@ }, { "internalType": "uint16", - "name": "adjustmentQuotient", + "name": "__reserved70", "type": "uint16" }, { @@ -1290,12 +1432,12 @@ }, { "internalType": "uint64", - "name": "accProposedAt", + "name": "__reserved80", "type": "uint64" }, { "internalType": "uint64", - "name": "accBlockFees", + "name": "numEthDeposits", "type": "uint64" }, { @@ -1315,7 +1457,7 @@ }, { "internalType": "uint64", - "name": "proofTimeIssued", + "name": "__reserved90", "type": "uint64" }, { @@ -1325,7 +1467,7 @@ }, { "internalType": "uint64", - "name": "proofTimeTarget", + "name": "__reserved91", "type": "uint64" } ], @@ -1358,19 +1500,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawTaikoToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "stateMutability": "payable", "type": "receive" diff --git a/packages/eventindexer/abigen.sh b/packages/eventindexer/abigen.sh index 6481ec4ae1c..1814405d9f9 100755 --- a/packages/eventindexer/abigen.sh +++ b/packages/eventindexer/abigen.sh @@ -5,9 +5,9 @@ if [ ! -d "../protocol/out" ]; then exit 1 fi -paths=("TaikoL1.sol") +paths=("TaikoL1.sol" "Bridge.sol") -names=("TaikoL1") +names=("TaikoL1" "Bridge") for (( i = 0; i < ${#paths[@]}; ++i )); do diff --git a/packages/eventindexer/cli/cli.go b/packages/eventindexer/cli/cli.go index 3e5442b5d62..b4766d3a2b7 100644 --- a/packages/eventindexer/cli/cli.go +++ b/packages/eventindexer/cli/cli.go @@ -30,8 +30,7 @@ import ( var ( envVars = []string{ "HTTP_PORT", - "L1_TAIKO_ADDRESS", - "L1_RPC_URL", + "RPC_URL", "MYSQL_USER", "MYSQL_DATABASE", "MYSQL_HOST", @@ -45,6 +44,7 @@ var ( func Run( mode eventindexer.Mode, watchMode eventindexer.WatchMode, + httpOnly eventindexer.HTTPOnly, ) { if err := loadAndValidateEnv(); err != nil { log.Fatal(err) @@ -73,12 +73,12 @@ func Run( log.Fatal(err) } - l1EthClient, err := ethclient.Dial(os.Getenv("L1_RPC_URL")) + ethClient, err := ethclient.Dial(os.Getenv("RPC_URL")) if err != nil { log.Fatal(err) } - srv, err := newHTTPServer(db, l1EthClient) + srv, err := newHTTPServer(db, ethClient) if err != nil { log.Fatal(err) } @@ -91,59 +91,69 @@ func Run( } }() - eventRepository, err := repo.NewEventRepository(db) - if err != nil { - log.Fatal(err) - } - - statRepository, err := repo.NewStatRepository(db) - if err != nil { - log.Fatal(err) - } + if !httpOnly { + eventRepository, err := repo.NewEventRepository(db) + if err != nil { + log.Fatal(err) + } - blockRepository, err := repo.NewBlockRepository(db) - if err != nil { - log.Fatal(err) - } + statRepository, err := repo.NewStatRepository(db) + if err != nil { + log.Fatal(err) + } - blockBatchSize, err := strconv.Atoi(os.Getenv("BLOCK_BATCH_SIZE")) - if err != nil || blockBatchSize <= 0 { - blockBatchSize = defaultBlockBatchSize - } + blockRepository, err := repo.NewBlockRepository(db) + if err != nil { + log.Fatal(err) + } - var subscriptionBackoff time.Duration + blockBatchSize, err := strconv.Atoi(os.Getenv("BLOCK_BATCH_SIZE")) + if err != nil || blockBatchSize <= 0 { + blockBatchSize = defaultBlockBatchSize + } - subscriptionBackoffInSeconds, err := strconv.Atoi(os.Getenv("SUBSCRIPTION_BACKOFF_IN_SECONDS")) - if err != nil || subscriptionBackoffInSeconds <= 0 { - subscriptionBackoff = defaultSubscriptionBackoff - } else { - subscriptionBackoff = time.Duration(subscriptionBackoffInSeconds) * time.Second - } + var subscriptionBackoff time.Duration - l1RpcClient, err := rpc.DialContext(context.Background(), os.Getenv("L1_RPC_URL")) - if err != nil { - log.Fatal(err) - } + subscriptionBackoffInSeconds, err := strconv.Atoi(os.Getenv("SUBSCRIPTION_BACKOFF_IN_SECONDS")) + if err != nil || subscriptionBackoffInSeconds <= 0 { + subscriptionBackoff = defaultSubscriptionBackoff + } else { + subscriptionBackoff = time.Duration(subscriptionBackoffInSeconds) * time.Second + } - i, err := indexer.NewService(indexer.NewServiceOpts{ - EventRepo: eventRepository, - BlockRepo: blockRepository, - StatRepo: statRepository, - EthClient: l1EthClient, - RPCClient: l1RpcClient, - SrcTaikoAddress: common.HexToAddress(os.Getenv("L1_TAIKO_ADDRESS")), - BlockBatchSize: uint64(blockBatchSize), - SubscriptionBackoff: subscriptionBackoff, - }) - if err != nil { - log.Fatal(err) - } + rpcClient, err := rpc.DialContext(context.Background(), os.Getenv("RPC_URL")) + if err != nil { + log.Fatal(err) + } - go func() { - if err := i.FilterThenSubscribe(context.Background(), mode, watchMode); err != nil { + i, err := indexer.NewService(indexer.NewServiceOpts{ + EventRepo: eventRepository, + BlockRepo: blockRepository, + StatRepo: statRepository, + EthClient: ethClient, + RPCClient: rpcClient, + SrcTaikoAddress: common.HexToAddress(os.Getenv("L1_TAIKO_ADDRESS")), + SrcBridgeAddress: common.HexToAddress(os.Getenv("BRIDGE_ADDRESS")), + SrcSwapAddress: common.HexToAddress(os.Getenv("SWAP_ADDRESS")), + BlockBatchSize: uint64(blockBatchSize), + SubscriptionBackoff: subscriptionBackoff, + }) + if err != nil { log.Fatal(err) } - }() + + var filterFunc indexer.FilterFunc = indexer.L1FilterFunc + + if os.Getenv("L1_TAIKO_ADDRESS") == "" { + filterFunc = indexer.L2FilterFunc + } + + go func() { + if err := i.FilterThenSubscribe(context.Background(), mode, watchMode, filterFunc); err != nil { + log.Fatal(err) + } + }() + } <-forever } diff --git a/packages/eventindexer/cmd/main.go b/packages/eventindexer/cmd/main.go index 96f89836c04..9056e9d5d48 100644 --- a/packages/eventindexer/cmd/main.go +++ b/packages/eventindexer/cmd/main.go @@ -22,10 +22,17 @@ func main() { filter-and-subscribe: catch up on all previous messages, then subscribe to new messages `) + httpOnlyPtr := flag.Bool("http-only", false, `only run an http server and don't index blocks. + options: + true: only run an http server, dont index blocks + false: run an http server and index blocks + `) + flag.Parse() cli.Run( eventindexer.Mode(*modePtr), eventindexer.WatchMode(*watchModePtr), + eventindexer.HTTPOnly(*httpOnlyPtr), ) } diff --git a/packages/eventindexer/contracts/bridge/Bridge.go b/packages/eventindexer/contracts/bridge/Bridge.go new file mode 100644 index 00000000000..b0e3c92070e --- /dev/null +++ b/packages/eventindexer/contracts/bridge/Bridge.go @@ -0,0 +1,2372 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bridge + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// IBridgeContext is an auto generated low-level Go binding around an user-defined struct. +type IBridgeContext struct { + MsgHash [32]byte + Sender common.Address + SrcChainId *big.Int +} + +// 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 +} + +// BridgeMetaData contains all meta data concerning the Bridge contract. +var BridgeMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"B_CANNOT_RECEIVE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ERC20_CANNOT_RECEIVE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ETHER_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ETHER_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_DO_NOT_BURN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_NOT_AUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_PARAM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FAILED_TRANSFER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FAILED_TRANSFER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FORBIDDEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FORBIDDEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_GAS_LIMIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_GAS_LIMIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INCORRECT_VALUE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INCORRECT_VALUE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INIT_PARAM_ERROR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_HASH_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_HASH_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NON_RETRIABLE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NON_RETRIABLE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_NULL_APP_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_OWNER_IS_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_OWNER_IS_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_OWNER_IS_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_SIGNAL_NOT_RECEIVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_SIGNAL_NOT_RECEIVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_STATUS_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_STATUS_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_TO_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_TO_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ZERO_SIGNAL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"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\":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\"},{\"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\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transactor\",\"type\":\"address\"}],\"name\":\"MessageStatusChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transactor\",\"type\":\"address\"}],\"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\"}],\"name\":\"isEtherReleased\",\"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\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"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\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// BridgeABI is the input ABI used to generate the binding from. +// Deprecated: Use BridgeMetaData.ABI instead. +var BridgeABI = BridgeMetaData.ABI + +// Bridge is an auto generated Go binding around an Ethereum contract. +type Bridge struct { + BridgeCaller // Read-only binding to the contract + BridgeTransactor // Write-only binding to the contract + BridgeFilterer // Log filterer for contract events +} + +// BridgeCaller is an auto generated read-only Go binding around an Ethereum contract. +type BridgeCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BridgeTransactor is an auto generated write-only Go binding around an Ethereum contract. +type BridgeTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BridgeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type BridgeFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BridgeSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type BridgeSession struct { + Contract *Bridge // 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 +} + +// BridgeCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type BridgeCallerSession struct { + Contract *BridgeCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// BridgeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type BridgeTransactorSession struct { + Contract *BridgeTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// BridgeRaw is an auto generated low-level Go binding around an Ethereum contract. +type BridgeRaw struct { + Contract *Bridge // Generic contract binding to access the raw methods on +} + +// BridgeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type BridgeCallerRaw struct { + Contract *BridgeCaller // Generic read-only contract binding to access the raw methods on +} + +// BridgeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type BridgeTransactorRaw struct { + Contract *BridgeTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewBridge creates a new instance of Bridge, bound to a specific deployed contract. +func NewBridge(address common.Address, backend bind.ContractBackend) (*Bridge, error) { + contract, err := bindBridge(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Bridge{BridgeCaller: BridgeCaller{contract: contract}, BridgeTransactor: BridgeTransactor{contract: contract}, BridgeFilterer: BridgeFilterer{contract: contract}}, nil +} + +// NewBridgeCaller creates a new read-only instance of Bridge, bound to a specific deployed contract. +func NewBridgeCaller(address common.Address, caller bind.ContractCaller) (*BridgeCaller, error) { + contract, err := bindBridge(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &BridgeCaller{contract: contract}, nil +} + +// NewBridgeTransactor creates a new write-only instance of Bridge, bound to a specific deployed contract. +func NewBridgeTransactor(address common.Address, transactor bind.ContractTransactor) (*BridgeTransactor, error) { + contract, err := bindBridge(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &BridgeTransactor{contract: contract}, nil +} + +// NewBridgeFilterer creates a new log filterer instance of Bridge, bound to a specific deployed contract. +func NewBridgeFilterer(address common.Address, filterer bind.ContractFilterer) (*BridgeFilterer, error) { + contract, err := bindBridge(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &BridgeFilterer{contract: contract}, nil +} + +// bindBridge binds a generic wrapper to an already deployed contract. +func bindBridge(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := BridgeMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Bridge *BridgeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Bridge.Contract.BridgeCaller.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 (_Bridge *BridgeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Bridge.Contract.BridgeTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Bridge *BridgeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Bridge.Contract.BridgeTransactor.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 (_Bridge *BridgeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Bridge.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 (_Bridge *BridgeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Bridge.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Bridge *BridgeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Bridge.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 (_Bridge *BridgeCaller) AddressManager(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Bridge.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 (_Bridge *BridgeSession) AddressManager() (common.Address, error) { + return _Bridge.Contract.AddressManager(&_Bridge.CallOpts) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_Bridge *BridgeCallerSession) AddressManager() (common.Address, error) { + return _Bridge.Contract.AddressManager(&_Bridge.CallOpts) +} + +// Context is a free data retrieval call binding the contract method 0xd0496d6a. +// +// Solidity: function context() view returns((bytes32,address,uint256)) +func (_Bridge *BridgeCaller) Context(opts *bind.CallOpts) (IBridgeContext, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "context") + + if err != nil { + return *new(IBridgeContext), err + } + + out0 := *abi.ConvertType(out[0], new(IBridgeContext)).(*IBridgeContext) + + return out0, err + +} + +// Context is a free data retrieval call binding the contract method 0xd0496d6a. +// +// Solidity: function context() view returns((bytes32,address,uint256)) +func (_Bridge *BridgeSession) Context() (IBridgeContext, error) { + return _Bridge.Contract.Context(&_Bridge.CallOpts) +} + +// Context is a free data retrieval call binding the contract method 0xd0496d6a. +// +// Solidity: function context() view returns((bytes32,address,uint256)) +func (_Bridge *BridgeCallerSession) Context() (IBridgeContext, error) { + return _Bridge.Contract.Context(&_Bridge.CallOpts) +} + +// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. +// +// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeCaller) GetMessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "getMessageStatus", msgHash) + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. +// +// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeSession) GetMessageStatus(msgHash [32]byte) (uint8, error) { + return _Bridge.Contract.GetMessageStatus(&_Bridge.CallOpts, msgHash) +} + +// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. +// +// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeCallerSession) GetMessageStatus(msgHash [32]byte) (uint8, error) { + return _Bridge.Contract.GetMessageStatus(&_Bridge.CallOpts, msgHash) +} + +// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// +// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) +func (_Bridge *BridgeCaller) GetMessageStatusSlot(opts *bind.CallOpts, msgHash [32]byte) ([32]byte, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "getMessageStatusSlot", msgHash) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// +// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) +func (_Bridge *BridgeSession) GetMessageStatusSlot(msgHash [32]byte) ([32]byte, error) { + return _Bridge.Contract.GetMessageStatusSlot(&_Bridge.CallOpts, msgHash) +} + +// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// +// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) +func (_Bridge *BridgeCallerSession) GetMessageStatusSlot(msgHash [32]byte) ([32]byte, error) { + return _Bridge.Contract.GetMessageStatusSlot(&_Bridge.CallOpts, msgHash) +} + +// HashMessage is a free data retrieval call binding the contract method 0x5817b0c3. +// +// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) +func (_Bridge *BridgeCaller) HashMessage(opts *bind.CallOpts, message IBridgeMessage) ([32]byte, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "hashMessage", message) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// HashMessage is a free data retrieval call binding the contract method 0x5817b0c3. +// +// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) +func (_Bridge *BridgeSession) HashMessage(message IBridgeMessage) ([32]byte, error) { + return _Bridge.Contract.HashMessage(&_Bridge.CallOpts, message) +} + +// HashMessage is a free data retrieval call binding the contract method 0x5817b0c3. +// +// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) +func (_Bridge *BridgeCallerSession) HashMessage(message IBridgeMessage) ([32]byte, error) { + return _Bridge.Contract.HashMessage(&_Bridge.CallOpts, message) +} + +// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. +// +// 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) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. +// +// 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 enabled) +func (_Bridge *BridgeCallerSession) IsDestChainEnabled(_chainId *big.Int) (bool, error) { + return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, _chainId) +} + +// IsEtherReleased is a free data retrieval call binding the contract method 0x343b643c. +// +// Solidity: function isEtherReleased(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeCaller) IsEtherReleased(opts *bind.CallOpts, msgHash [32]byte) (bool, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "isEtherReleased", msgHash) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsEtherReleased is a free data retrieval call binding the contract method 0x343b643c. +// +// Solidity: function isEtherReleased(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeSession) IsEtherReleased(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsEtherReleased(&_Bridge.CallOpts, msgHash) +} + +// IsEtherReleased is a free data retrieval call binding the contract method 0x343b643c. +// +// Solidity: function isEtherReleased(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeCallerSession) IsEtherReleased(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsEtherReleased(&_Bridge.CallOpts, msgHash) +} + +// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// +// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeCaller) IsMessageFailed(opts *bind.CallOpts, msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "isMessageFailed", msgHash, destChainId, proof) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// +// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeSession) IsMessageFailed(msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { + return _Bridge.Contract.IsMessageFailed(&_Bridge.CallOpts, msgHash, destChainId, proof) +} + +// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// +// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeCallerSession) IsMessageFailed(msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { + return _Bridge.Contract.IsMessageFailed(&_Bridge.CallOpts, msgHash, destChainId, proof) +} + +// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// +// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeCaller) IsMessageReceived(opts *bind.CallOpts, msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "isMessageReceived", msgHash, srcChainId, proof) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// +// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeSession) IsMessageReceived(msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { + return _Bridge.Contract.IsMessageReceived(&_Bridge.CallOpts, msgHash, srcChainId, proof) +} + +// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// +// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) +func (_Bridge *BridgeCallerSession) IsMessageReceived(msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { + return _Bridge.Contract.IsMessageReceived(&_Bridge.CallOpts, msgHash, srcChainId, proof) +} + +// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// +// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeCaller) IsMessageSent(opts *bind.CallOpts, msgHash [32]byte) (bool, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "isMessageSent", msgHash) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// +// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeSession) IsMessageSent(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, msgHash) +} + +// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// +// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) +func (_Bridge *BridgeCallerSession) IsMessageSent(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, msgHash) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Bridge *BridgeCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Bridge.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 (_Bridge *BridgeSession) Owner() (common.Address, error) { + return _Bridge.Contract.Owner(&_Bridge.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_Bridge *BridgeCallerSession) Owner() (common.Address, error) { + return _Bridge.Contract.Owner(&_Bridge.CallOpts) +} + +// Resolve is a free data retrieval call binding the contract method 0x6c6563f6. +// +// Solidity: function resolve(uint256 chainId, bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeCaller) Resolve(opts *bind.CallOpts, chainId *big.Int, name [32]byte, allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "resolve", chainId, 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 0x6c6563f6. +// +// Solidity: function resolve(uint256 chainId, bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeSession) Resolve(chainId *big.Int, name [32]byte, allowZeroAddress bool) (common.Address, error) { + return _Bridge.Contract.Resolve(&_Bridge.CallOpts, chainId, name, allowZeroAddress) +} + +// Resolve is a free data retrieval call binding the contract method 0x6c6563f6. +// +// Solidity: function resolve(uint256 chainId, bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeCallerSession) Resolve(chainId *big.Int, name [32]byte, allowZeroAddress bool) (common.Address, error) { + return _Bridge.Contract.Resolve(&_Bridge.CallOpts, chainId, name, allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeCaller) Resolve0(opts *bind.CallOpts, name [32]byte, allowZeroAddress bool) (common.Address, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "resolve0", 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 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeSession) Resolve0(name [32]byte, allowZeroAddress bool) (common.Address, error) { + return _Bridge.Contract.Resolve0(&_Bridge.CallOpts, name, allowZeroAddress) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xa86f9d9e. +// +// Solidity: function resolve(bytes32 name, bool allowZeroAddress) view returns(address) +func (_Bridge *BridgeCallerSession) Resolve0(name [32]byte, allowZeroAddress bool) (common.Address, error) { + return _Bridge.Contract.Resolve0(&_Bridge.CallOpts, name, allowZeroAddress) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address _addressManager) returns() +func (_Bridge *BridgeTransactor) Init(opts *bind.TransactOpts, _addressManager common.Address) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "init", _addressManager) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address _addressManager) returns() +func (_Bridge *BridgeSession) Init(_addressManager common.Address) (*types.Transaction, error) { + return _Bridge.Contract.Init(&_Bridge.TransactOpts, _addressManager) +} + +// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// +// Solidity: function init(address _addressManager) returns() +func (_Bridge *BridgeTransactorSession) Init(_addressManager common.Address) (*types.Transaction, error) { + return _Bridge.Contract.Init(&_Bridge.TransactOpts, _addressManager) +} + +// ProcessMessage is a paid mutator transaction binding the contract method 0xfee99b22. +// +// Solidity: function processMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeTransactor) ProcessMessage(opts *bind.TransactOpts, message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "processMessage", message, proof) +} + +// ProcessMessage is a paid mutator transaction binding the contract method 0xfee99b22. +// +// Solidity: function processMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeSession) ProcessMessage(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.Contract.ProcessMessage(&_Bridge.TransactOpts, message, proof) +} + +// ProcessMessage is a paid mutator transaction binding the contract method 0xfee99b22. +// +// Solidity: function processMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeTransactorSession) ProcessMessage(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.Contract.ProcessMessage(&_Bridge.TransactOpts, message, proof) +} + +// ReleaseEther is a paid mutator transaction binding the contract method 0xbac443e2. +// +// Solidity: function releaseEther((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeTransactor) ReleaseEther(opts *bind.TransactOpts, message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "releaseEther", message, proof) +} + +// ReleaseEther is a paid mutator transaction binding the contract method 0xbac443e2. +// +// Solidity: function releaseEther((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeSession) ReleaseEther(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.Contract.ReleaseEther(&_Bridge.TransactOpts, message, proof) +} + +// ReleaseEther is a paid mutator transaction binding the contract method 0xbac443e2. +// +// Solidity: function releaseEther((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bytes proof) returns() +func (_Bridge *BridgeTransactorSession) ReleaseEther(message IBridgeMessage, proof []byte) (*types.Transaction, error) { + return _Bridge.Contract.ReleaseEther(&_Bridge.TransactOpts, message, proof) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Bridge *BridgeTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Bridge *BridgeSession) RenounceOwnership() (*types.Transaction, error) { + return _Bridge.Contract.RenounceOwnership(&_Bridge.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_Bridge *BridgeTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _Bridge.Contract.RenounceOwnership(&_Bridge.TransactOpts) +} + +// RetryMessage is a paid mutator transaction binding the contract method 0xf9803919. +// +// Solidity: function retryMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bool isLastAttempt) returns() +func (_Bridge *BridgeTransactor) RetryMessage(opts *bind.TransactOpts, message IBridgeMessage, isLastAttempt bool) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "retryMessage", message, isLastAttempt) +} + +// RetryMessage is a paid mutator transaction binding the contract method 0xf9803919. +// +// Solidity: function retryMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bool isLastAttempt) returns() +func (_Bridge *BridgeSession) RetryMessage(message IBridgeMessage, isLastAttempt bool) (*types.Transaction, error) { + return _Bridge.Contract.RetryMessage(&_Bridge.TransactOpts, message, isLastAttempt) +} + +// RetryMessage is a paid mutator transaction binding the contract method 0xf9803919. +// +// Solidity: function retryMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message, bool isLastAttempt) returns() +func (_Bridge *BridgeTransactorSession) RetryMessage(message IBridgeMessage, isLastAttempt bool) (*types.Transaction, error) { + return _Bridge.Contract.RetryMessage(&_Bridge.TransactOpts, message, isLastAttempt) +} + +// SendMessage is a paid mutator transaction binding the contract method 0x96e17852. +// +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +func (_Bridge *BridgeTransactor) SendMessage(opts *bind.TransactOpts, message IBridgeMessage) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "sendMessage", message) +} + +// SendMessage is a paid mutator transaction binding the contract method 0x96e17852. +// +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +func (_Bridge *BridgeSession) SendMessage(message IBridgeMessage) (*types.Transaction, error) { + return _Bridge.Contract.SendMessage(&_Bridge.TransactOpts, message) +} + +// SendMessage is a paid mutator transaction binding the contract method 0x96e17852. +// +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +func (_Bridge *BridgeTransactorSession) SendMessage(message IBridgeMessage) (*types.Transaction, error) { + return _Bridge.Contract.SendMessage(&_Bridge.TransactOpts, message) +} + +// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. +// +// Solidity: function setAddressManager(address newAddressManager) returns() +func (_Bridge *BridgeTransactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "setAddressManager", newAddressManager) +} + +// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. +// +// Solidity: function setAddressManager(address newAddressManager) returns() +func (_Bridge *BridgeSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { + return _Bridge.Contract.SetAddressManager(&_Bridge.TransactOpts, newAddressManager) +} + +// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. +// +// Solidity: function setAddressManager(address newAddressManager) returns() +func (_Bridge *BridgeTransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { + return _Bridge.Contract.SetAddressManager(&_Bridge.TransactOpts, newAddressManager) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Bridge *BridgeTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Bridge *BridgeSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Bridge.Contract.TransferOwnership(&_Bridge.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_Bridge *BridgeTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _Bridge.Contract.TransferOwnership(&_Bridge.TransactOpts, newOwner) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Bridge *BridgeTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Bridge.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Bridge *BridgeSession) Receive() (*types.Transaction, error) { + return _Bridge.Contract.Receive(&_Bridge.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Bridge *BridgeTransactorSession) Receive() (*types.Transaction, error) { + return _Bridge.Contract.Receive(&_Bridge.TransactOpts) +} + +// BridgeAddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the Bridge contract. +type BridgeAddressManagerChangedIterator struct { + Event *BridgeAddressManagerChanged // 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 *BridgeAddressManagerChangedIterator) 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(BridgeAddressManagerChanged) + 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(BridgeAddressManagerChanged) + 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 *BridgeAddressManagerChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeAddressManagerChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeAddressManagerChanged represents a AddressManagerChanged event raised by the Bridge contract. +type BridgeAddressManagerChanged struct { + AddressManager common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. +// +// Solidity: event AddressManagerChanged(address addressManager) +func (_Bridge *BridgeFilterer) FilterAddressManagerChanged(opts *bind.FilterOpts) (*BridgeAddressManagerChangedIterator, error) { + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "AddressManagerChanged") + if err != nil { + return nil, err + } + return &BridgeAddressManagerChangedIterator{contract: _Bridge.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil +} + +// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. +// +// Solidity: event AddressManagerChanged(address addressManager) +func (_Bridge *BridgeFilterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *BridgeAddressManagerChanged) (event.Subscription, error) { + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "AddressManagerChanged") + 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(BridgeAddressManagerChanged) + if err := _Bridge.contract.UnpackLog(event, "AddressManagerChanged", 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 +} + +// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. +// +// Solidity: event AddressManagerChanged(address addressManager) +func (_Bridge *BridgeFilterer) ParseAddressManagerChanged(log types.Log) (*BridgeAddressManagerChanged, error) { + event := new(BridgeAddressManagerChanged) + if err := _Bridge.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeDestChainEnabledIterator is returned from FilterDestChainEnabled and is used to iterate over the raw logs and unpacked data for DestChainEnabled events raised by the Bridge contract. +type BridgeDestChainEnabledIterator struct { + Event *BridgeDestChainEnabled // 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 *BridgeDestChainEnabledIterator) 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(BridgeDestChainEnabled) + 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(BridgeDestChainEnabled) + 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 *BridgeDestChainEnabledIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeDestChainEnabledIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeDestChainEnabled represents a DestChainEnabled event raised by the Bridge contract. +type BridgeDestChainEnabled struct { + ChainId *big.Int + Enabled bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDestChainEnabled is a free log retrieval operation binding the contract event 0x9f391218c06d4fc365ceb15f340bb3d77306b28ac0b8d4e519aec2654794536d. +// +// Solidity: event DestChainEnabled(uint256 indexed chainId, bool enabled) +func (_Bridge *BridgeFilterer) FilterDestChainEnabled(opts *bind.FilterOpts, chainId []*big.Int) (*BridgeDestChainEnabledIterator, error) { + + var chainIdRule []interface{} + for _, chainIdItem := range chainId { + chainIdRule = append(chainIdRule, chainIdItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "DestChainEnabled", chainIdRule) + if err != nil { + return nil, err + } + return &BridgeDestChainEnabledIterator{contract: _Bridge.contract, event: "DestChainEnabled", logs: logs, sub: sub}, nil +} + +// WatchDestChainEnabled is a free log subscription operation binding the contract event 0x9f391218c06d4fc365ceb15f340bb3d77306b28ac0b8d4e519aec2654794536d. +// +// Solidity: event DestChainEnabled(uint256 indexed chainId, bool enabled) +func (_Bridge *BridgeFilterer) WatchDestChainEnabled(opts *bind.WatchOpts, sink chan<- *BridgeDestChainEnabled, chainId []*big.Int) (event.Subscription, error) { + + var chainIdRule []interface{} + for _, chainIdItem := range chainId { + chainIdRule = append(chainIdRule, chainIdItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "DestChainEnabled", chainIdRule) + 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(BridgeDestChainEnabled) + if err := _Bridge.contract.UnpackLog(event, "DestChainEnabled", 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 +} + +// ParseDestChainEnabled is a log parse operation binding the contract event 0x9f391218c06d4fc365ceb15f340bb3d77306b28ac0b8d4e519aec2654794536d. +// +// Solidity: event DestChainEnabled(uint256 indexed chainId, bool enabled) +func (_Bridge *BridgeFilterer) ParseDestChainEnabled(log types.Log) (*BridgeDestChainEnabled, error) { + event := new(BridgeDestChainEnabled) + if err := _Bridge.contract.UnpackLog(event, "DestChainEnabled", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeEtherReleasedIterator is returned from FilterEtherReleased and is used to iterate over the raw logs and unpacked data for EtherReleased events raised by the Bridge contract. +type BridgeEtherReleasedIterator struct { + Event *BridgeEtherReleased // 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 *BridgeEtherReleasedIterator) 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(BridgeEtherReleased) + 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(BridgeEtherReleased) + 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 *BridgeEtherReleasedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeEtherReleasedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeEtherReleased represents a EtherReleased event raised by the Bridge contract. +type BridgeEtherReleased struct { + MsgHash [32]byte + To common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEtherReleased is a free log retrieval operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) FilterEtherReleased(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeEtherReleasedIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "EtherReleased", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeEtherReleasedIterator{contract: _Bridge.contract, event: "EtherReleased", logs: logs, sub: sub}, nil +} + +// WatchEtherReleased is a free log subscription operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) WatchEtherReleased(opts *bind.WatchOpts, sink chan<- *BridgeEtherReleased, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "EtherReleased", msgHashRule) + 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(BridgeEtherReleased) + if err := _Bridge.contract.UnpackLog(event, "EtherReleased", 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 +} + +// ParseEtherReleased is a log parse operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) ParseEtherReleased(log types.Log) (*BridgeEtherReleased, error) { + event := new(BridgeEtherReleased) + if err := _Bridge.contract.UnpackLog(event, "EtherReleased", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeEtherReleased0Iterator is returned from FilterEtherReleased0 and is used to iterate over the raw logs and unpacked data for EtherReleased0 events raised by the Bridge contract. +type BridgeEtherReleased0Iterator struct { + Event *BridgeEtherReleased0 // 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 *BridgeEtherReleased0Iterator) 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(BridgeEtherReleased0) + 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(BridgeEtherReleased0) + 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 *BridgeEtherReleased0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeEtherReleased0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeEtherReleased0 represents a EtherReleased0 event raised by the Bridge contract. +type BridgeEtherReleased0 struct { + MsgHash [32]byte + To common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEtherReleased0 is a free log retrieval operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) FilterEtherReleased0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeEtherReleased0Iterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "EtherReleased0", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeEtherReleased0Iterator{contract: _Bridge.contract, event: "EtherReleased0", logs: logs, sub: sub}, nil +} + +// WatchEtherReleased0 is a free log subscription operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) WatchEtherReleased0(opts *bind.WatchOpts, sink chan<- *BridgeEtherReleased0, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "EtherReleased0", msgHashRule) + 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(BridgeEtherReleased0) + if err := _Bridge.contract.UnpackLog(event, "EtherReleased0", 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 +} + +// ParseEtherReleased0 is a log parse operation binding the contract event 0xea00c741e39d1d9ab1c6703152d71f9da09a782ed4ae128414730dadbb9bd847. +// +// Solidity: event EtherReleased(bytes32 indexed msgHash, address to, uint256 amount) +func (_Bridge *BridgeFilterer) ParseEtherReleased0(log types.Log) (*BridgeEtherReleased0, error) { + event := new(BridgeEtherReleased0) + if err := _Bridge.contract.UnpackLog(event, "EtherReleased0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Bridge contract. +type BridgeInitializedIterator struct { + Event *BridgeInitialized // 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 *BridgeInitializedIterator) 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(BridgeInitialized) + 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(BridgeInitialized) + 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 *BridgeInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeInitialized represents a Initialized event raised by the Bridge contract. +type BridgeInitialized 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 (_Bridge *BridgeFilterer) FilterInitialized(opts *bind.FilterOpts) (*BridgeInitializedIterator, error) { + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &BridgeInitializedIterator{contract: _Bridge.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 (_Bridge *BridgeFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *BridgeInitialized) (event.Subscription, error) { + + logs, sub, err := _Bridge.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(BridgeInitialized) + if err := _Bridge.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 (_Bridge *BridgeFilterer) ParseInitialized(log types.Log) (*BridgeInitialized, error) { + event := new(BridgeInitialized) + if err := _Bridge.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeMessageSentIterator is returned from FilterMessageSent and is used to iterate over the raw logs and unpacked data for MessageSent events raised by the Bridge contract. +type BridgeMessageSentIterator struct { + Event *BridgeMessageSent // 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 *BridgeMessageSentIterator) 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(BridgeMessageSent) + 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(BridgeMessageSent) + 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 *BridgeMessageSentIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeMessageSentIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeMessageSent represents a MessageSent event raised by the Bridge contract. +type BridgeMessageSent struct { + MsgHash [32]byte + Message IBridgeMessage + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMessageSent is a free log retrieval operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) FilterMessageSent(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageSentIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageSent", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeMessageSentIterator{contract: _Bridge.contract, event: "MessageSent", logs: logs, sub: sub}, nil +} + +// WatchMessageSent is a free log subscription operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) WatchMessageSent(opts *bind.WatchOpts, sink chan<- *BridgeMessageSent, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageSent", msgHashRule) + 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(BridgeMessageSent) + if err := _Bridge.contract.UnpackLog(event, "MessageSent", 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 +} + +// ParseMessageSent is a log parse operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) ParseMessageSent(log types.Log) (*BridgeMessageSent, error) { + event := new(BridgeMessageSent) + if err := _Bridge.contract.UnpackLog(event, "MessageSent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeMessageSent0Iterator is returned from FilterMessageSent0 and is used to iterate over the raw logs and unpacked data for MessageSent0 events raised by the Bridge contract. +type BridgeMessageSent0Iterator struct { + Event *BridgeMessageSent0 // 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 *BridgeMessageSent0Iterator) 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(BridgeMessageSent0) + 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(BridgeMessageSent0) + 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 *BridgeMessageSent0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeMessageSent0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeMessageSent0 represents a MessageSent0 event raised by the Bridge contract. +type BridgeMessageSent0 struct { + MsgHash [32]byte + Message IBridgeMessage + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMessageSent0 is a free log retrieval operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) FilterMessageSent0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageSent0Iterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageSent0", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeMessageSent0Iterator{contract: _Bridge.contract, event: "MessageSent0", logs: logs, sub: sub}, nil +} + +// WatchMessageSent0 is a free log subscription operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) WatchMessageSent0(opts *bind.WatchOpts, sink chan<- *BridgeMessageSent0, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageSent0", msgHashRule) + 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(BridgeMessageSent0) + if err := _Bridge.contract.UnpackLog(event, "MessageSent0", 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 +} + +// ParseMessageSent0 is a log parse operation binding the contract event 0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3. +// +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) ParseMessageSent0(log types.Log) (*BridgeMessageSent0, error) { + event := new(BridgeMessageSent0) + if err := _Bridge.contract.UnpackLog(event, "MessageSent0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeMessageStatusChangedIterator is returned from FilterMessageStatusChanged and is used to iterate over the raw logs and unpacked data for MessageStatusChanged events raised by the Bridge contract. +type BridgeMessageStatusChangedIterator struct { + Event *BridgeMessageStatusChanged // 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 *BridgeMessageStatusChangedIterator) 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(BridgeMessageStatusChanged) + 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(BridgeMessageStatusChanged) + 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 *BridgeMessageStatusChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeMessageStatusChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeMessageStatusChanged represents a MessageStatusChanged event raised by the Bridge contract. +type BridgeMessageStatusChanged struct { + MsgHash [32]byte + Status uint8 + Transactor common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMessageStatusChanged is a free log retrieval operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) FilterMessageStatusChanged(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageStatusChangedIterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageStatusChanged", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeMessageStatusChangedIterator{contract: _Bridge.contract, event: "MessageStatusChanged", logs: logs, sub: sub}, nil +} + +// WatchMessageStatusChanged is a free log subscription operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) WatchMessageStatusChanged(opts *bind.WatchOpts, sink chan<- *BridgeMessageStatusChanged, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageStatusChanged", msgHashRule) + 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(BridgeMessageStatusChanged) + if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged", 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 +} + +// ParseMessageStatusChanged is a log parse operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) ParseMessageStatusChanged(log types.Log) (*BridgeMessageStatusChanged, error) { + event := new(BridgeMessageStatusChanged) + if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeMessageStatusChanged0Iterator is returned from FilterMessageStatusChanged0 and is used to iterate over the raw logs and unpacked data for MessageStatusChanged0 events raised by the Bridge contract. +type BridgeMessageStatusChanged0Iterator struct { + Event *BridgeMessageStatusChanged0 // 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 *BridgeMessageStatusChanged0Iterator) 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(BridgeMessageStatusChanged0) + 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(BridgeMessageStatusChanged0) + 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 *BridgeMessageStatusChanged0Iterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeMessageStatusChanged0Iterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeMessageStatusChanged0 represents a MessageStatusChanged0 event raised by the Bridge contract. +type BridgeMessageStatusChanged0 struct { + MsgHash [32]byte + Status uint8 + Transactor common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterMessageStatusChanged0 is a free log retrieval operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) FilterMessageStatusChanged0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageStatusChanged0Iterator, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageStatusChanged0", msgHashRule) + if err != nil { + return nil, err + } + return &BridgeMessageStatusChanged0Iterator{contract: _Bridge.contract, event: "MessageStatusChanged0", logs: logs, sub: sub}, nil +} + +// WatchMessageStatusChanged0 is a free log subscription operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) WatchMessageStatusChanged0(opts *bind.WatchOpts, sink chan<- *BridgeMessageStatusChanged0, msgHash [][32]byte) (event.Subscription, error) { + + var msgHashRule []interface{} + for _, msgHashItem := range msgHash { + msgHashRule = append(msgHashRule, msgHashItem) + } + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageStatusChanged0", msgHashRule) + 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(BridgeMessageStatusChanged0) + if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged0", 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 +} + +// ParseMessageStatusChanged0 is a log parse operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +func (_Bridge *BridgeFilterer) ParseMessageStatusChanged0(log types.Log) (*BridgeMessageStatusChanged0, error) { + event := new(BridgeMessageStatusChanged0) + if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged0", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Bridge contract. +type BridgeOwnershipTransferredIterator struct { + Event *BridgeOwnershipTransferred // 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 *BridgeOwnershipTransferredIterator) 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(BridgeOwnershipTransferred) + 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(BridgeOwnershipTransferred) + 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 *BridgeOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeOwnershipTransferred represents a OwnershipTransferred event raised by the Bridge contract. +type BridgeOwnershipTransferred 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 (_Bridge *BridgeFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*BridgeOwnershipTransferredIterator, 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 := _Bridge.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &BridgeOwnershipTransferredIterator{contract: _Bridge.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 (_Bridge *BridgeFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *BridgeOwnershipTransferred, 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 := _Bridge.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(BridgeOwnershipTransferred) + if err := _Bridge.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 (_Bridge *BridgeFilterer) ParseOwnershipTransferred(log types.Log) (*BridgeOwnershipTransferred, error) { + event := new(BridgeOwnershipTransferred) + if err := _Bridge.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// BridgeSignalSentIterator is returned from FilterSignalSent and is used to iterate over the raw logs and unpacked data for SignalSent events raised by the Bridge contract. +type BridgeSignalSentIterator struct { + Event *BridgeSignalSent // 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 *BridgeSignalSentIterator) 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(BridgeSignalSent) + 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(BridgeSignalSent) + 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 *BridgeSignalSentIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *BridgeSignalSentIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// BridgeSignalSent represents a SignalSent event raised by the Bridge contract. +type BridgeSignalSent struct { + Sender common.Address + MsgHash [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSignalSent is a free log retrieval operation binding the contract event 0xf0958489d2a32db2b0faf27a72a31fdf28f2636ca5532f1b077ddc2f51b20d1d. +// +// Solidity: event SignalSent(address sender, bytes32 msgHash) +func (_Bridge *BridgeFilterer) FilterSignalSent(opts *bind.FilterOpts) (*BridgeSignalSentIterator, error) { + + logs, sub, err := _Bridge.contract.FilterLogs(opts, "SignalSent") + if err != nil { + return nil, err + } + return &BridgeSignalSentIterator{contract: _Bridge.contract, event: "SignalSent", logs: logs, sub: sub}, nil +} + +// WatchSignalSent is a free log subscription operation binding the contract event 0xf0958489d2a32db2b0faf27a72a31fdf28f2636ca5532f1b077ddc2f51b20d1d. +// +// Solidity: event SignalSent(address sender, bytes32 msgHash) +func (_Bridge *BridgeFilterer) WatchSignalSent(opts *bind.WatchOpts, sink chan<- *BridgeSignalSent) (event.Subscription, error) { + + logs, sub, err := _Bridge.contract.WatchLogs(opts, "SignalSent") + 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(BridgeSignalSent) + if err := _Bridge.contract.UnpackLog(event, "SignalSent", 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 +} + +// ParseSignalSent is a log parse operation binding the contract event 0xf0958489d2a32db2b0faf27a72a31fdf28f2636ca5532f1b077ddc2f51b20d1d. +// +// Solidity: event SignalSent(address sender, bytes32 msgHash) +func (_Bridge *BridgeFilterer) ParseSignalSent(log types.Log) (*BridgeSignalSent, error) { + event := new(BridgeSignalSent) + if err := _Bridge.contract.UnpackLog(event, "SignalSent", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/packages/eventindexer/contracts/swap/swap.go b/packages/eventindexer/contracts/swap/swap.go new file mode 100644 index 00000000000..542e34d86b7 --- /dev/null +++ b/packages/eventindexer/contracts/swap/swap.go @@ -0,0 +1,935 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package swap + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// SwapMetaData contains all meta data concerning the Swap contract. +var SwapMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_WETH\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountADesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenDesired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountIn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveOut\",\"type\":\"uint256\"}],\"name\":\"getAmountOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsIn\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"}],\"name\":\"getAmountsOut\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveB\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityETHSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTokenMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountETHMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountETH\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAMin\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountBMin\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"approveMax\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"removeLiquidityWithPermit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountB\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapETHForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactETHForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForETHSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountOutMin\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapExactTokensForTokensSupportingFeeOnTransferTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactETH\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountInMax\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"path\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapTokensForExactTokens\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"type\":\"event\",\"name\":\"Swap\",\"inputs\":[{\"type\":\"address\",\"name\":\"sender\",\"indexed\":true},{\"type\":\"uint256\",\"name\":\"amount0In\",\"indexed\":false},{\"type\":\"uint256\",\"name\":\"amount1In\",\"indexed\":false},{\"type\":\"uint256\",\"name\":\"amount0Out\",\"indexed\":false},{\"type\":\"uint256\",\"name\":\"amount1Out\",\"indexed\":false},{\"type\":\"address\",\"name\":\"to\",\"indexed\":true}],\"anonymous\":false},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", +} + +// SwapABI is the input ABI used to generate the binding from. +// Deprecated: Use SwapMetaData.ABI instead. +var SwapABI = SwapMetaData.ABI + +// Swap is an auto generated Go binding around an Ethereum contract. +type Swap struct { + SwapCaller // Read-only binding to the contract + SwapTransactor // Write-only binding to the contract + SwapFilterer // Log filterer for contract events +} + +// SwapCaller is an auto generated read-only Go binding around an Ethereum contract. +type SwapCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SwapTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SwapFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SwapSession struct { + Contract *Swap // 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 +} + +// SwapCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SwapCallerSession struct { + Contract *SwapCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SwapTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SwapTransactorSession struct { + Contract *SwapTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SwapRaw is an auto generated low-level Go binding around an Ethereum contract. +type SwapRaw struct { + Contract *Swap // Generic contract binding to access the raw methods on +} + +// SwapCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SwapCallerRaw struct { + Contract *SwapCaller // Generic read-only contract binding to access the raw methods on +} + +// SwapTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SwapTransactorRaw struct { + Contract *SwapTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSwap creates a new instance of Swap, bound to a specific deployed contract. +func NewSwap(address common.Address, backend bind.ContractBackend) (*Swap, error) { + contract, err := bindSwap(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Swap{SwapCaller: SwapCaller{contract: contract}, SwapTransactor: SwapTransactor{contract: contract}, SwapFilterer: SwapFilterer{contract: contract}}, nil +} + +// NewSwapCaller creates a new read-only instance of Swap, bound to a specific deployed contract. +func NewSwapCaller(address common.Address, caller bind.ContractCaller) (*SwapCaller, error) { + contract, err := bindSwap(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SwapCaller{contract: contract}, nil +} + +// NewSwapTransactor creates a new write-only instance of Swap, bound to a specific deployed contract. +func NewSwapTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapTransactor, error) { + contract, err := bindSwap(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SwapTransactor{contract: contract}, nil +} + +// NewSwapFilterer creates a new log filterer instance of Swap, bound to a specific deployed contract. +func NewSwapFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapFilterer, error) { + contract, err := bindSwap(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SwapFilterer{contract: contract}, nil +} + +// bindSwap binds a generic wrapper to an already deployed contract. +func bindSwap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := SwapMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Swap *SwapRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Swap.Contract.SwapCaller.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 (_Swap *SwapRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.Contract.SwapTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Swap *SwapRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Swap.Contract.SwapTransactor.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 (_Swap *SwapCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Swap.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 (_Swap *SwapTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Swap *SwapTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Swap.Contract.contract.Transact(opts, method, params...) +} + +// WETH is a free data retrieval call binding the contract method 0xad5c4648. +// +// Solidity: function WETH() view returns(address) +func (_Swap *SwapCaller) WETH(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "WETH") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// WETH is a free data retrieval call binding the contract method 0xad5c4648. +// +// Solidity: function WETH() view returns(address) +func (_Swap *SwapSession) WETH() (common.Address, error) { + return _Swap.Contract.WETH(&_Swap.CallOpts) +} + +// WETH is a free data retrieval call binding the contract method 0xad5c4648. +// +// Solidity: function WETH() view returns(address) +func (_Swap *SwapCallerSession) WETH() (common.Address, error) { + return _Swap.Contract.WETH(&_Swap.CallOpts) +} + +// Factory is a free data retrieval call binding the contract method 0xc45a0155. +// +// Solidity: function factory() view returns(address) +func (_Swap *SwapCaller) Factory(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "factory") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Factory is a free data retrieval call binding the contract method 0xc45a0155. +// +// Solidity: function factory() view returns(address) +func (_Swap *SwapSession) Factory() (common.Address, error) { + return _Swap.Contract.Factory(&_Swap.CallOpts) +} + +// Factory is a free data retrieval call binding the contract method 0xc45a0155. +// +// Solidity: function factory() view returns(address) +func (_Swap *SwapCallerSession) Factory() (common.Address, error) { + return _Swap.Contract.Factory(&_Swap.CallOpts) +} + +// GetAmountIn is a free data retrieval call binding the contract method 0x85f8c259. +// +// Solidity: function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountIn) +func (_Swap *SwapCaller) GetAmountIn(opts *bind.CallOpts, amountOut *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "getAmountIn", amountOut, reserveIn, reserveOut) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetAmountIn is a free data retrieval call binding the contract method 0x85f8c259. +// +// Solidity: function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountIn) +func (_Swap *SwapSession) GetAmountIn(amountOut *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + return _Swap.Contract.GetAmountIn(&_Swap.CallOpts, amountOut, reserveIn, reserveOut) +} + +// GetAmountIn is a free data retrieval call binding the contract method 0x85f8c259. +// +// Solidity: function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountIn) +func (_Swap *SwapCallerSession) GetAmountIn(amountOut *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + return _Swap.Contract.GetAmountIn(&_Swap.CallOpts, amountOut, reserveIn, reserveOut) +} + +// GetAmountOut is a free data retrieval call binding the contract method 0x054d50d4. +// +// Solidity: function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountOut) +func (_Swap *SwapCaller) GetAmountOut(opts *bind.CallOpts, amountIn *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "getAmountOut", amountIn, reserveIn, reserveOut) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetAmountOut is a free data retrieval call binding the contract method 0x054d50d4. +// +// Solidity: function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountOut) +func (_Swap *SwapSession) GetAmountOut(amountIn *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + return _Swap.Contract.GetAmountOut(&_Swap.CallOpts, amountIn, reserveIn, reserveOut) +} + +// GetAmountOut is a free data retrieval call binding the contract method 0x054d50d4. +// +// Solidity: function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) pure returns(uint256 amountOut) +func (_Swap *SwapCallerSession) GetAmountOut(amountIn *big.Int, reserveIn *big.Int, reserveOut *big.Int) (*big.Int, error) { + return _Swap.Contract.GetAmountOut(&_Swap.CallOpts, amountIn, reserveIn, reserveOut) +} + +// GetAmountsIn is a free data retrieval call binding the contract method 0x1f00ca74. +// +// Solidity: function getAmountsIn(uint256 amountOut, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapCaller) GetAmountsIn(opts *bind.CallOpts, amountOut *big.Int, path []common.Address) ([]*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "getAmountsIn", amountOut, path) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// GetAmountsIn is a free data retrieval call binding the contract method 0x1f00ca74. +// +// Solidity: function getAmountsIn(uint256 amountOut, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapSession) GetAmountsIn(amountOut *big.Int, path []common.Address) ([]*big.Int, error) { + return _Swap.Contract.GetAmountsIn(&_Swap.CallOpts, amountOut, path) +} + +// GetAmountsIn is a free data retrieval call binding the contract method 0x1f00ca74. +// +// Solidity: function getAmountsIn(uint256 amountOut, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapCallerSession) GetAmountsIn(amountOut *big.Int, path []common.Address) ([]*big.Int, error) { + return _Swap.Contract.GetAmountsIn(&_Swap.CallOpts, amountOut, path) +} + +// GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f. +// +// Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapCaller) GetAmountsOut(opts *bind.CallOpts, amountIn *big.Int, path []common.Address) ([]*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "getAmountsOut", amountIn, path) + + if err != nil { + return *new([]*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) + + return out0, err + +} + +// GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f. +// +// Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) { + return _Swap.Contract.GetAmountsOut(&_Swap.CallOpts, amountIn, path) +} + +// GetAmountsOut is a free data retrieval call binding the contract method 0xd06ca61f. +// +// Solidity: function getAmountsOut(uint256 amountIn, address[] path) view returns(uint256[] amounts) +func (_Swap *SwapCallerSession) GetAmountsOut(amountIn *big.Int, path []common.Address) ([]*big.Int, error) { + return _Swap.Contract.GetAmountsOut(&_Swap.CallOpts, amountIn, path) +} + +// Quote is a free data retrieval call binding the contract method 0xad615dec. +// +// Solidity: function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) pure returns(uint256 amountB) +func (_Swap *SwapCaller) Quote(opts *bind.CallOpts, amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "quote", amountA, reserveA, reserveB) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Quote is a free data retrieval call binding the contract method 0xad615dec. +// +// Solidity: function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) pure returns(uint256 amountB) +func (_Swap *SwapSession) Quote(amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) { + return _Swap.Contract.Quote(&_Swap.CallOpts, amountA, reserveA, reserveB) +} + +// Quote is a free data retrieval call binding the contract method 0xad615dec. +// +// Solidity: function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) pure returns(uint256 amountB) +func (_Swap *SwapCallerSession) Quote(amountA *big.Int, reserveA *big.Int, reserveB *big.Int) (*big.Int, error) { + return _Swap.Contract.Quote(&_Swap.CallOpts, amountA, reserveA, reserveB) +} + +// AddLiquidity is a paid mutator transaction binding the contract method 0xe8e33700. +// +// Solidity: function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB, uint256 liquidity) +func (_Swap *SwapTransactor) AddLiquidity(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address, amountADesired *big.Int, amountBDesired *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "addLiquidity", tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline) +} + +// AddLiquidity is a paid mutator transaction binding the contract method 0xe8e33700. +// +// Solidity: function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB, uint256 liquidity) +func (_Swap *SwapSession) AddLiquidity(tokenA common.Address, tokenB common.Address, amountADesired *big.Int, amountBDesired *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.AddLiquidity(&_Swap.TransactOpts, tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline) +} + +// AddLiquidity is a paid mutator transaction binding the contract method 0xe8e33700. +// +// Solidity: function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB, uint256 liquidity) +func (_Swap *SwapTransactorSession) AddLiquidity(tokenA common.Address, tokenB common.Address, amountADesired *big.Int, amountBDesired *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.AddLiquidity(&_Swap.TransactOpts, tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, to, deadline) +} + +// AddLiquidityETH is a paid mutator transaction binding the contract method 0xf305d719. +// +// Solidity: function addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) payable returns(uint256 amountToken, uint256 amountETH, uint256 liquidity) +func (_Swap *SwapTransactor) AddLiquidityETH(opts *bind.TransactOpts, token common.Address, amountTokenDesired *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "addLiquidityETH", token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline) +} + +// AddLiquidityETH is a paid mutator transaction binding the contract method 0xf305d719. +// +// Solidity: function addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) payable returns(uint256 amountToken, uint256 amountETH, uint256 liquidity) +func (_Swap *SwapSession) AddLiquidityETH(token common.Address, amountTokenDesired *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.AddLiquidityETH(&_Swap.TransactOpts, token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline) +} + +// AddLiquidityETH is a paid mutator transaction binding the contract method 0xf305d719. +// +// Solidity: function addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) payable returns(uint256 amountToken, uint256 amountETH, uint256 liquidity) +func (_Swap *SwapTransactorSession) AddLiquidityETH(token common.Address, amountTokenDesired *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.AddLiquidityETH(&_Swap.TransactOpts, token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidity is a paid mutator transaction binding the contract method 0xbaa2abde. +// +// Solidity: function removeLiquidity(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapTransactor) RemoveLiquidity(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidity", tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline) +} + +// RemoveLiquidity is a paid mutator transaction binding the contract method 0xbaa2abde. +// +// Solidity: function removeLiquidity(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapSession) RemoveLiquidity(tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidity(&_Swap.TransactOpts, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline) +} + +// RemoveLiquidity is a paid mutator transaction binding the contract method 0xbaa2abde. +// +// Solidity: function removeLiquidity(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapTransactorSession) RemoveLiquidity(tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidity(&_Swap.TransactOpts, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline) +} + +// RemoveLiquidityETH is a paid mutator transaction binding the contract method 0x02751cec. +// +// Solidity: function removeLiquidityETH(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapTransactor) RemoveLiquidityETH(opts *bind.TransactOpts, token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidityETH", token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETH is a paid mutator transaction binding the contract method 0x02751cec. +// +// Solidity: function removeLiquidityETH(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapSession) RemoveLiquidityETH(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETH(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETH is a paid mutator transaction binding the contract method 0x02751cec. +// +// Solidity: function removeLiquidityETH(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapTransactorSession) RemoveLiquidityETH(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETH(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xaf2979eb. +// +// Solidity: function removeLiquidityETHSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountETH) +func (_Swap *SwapTransactor) RemoveLiquidityETHSupportingFeeOnTransferTokens(opts *bind.TransactOpts, token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidityETHSupportingFeeOnTransferTokens", token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xaf2979eb. +// +// Solidity: function removeLiquidityETHSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountETH) +func (_Swap *SwapSession) RemoveLiquidityETHSupportingFeeOnTransferTokens(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHSupportingFeeOnTransferTokens(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xaf2979eb. +// +// Solidity: function removeLiquidityETHSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) returns(uint256 amountETH) +func (_Swap *SwapTransactorSession) RemoveLiquidityETHSupportingFeeOnTransferTokens(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHSupportingFeeOnTransferTokens(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline) +} + +// RemoveLiquidityETHWithPermit is a paid mutator transaction binding the contract method 0xded9382a. +// +// Solidity: function removeLiquidityETHWithPermit(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapTransactor) RemoveLiquidityETHWithPermit(opts *bind.TransactOpts, token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidityETHWithPermit", token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityETHWithPermit is a paid mutator transaction binding the contract method 0xded9382a. +// +// Solidity: function removeLiquidityETHWithPermit(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapSession) RemoveLiquidityETHWithPermit(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHWithPermit(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityETHWithPermit is a paid mutator transaction binding the contract method 0xded9382a. +// +// Solidity: function removeLiquidityETHWithPermit(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountToken, uint256 amountETH) +func (_Swap *SwapTransactorSession) RemoveLiquidityETHWithPermit(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHWithPermit(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5b0d5984. +// +// Solidity: function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountETH) +func (_Swap *SwapTransactor) RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(opts *bind.TransactOpts, token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5b0d5984. +// +// Solidity: function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountETH) +func (_Swap *SwapSession) RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5b0d5984. +// +// Solidity: function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountETH) +func (_Swap *SwapTransactorSession) RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(token common.Address, liquidity *big.Int, amountTokenMin *big.Int, amountETHMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityETHWithPermitSupportingFeeOnTransferTokens(&_Swap.TransactOpts, token, liquidity, amountTokenMin, amountETHMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityWithPermit is a paid mutator transaction binding the contract method 0x2195995c. +// +// Solidity: function removeLiquidityWithPermit(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapTransactor) RemoveLiquidityWithPermit(opts *bind.TransactOpts, tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "removeLiquidityWithPermit", tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityWithPermit is a paid mutator transaction binding the contract method 0x2195995c. +// +// Solidity: function removeLiquidityWithPermit(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapSession) RemoveLiquidityWithPermit(tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityWithPermit(&_Swap.TransactOpts, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline, approveMax, v, r, s) +} + +// RemoveLiquidityWithPermit is a paid mutator transaction binding the contract method 0x2195995c. +// +// Solidity: function removeLiquidityWithPermit(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s) returns(uint256 amountA, uint256 amountB) +func (_Swap *SwapTransactorSession) RemoveLiquidityWithPermit(tokenA common.Address, tokenB common.Address, liquidity *big.Int, amountAMin *big.Int, amountBMin *big.Int, to common.Address, deadline *big.Int, approveMax bool, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _Swap.Contract.RemoveLiquidityWithPermit(&_Swap.TransactOpts, tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline, approveMax, v, r, s) +} + +// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41. +// +// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapETHForExactTokens(opts *bind.TransactOpts, amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapETHForExactTokens", amountOut, path, to, deadline) +} + +// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41. +// +// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapSession) SwapETHForExactTokens(amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapETHForExactTokens(&_Swap.TransactOpts, amountOut, path, to, deadline) +} + +// SwapETHForExactTokens is a paid mutator transaction binding the contract method 0xfb3bdb41. +// +// Solidity: function swapETHForExactTokens(uint256 amountOut, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapETHForExactTokens(amountOut *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapETHForExactTokens(&_Swap.TransactOpts, amountOut, path, to, deadline) +} + +// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5. +// +// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapExactETHForTokens(opts *bind.TransactOpts, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactETHForTokens", amountOutMin, path, to, deadline) +} + +// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5. +// +// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapSession) SwapExactETHForTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactETHForTokens(&_Swap.TransactOpts, amountOutMin, path, to, deadline) +} + +// SwapExactETHForTokens is a paid mutator transaction binding the contract method 0x7ff36ab5. +// +// Solidity: function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapExactETHForTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactETHForTokens(&_Swap.TransactOpts, amountOutMin, path, to, deadline) +} + +// SwapExactETHForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xb6f9de95. +// +// Solidity: function swapExactETHForTokensSupportingFeeOnTransferTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns() +func (_Swap *SwapTransactor) SwapExactETHForTokensSupportingFeeOnTransferTokens(opts *bind.TransactOpts, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactETHForTokensSupportingFeeOnTransferTokens", amountOutMin, path, to, deadline) +} + +// SwapExactETHForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xb6f9de95. +// +// Solidity: function swapExactETHForTokensSupportingFeeOnTransferTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns() +func (_Swap *SwapSession) SwapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactETHForTokensSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountOutMin, path, to, deadline) +} + +// SwapExactETHForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0xb6f9de95. +// +// Solidity: function swapExactETHForTokensSupportingFeeOnTransferTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) payable returns() +func (_Swap *SwapTransactorSession) SwapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactETHForTokensSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5. +// +// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapExactTokensForETH(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactTokensForETH", amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5. +// +// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapSession) SwapExactTokensForETH(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForETH(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETH is a paid mutator transaction binding the contract method 0x18cbafe5. +// +// Solidity: function swapExactTokensForETH(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapExactTokensForETH(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForETH(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x791ac947. +// +// Solidity: function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapTransactor) SwapExactTokensForETHSupportingFeeOnTransferTokens(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactTokensForETHSupportingFeeOnTransferTokens", amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x791ac947. +// +// Solidity: function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapSession) SwapExactTokensForETHSupportingFeeOnTransferTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForETHSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForETHSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x791ac947. +// +// Solidity: function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapTransactorSession) SwapExactTokensForETHSupportingFeeOnTransferTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForETHSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739. +// +// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapExactTokensForTokens(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactTokensForTokens", amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739. +// +// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapSession) SwapExactTokensForTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokens is a paid mutator transaction binding the contract method 0x38ed1739. +// +// Solidity: function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapExactTokensForTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5c11d795. +// +// Solidity: function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapTransactor) SwapExactTokensForTokensSupportingFeeOnTransferTokens(opts *bind.TransactOpts, amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapExactTokensForTokensSupportingFeeOnTransferTokens", amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5c11d795. +// +// Solidity: function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapSession) SwapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForTokensSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapExactTokensForTokensSupportingFeeOnTransferTokens is a paid mutator transaction binding the contract method 0x5c11d795. +// +// Solidity: function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline) returns() +func (_Swap *SwapTransactorSession) SwapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn *big.Int, amountOutMin *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapExactTokensForTokensSupportingFeeOnTransferTokens(&_Swap.TransactOpts, amountIn, amountOutMin, path, to, deadline) +} + +// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a. +// +// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapTokensForExactETH(opts *bind.TransactOpts, amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapTokensForExactETH", amountOut, amountInMax, path, to, deadline) +} + +// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a. +// +// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapSession) SwapTokensForExactETH(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapTokensForExactETH(&_Swap.TransactOpts, amountOut, amountInMax, path, to, deadline) +} + +// SwapTokensForExactETH is a paid mutator transaction binding the contract method 0x4a25d94a. +// +// Solidity: function swapTokensForExactETH(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapTokensForExactETH(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapTokensForExactETH(&_Swap.TransactOpts, amountOut, amountInMax, path, to, deadline) +} + +// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee. +// +// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactor) SwapTokensForExactTokens(opts *bind.TransactOpts, amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "swapTokensForExactTokens", amountOut, amountInMax, path, to, deadline) +} + +// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee. +// +// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapSession) SwapTokensForExactTokens(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapTokensForExactTokens(&_Swap.TransactOpts, amountOut, amountInMax, path, to, deadline) +} + +// SwapTokensForExactTokens is a paid mutator transaction binding the contract method 0x8803dbee. +// +// Solidity: function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] path, address to, uint256 deadline) returns(uint256[] amounts) +func (_Swap *SwapTransactorSession) SwapTokensForExactTokens(amountOut *big.Int, amountInMax *big.Int, path []common.Address, to common.Address, deadline *big.Int) (*types.Transaction, error) { + return _Swap.Contract.SwapTokensForExactTokens(&_Swap.TransactOpts, amountOut, amountInMax, path, to, deadline) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Swap *SwapTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Swap *SwapSession) Receive() (*types.Transaction, error) { + return _Swap.Contract.Receive(&_Swap.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_Swap *SwapTransactorSession) Receive() (*types.Transaction, error) { + return _Swap.Contract.Receive(&_Swap.TransactOpts) +} + +// SwapSwapIterator is returned from FilterSwap and is used to iterate over the raw logs and unpacked data for Swap events raised by the Swap contract. +type SwapSwapIterator struct { + Event *SwapSwap // 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 *SwapSwapIterator) 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(SwapSwap) + 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(SwapSwap) + 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 *SwapSwapIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SwapSwapIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SwapSwap represents a Swap event raised by the Swap contract. +type SwapSwap struct { + Sender common.Address + Amount0In *big.Int + Amount1In *big.Int + Amount0Out *big.Int + Amount1Out *big.Int + To common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSwap is a free log retrieval operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. +// +// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) +func (_Swap *SwapFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*SwapSwapIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Swap.contract.FilterLogs(opts, "Swap", senderRule, toRule) + if err != nil { + return nil, err + } + return &SwapSwapIterator{contract: _Swap.contract, event: "Swap", logs: logs, sub: sub}, nil +} + +// WatchSwap is a free log subscription operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. +// +// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) +func (_Swap *SwapFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *SwapSwap, sender []common.Address, to []common.Address) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Swap.contract.WatchLogs(opts, "Swap", senderRule, 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(SwapSwap) + if err := _Swap.contract.UnpackLog(event, "Swap", 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 +} + +// ParseSwap is a log parse operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. +// +// Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) +func (_Swap *SwapFilterer) ParseSwap(log types.Log) (*SwapSwap, error) { + event := new(SwapSwap) + if err := _Swap.contract.UnpackLog(event, "Swap", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/packages/eventindexer/event.go b/packages/eventindexer/event.go index b695fb9359d..b13d0443966 100644 --- a/packages/eventindexer/event.go +++ b/packages/eventindexer/event.go @@ -14,6 +14,8 @@ var ( EventNameBlockProven = "BlockProven" EventNameBlockProposed = "BlockProposed" EventNameBlockVerified = "BlockVerified" + EventNameMessageSent = "MessageSent" + EventNameSwap = "Swap" ) // Event represents a stored EVM event. The fields will be serialized @@ -73,4 +75,9 @@ type EventRepository interface { address string, event string, ) (paginate.Page, error) + FirstByAddressAndEventName( + ctx context.Context, + address string, + event string, + ) (*Event, error) } diff --git a/packages/eventindexer/http/galaxe.go b/packages/eventindexer/http/galaxe.go new file mode 100644 index 00000000000..b80793055b4 --- /dev/null +++ b/packages/eventindexer/http/galaxe.go @@ -0,0 +1,9 @@ +package http + +type galaxeData struct { + IsOK bool `json:"is_ok"` +} + +type galaxeAPIResponse struct { + Data galaxeData `json:"data"` +} diff --git a/packages/eventindexer/http/routes.go b/packages/eventindexer/http/routes.go index 8c0f1620b54..f48c04de30a 100644 --- a/packages/eventindexer/http/routes.go +++ b/packages/eventindexer/http/routes.go @@ -9,4 +9,10 @@ func (srv *Server) configureRoutes() { srv.echo.GET("/eventByAddress", srv.GetCountByAddressAndEventName) srv.echo.GET("/events", srv.GetByAddressAndEventName) srv.echo.GET("/stats", srv.GetStats) + + galaxeAPI := srv.echo.Group("/api") + + galaxeAPI.GET("/user-proposed-block", srv.UserProposedBlock) + galaxeAPI.GET("/user-proved-block", srv.UserProvedBlock) + galaxeAPI.GET("/user-bridged", srv.UserBridged) } diff --git a/packages/eventindexer/http/user_bridged.go b/packages/eventindexer/http/user_bridged.go new file mode 100644 index 00000000000..f8b00405d54 --- /dev/null +++ b/packages/eventindexer/http/user_bridged.go @@ -0,0 +1,32 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func (srv *Server) UserBridged(c echo.Context) error { + event, err := srv.eventRepo.FirstByAddressAndEventName( + c.Request().Context(), + c.QueryParam("address"), + eventindexer.EventNameMessageSent, + ) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + var found bool = false + + if event != nil { + found = true + } + + return c.JSON(http.StatusOK, &galaxeAPIResponse{ + Data: galaxeData{ + IsOK: found, + }, + }) +} diff --git a/packages/eventindexer/http/user_proposed_block.go b/packages/eventindexer/http/user_proposed_block.go new file mode 100644 index 00000000000..77a2084009f --- /dev/null +++ b/packages/eventindexer/http/user_proposed_block.go @@ -0,0 +1,32 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func (srv *Server) UserProposedBlock(c echo.Context) error { + event, err := srv.eventRepo.FirstByAddressAndEventName( + c.Request().Context(), + c.QueryParam("address"), + eventindexer.EventNameBlockProposed, + ) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + var found bool = false + + if event != nil { + found = true + } + + return c.JSON(http.StatusOK, &galaxeAPIResponse{ + Data: galaxeData{ + IsOK: found, + }, + }) +} diff --git a/packages/eventindexer/http/user_proved_block.go b/packages/eventindexer/http/user_proved_block.go new file mode 100644 index 00000000000..0687eb85256 --- /dev/null +++ b/packages/eventindexer/http/user_proved_block.go @@ -0,0 +1,32 @@ +package http + +import ( + "net/http" + + "github.com/cyberhorsey/webutils" + "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" +) + +func (srv *Server) UserProvedBlock(c echo.Context) error { + event, err := srv.eventRepo.FirstByAddressAndEventName( + c.Request().Context(), + c.QueryParam("address"), + eventindexer.EventNameBlockProven, + ) + if err != nil { + return webutils.LogAndRenderErrors(c, http.StatusUnprocessableEntity, err) + } + + var found bool = false + + if event != nil { + found = true + } + + return c.JSON(http.StatusOK, &galaxeAPIResponse{ + Data: galaxeData{ + IsOK: found, + }, + }) +} diff --git a/packages/eventindexer/indexer/filter.go b/packages/eventindexer/indexer/filter.go new file mode 100644 index 00000000000..2d3b21141c5 --- /dev/null +++ b/packages/eventindexer/indexer/filter.go @@ -0,0 +1,86 @@ +package indexer + +import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/pkg/errors" +) + +type FilterFunc func( + ctx context.Context, + chainID *big.Int, + svc *Service, + filterOpts *bind.FilterOpts, +) error + +func L1FilterFunc( + ctx context.Context, + chainID *big.Int, + svc *Service, + filterOpts *bind.FilterOpts, +) error { + blockProvenEvents, err := svc.taikol1.FilterBlockProven(filterOpts, nil) + if err != nil { + return errors.Wrap(err, "svc.taikol1.FilterBlockProven") + } + + err = svc.saveBlockProvenEvents(ctx, chainID, blockProvenEvents) + if err != nil { + return errors.Wrap(err, "svc.saveBlockProvenEvents") + } + + blockProposedEvents, err := svc.taikol1.FilterBlockProposed(filterOpts, nil) + if err != nil { + return errors.Wrap(err, "svc.taikol1.FilterBlockProposed") + } + + err = svc.saveBlockProposedEvents(ctx, chainID, blockProposedEvents) + if err != nil { + return errors.Wrap(err, "svc.saveBlockProposedEvents") + } + + blockVerifiedEvents, err := svc.taikol1.FilterBlockVerified(filterOpts, nil) + if err != nil { + return errors.Wrap(err, "svc.taikol1.FilterBlockVerified") + } + + err = svc.saveBlockVerifiedEvents(ctx, chainID, blockVerifiedEvents) + if err != nil { + return errors.Wrap(err, "svc.saveBlockVerifiedEvents") + } + + messagesSent, err := svc.bridge.FilterMessageSent(filterOpts, nil) + if err != nil { + return errors.Wrap(err, "svc.bridge.FilterMessageSent") + } + + err = svc.saveMessageSentEvents(ctx, chainID, messagesSent) + if err != nil { + return errors.Wrap(err, "svc.saveMessageSentEvents") + } + + return nil +} + +func L2FilterFunc( + ctx context.Context, + chainID *big.Int, + svc *Service, + filterOpts *bind.FilterOpts, +) error { + swaps, err := svc.swap.FilterSwap(filterOpts, nil, nil) + if err != nil { + return errors.Wrap(err, "svc.bridge.FilterSwap") + } + + // only save ones above 0.01 ETH, this is only for Galaxe + // and we dont care about the rest + err = svc.saveSwapEvents(ctx, chainID, swaps) + if err != nil { + return errors.Wrap(err, "svc.saveSwapEvents") + } + + return nil +} diff --git a/packages/eventindexer/indexer/filter_then_subscribe.go b/packages/eventindexer/indexer/filter_then_subscribe.go index 4fd227e0e2f..1eb27b8b0e2 100644 --- a/packages/eventindexer/indexer/filter_then_subscribe.go +++ b/packages/eventindexer/indexer/filter_then_subscribe.go @@ -2,6 +2,7 @@ package indexer import ( "context" + "fmt" "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -14,6 +15,7 @@ func (svc *Service) FilterThenSubscribe( ctx context.Context, mode eventindexer.Mode, watchMode eventindexer.WatchMode, + filter FilterFunc, ) error { chainID, err := svc.ethClient.ChainID(ctx) if err != nil { @@ -53,40 +55,22 @@ func (svc *Service) FilterThenSubscribe( end = header.Number.Uint64() } + // filter exclusive of the end block. + // we use "end" as the next starting point of the batch, and + // process up to end - 1 for this batch. + filterEnd := end - 1 + + fmt.Printf("block batch from %v to %v", i, filterEnd) + fmt.Println() + filterOpts := &bind.FilterOpts{ Start: svc.processingBlockHeight, - End: &end, + End: &filterEnd, Context: ctx, } - blockProvenEvents, err := svc.taikol1.FilterBlockProven(filterOpts, nil) - if err != nil { - return errors.Wrap(err, "svc.taikol1.FilterBlockProven") - } - - err = svc.saveBlockProvenEvents(ctx, chainID, blockProvenEvents) - if err != nil { - return errors.Wrap(err, "svc.saveBlockProvenEvents") - } - - blockProposedEvents, err := svc.taikol1.FilterBlockProposed(filterOpts, nil) - if err != nil { - return errors.Wrap(err, "svc.taikol1.FilterBlockProposed") - } - - err = svc.saveBlockProposedEvents(ctx, chainID, blockProposedEvents) - if err != nil { - return errors.Wrap(err, "svc.saveBlockProposedEvents") - } - - blockVerifiedEvents, err := svc.taikol1.FilterBlockVerified(filterOpts, nil) - if err != nil { - return errors.Wrap(err, "svc.taikol1.FilterBlockVerified") - } - - err = svc.saveBlockVerifiedEvents(ctx, chainID, blockVerifiedEvents) - if err != nil { - return errors.Wrap(err, "svc.saveBlockVerifiedEvents") + if err := filter(ctx, chainID, svc, filterOpts); err != nil { + return errors.Wrap(err, "filter") } header, err := svc.ethClient.HeaderByNumber(ctx, big.NewInt(int64(end))) @@ -120,7 +104,7 @@ func (svc *Service) FilterThenSubscribe( } if svc.processingBlockHeight < latestBlock.Number.Uint64() { - return svc.FilterThenSubscribe(ctx, eventindexer.SyncMode, watchMode) + return svc.FilterThenSubscribe(ctx, eventindexer.SyncMode, watchMode, filter) } // we are caught up and specified not to subscribe, we can return now diff --git a/packages/eventindexer/indexer/save_block_proven_event.go b/packages/eventindexer/indexer/save_block_proven_event.go index 5e5b78d50ac..e3acee897bb 100644 --- a/packages/eventindexer/indexer/save_block_proven_event.go +++ b/packages/eventindexer/indexer/save_block_proven_event.go @@ -87,8 +87,10 @@ func (svc *Service) saveBlockProvenEvent( func (svc *Service) updateAverageProofTime(ctx context.Context, event *taikol1.TaikoL1BlockProven) error { block, err := svc.taikol1.GetBlock(nil, event.Id) + // will be unable to GetBlock for older blocks, just return nil, we dont + // care about averageProofTime that much to be honest for older blocks if err != nil { - return errors.Wrap(err, "svc.taikoL1.GetBlock") + return nil } eventBlock, err := svc.ethClient.BlockByHash(ctx, event.Raw.BlockHash) diff --git a/packages/eventindexer/indexer/save_message_sent_event.go b/packages/eventindexer/indexer/save_message_sent_event.go new file mode 100644 index 00000000000..a78ca969448 --- /dev/null +++ b/packages/eventindexer/indexer/save_message_sent_event.go @@ -0,0 +1,65 @@ +package indexer + +import ( + "context" + "encoding/json" + "math/big" + + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/bridge" +) + +func (svc *Service) saveMessageSentEvents( + ctx context.Context, + chainID *big.Int, + events *bridge.BridgeMessageSentIterator, +) error { + if !events.Next() || events.Event == nil { + log.Infof("no MessageSent events") + return nil + } + + for { + event := events.Event + + log.Infof("new messageSent event for owner: %v", event.Message.Owner.Hex()) + + if err := svc.saveMessageSentEvent(ctx, chainID, event); err != nil { + eventindexer.MessageSentEventsProcessedError.Inc() + + return errors.Wrap(err, "svc.saveMessageSentEvent") + } + + if !events.Next() { + return nil + } + } +} + +func (svc *Service) saveMessageSentEvent( + ctx context.Context, + chainID *big.Int, + event *bridge.BridgeMessageSent, +) error { + marshaled, err := json.Marshal(event) + if err != nil { + return errors.Wrap(err, "json.Marshal(event)") + } + + _, err = svc.eventRepo.Save(ctx, eventindexer.SaveEventOpts{ + Name: eventindexer.EventNameMessageSent, + Data: string(marshaled), + ChainID: chainID, + Event: eventindexer.EventNameMessageSent, + Address: event.Message.Owner.Hex(), + }) + if err != nil { + return errors.Wrap(err, "svc.eventRepo.Save") + } + + eventindexer.MessageSentEventsProcessed.Inc() + + return nil +} diff --git a/packages/eventindexer/indexer/save_swap_event.go b/packages/eventindexer/indexer/save_swap_event.go new file mode 100644 index 00000000000..297bd9a7652 --- /dev/null +++ b/packages/eventindexer/indexer/save_swap_event.go @@ -0,0 +1,65 @@ +package indexer + +import ( + "context" + "encoding/json" + "math/big" + + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" + "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/swap" +) + +func (svc *Service) saveSwapEvents( + ctx context.Context, + chainID *big.Int, + events *swap.SwapSwapIterator, +) error { + if !events.Next() || events.Event == nil { + log.Infof("no Swap events") + return nil + } + + for { + event := events.Event + + log.Infof("new Swap event for sender: %v", event.Sender.Hex()) + + if err := svc.saveSwapEvent(ctx, chainID, event); err != nil { + eventindexer.SwapEventsProcessedError.Inc() + + return errors.Wrap(err, "svc.saveSwapEvent") + } + + if !events.Next() { + return nil + } + } +} + +func (svc *Service) saveSwapEvent( + ctx context.Context, + chainID *big.Int, + event *swap.SwapSwap, +) error { + marshaled, err := json.Marshal(event) + if err != nil { + return errors.Wrap(err, "json.Marshal(event)") + } + + _, err = svc.eventRepo.Save(ctx, eventindexer.SaveEventOpts{ + Name: eventindexer.EventNameSwap, + Data: string(marshaled), + ChainID: chainID, + Event: eventindexer.EventNameSwap, + Address: event.Sender.Hex(), + }) + if err != nil { + return errors.Wrap(err, "svc.eventRepo.Save") + } + + eventindexer.SwapEventsProcessed.Inc() + + return nil +} diff --git a/packages/eventindexer/indexer/service.go b/packages/eventindexer/indexer/service.go index cbfdfd1197f..dd85ed6f605 100644 --- a/packages/eventindexer/indexer/service.go +++ b/packages/eventindexer/indexer/service.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/bridge" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/swap" "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/taikol1" ) @@ -27,6 +29,8 @@ type Service struct { subscriptionBackoff time.Duration taikol1 *taikol1.TaikoL1 + bridge *bridge.Bridge + swap *swap.Swap } type NewServiceOpts struct { @@ -36,6 +40,8 @@ type NewServiceOpts struct { EthClient *ethclient.Client RPCClient *rpc.Client SrcTaikoAddress common.Address + SrcBridgeAddress common.Address + SrcSwapAddress common.Address BlockBatchSize uint64 SubscriptionBackoff time.Duration } @@ -53,9 +59,33 @@ func NewService(opts NewServiceOpts) (*Service, error) { return nil, eventindexer.ErrNoRPCClient } - taikoL1, err := taikol1.NewTaikoL1(opts.SrcTaikoAddress, opts.EthClient) - if err != nil { - return nil, errors.Wrap(err, "contracts.NewTaikoL1") + var taikoL1 *taikol1.TaikoL1 + + var err error + + if opts.SrcTaikoAddress.Hex() != ZeroAddress.Hex() { + taikoL1, err = taikol1.NewTaikoL1(opts.SrcTaikoAddress, opts.EthClient) + if err != nil { + return nil, errors.Wrap(err, "contracts.NewTaikoL1") + } + } + + var bridgeContract *bridge.Bridge + + if opts.SrcBridgeAddress.Hex() != ZeroAddress.Hex() { + bridgeContract, err = bridge.NewBridge(opts.SrcBridgeAddress, opts.EthClient) + if err != nil { + return nil, errors.Wrap(err, "contracts.NewBridge") + } + } + + var swapContract *swap.Swap + + if opts.SrcSwapAddress.Hex() != ZeroAddress.Hex() { + swapContract, err = swap.NewSwap(opts.SrcSwapAddress, opts.EthClient) + if err != nil { + return nil, errors.Wrap(err, "contracts.NewBridge") + } } return &Service{ @@ -64,6 +94,8 @@ func NewService(opts NewServiceOpts) (*Service, error) { statRepo: opts.StatRepo, ethClient: opts.EthClient, taikol1: taikoL1, + bridge: bridgeContract, + swap: swapContract, blockBatchSize: opts.BlockBatchSize, subscriptionBackoff: opts.SubscriptionBackoff, diff --git a/packages/eventindexer/indexer/set_initial_processing_block_height.go b/packages/eventindexer/indexer/set_initial_processing_block_height.go index 9a8fda94513..c44e5ec73e1 100644 --- a/packages/eventindexer/indexer/set_initial_processing_block_height.go +++ b/packages/eventindexer/indexer/set_initial_processing_block_height.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/pkg/errors" + log "github.com/sirupsen/logrus" "github.com/taikoxyz/taiko-mono/packages/eventindexer" ) @@ -13,12 +14,16 @@ func (svc *Service) setInitialProcessingBlockByMode( mode eventindexer.Mode, chainID *big.Int, ) error { - stateVars, err := svc.taikol1.GetStateVariables(nil) - if err != nil { - return errors.Wrap(err, "svc.taikoL1.GetStateVariables") - } + var startingBlock uint64 = 0 + // only check stateVars on L1, otherwise sync from 0 + if svc.taikol1 != nil { + stateVars, err := svc.taikol1.GetStateVariables(nil) + if err != nil { + return errors.Wrap(err, "svc.taikoL1.GetStateVariables") + } - startingBlock := stateVars.GenesisHeight + startingBlock = stateVars.GenesisHeight + } switch mode { case eventindexer.SyncMode: @@ -33,6 +38,8 @@ func (svc *Service) setInitialProcessingBlockByMode( startingBlock = latestProcessedBlock.Height } + log.Infof("starting block: %v", startingBlock) + svc.processingBlockHeight = startingBlock return nil diff --git a/packages/eventindexer/indexer/subscribe.go b/packages/eventindexer/indexer/subscribe.go index 2d3a109c0bc..23dd4fb9042 100644 --- a/packages/eventindexer/indexer/subscribe.go +++ b/packages/eventindexer/indexer/subscribe.go @@ -9,6 +9,8 @@ import ( "github.com/pkg/errors" log "github.com/sirupsen/logrus" "github.com/taikoxyz/taiko-mono/packages/eventindexer" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/bridge" + "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/swap" "github.com/taikoxyz/taiko-mono/packages/eventindexer/contracts/taikol1" ) @@ -18,9 +20,19 @@ func (svc *Service) subscribe(ctx context.Context, chainID *big.Int) error { errChan := make(chan error) - go svc.subscribeBlockProven(ctx, chainID, errChan) - go svc.subscribeBlockProposed(ctx, chainID, errChan) - go svc.subscribeBlockVerified(ctx, chainID, errChan) + if svc.taikol1 != nil { + go svc.subscribeBlockProven(ctx, chainID, errChan) + go svc.subscribeBlockProposed(ctx, chainID, errChan) + go svc.subscribeBlockVerified(ctx, chainID, errChan) + } + + if svc.bridge != nil { + go svc.subscribeMessageSent(ctx, chainID, errChan) + } + + if svc.swap != nil { + go svc.subscribeSwap(ctx, chainID, errChan) + } // nolint: gosimple for { @@ -233,3 +245,123 @@ func (svc *Service) subscribeBlockVerified(ctx context.Context, chainID *big.Int } } } + +func (svc *Service) subscribeMessageSent(ctx context.Context, chainID *big.Int, errChan chan error) { + sink := make(chan *bridge.BridgeMessageSent) + + sub := event.ResubscribeErr(svc.subscriptionBackoff, func(ctx context.Context, err error) (event.Subscription, error) { + if err != nil { + log.Errorf("svc.taikoL1.WatchMessageSent: %v", err) + } + log.Info("resubscribing to MessageSent events") + + return svc.bridge.WatchMessageSent(&bind.WatchOpts{ + Context: ctx, + }, sink, nil) + }) + + defer sub.Unsubscribe() + + for { + select { + case <-ctx.Done(): + log.Info("context finished") + return + case err := <-sub.Err(): + log.Errorf("sub.Err(): %v", err) + errChan <- errors.Wrap(err, "sub.Err()") + case event := <-sink: + go func() { + log.Infof("messageSentEvent for owner: %v", event.Message.Owner.Hex()) + + if err := svc.saveMessageSentEvent(ctx, chainID, event); err != nil { + eventindexer.MessageSentEventsProcessedError.Inc() + + log.Errorf("svc.subscribe, svc.saveMessageSentEvent: %v", err) + + return + } + + block, err := svc.blockRepo.GetLatestBlockProcessed(chainID) + if err != nil { + log.Errorf("svc.subscribe, blockRepo.GetLatestBlockProcessed: %v", err) + return + } + + if block.Height < event.Raw.BlockNumber { + err = svc.blockRepo.Save(eventindexer.SaveBlockOpts{ + Height: event.Raw.BlockNumber, + Hash: event.Raw.BlockHash, + ChainID: chainID, + }) + if err != nil { + log.Errorf("svc.subscribe, svc.blockRepo.Save: %v", err) + return + } + + eventindexer.BlocksProcessed.Inc() + } + }() + } + } +} + +func (svc *Service) subscribeSwap(ctx context.Context, chainID *big.Int, errChan chan error) { + sink := make(chan *swap.SwapSwap) + + sub := event.ResubscribeErr(svc.subscriptionBackoff, func(ctx context.Context, err error) (event.Subscription, error) { + if err != nil { + log.Errorf("svc.swap.WatchSwap: %v", err) + } + log.Info("resubscribing to Swap events") + + return svc.swap.WatchSwap(&bind.WatchOpts{ + Context: ctx, + }, sink, nil, nil) + }) + + defer sub.Unsubscribe() + + for { + select { + case <-ctx.Done(): + log.Info("context finished") + return + case err := <-sub.Err(): + log.Errorf("sub.Err(): %v", err) + errChan <- errors.Wrap(err, "sub.Err()") + case event := <-sink: + go func() { + log.Infof("swap event for sender %v", event.Sender.Hex()) + + if err := svc.saveSwapEvent(ctx, chainID, event); err != nil { + eventindexer.SwapEventsProcessedError.Inc() + + log.Errorf("svc.subscribe, svc.saveSwapEvent: %v", err) + + return + } + + block, err := svc.blockRepo.GetLatestBlockProcessed(chainID) + if err != nil { + log.Errorf("svc.subscribe, blockRepo.GetLatestBlockProcessed: %v", err) + return + } + + if block.Height < event.Raw.BlockNumber { + err = svc.blockRepo.Save(eventindexer.SaveBlockOpts{ + Height: event.Raw.BlockNumber, + Hash: event.Raw.BlockHash, + ChainID: chainID, + }) + if err != nil { + log.Errorf("svc.subscribe, svc.blockRepo.Save: %v", err) + return + } + + eventindexer.BlocksProcessed.Inc() + } + }() + } + } +} diff --git a/packages/eventindexer/migrations/1666650599_create_events_table.sql b/packages/eventindexer/migrations/1666650599_create_events_table.sql index 99af8917801..d616c5c8216 100644 --- a/packages/eventindexer/migrations/1666650599_create_events_table.sql +++ b/packages/eventindexer/migrations/1666650599_create_events_table.sql @@ -2,11 +2,11 @@ -- +goose StatementBegin CREATE TABLE IF NOT EXISTS events ( id int NOT NULL PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - event VARCHAR(255) NOT NULL DEFAULT "", + name VARCHAR(15) NOT NULL, + event VARCHAR(15) NOT NULL DEFAULT "", chain_id int NOT NULL, data JSON NOT NULL, - address VARCHAR(255) NOT NULL DEFAULT "", + address VARCHAR(42) NOT NULL DEFAULT "", block_id int DEFAULT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP , updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP diff --git a/packages/eventindexer/mock/event_repository.go b/packages/eventindexer/mock/event_repository.go index 9b5e3882130..545c8bcdd6c 100644 --- a/packages/eventindexer/mock/event_repository.go +++ b/packages/eventindexer/mock/event_repository.go @@ -105,3 +105,17 @@ func (r *EventRepository) Delete( return nil } + +func (r *EventRepository) FirstByAddressAndEventName( + ctx context.Context, + address string, + event string, +) (*eventindexer.Event, error) { + for _, e := range r.events { + if e.Address == address && e.Event == event { + return e, nil + } + } + + return nil, nil +} diff --git a/packages/eventindexer/prometheus.go b/packages/eventindexer/prometheus.go index f5b7fc7bf35..cab3ef87bb1 100644 --- a/packages/eventindexer/prometheus.go +++ b/packages/eventindexer/prometheus.go @@ -30,6 +30,22 @@ var ( Name: "block_verified_events_processed_error_ops_total", Help: "The total number of processed BlockVerified event errors encountered", }) + MessageSentEventsProcessed = promauto.NewCounter(prometheus.CounterOpts{ + Name: "message_sent_events_processed_ops_total", + Help: "The total number of processed MessageSent events", + }) + MessageSentEventsProcessedError = promauto.NewCounter(prometheus.CounterOpts{ + Name: "message_sent_events_processed_error_ops_total", + Help: "The total number of processed MessageSent event errors encountered", + }) + SwapEventsProcessed = promauto.NewCounter(prometheus.CounterOpts{ + Name: "swap_events_processed_ops_total", + Help: "The total number of processed MessageSent events", + }) + SwapEventsProcessedError = promauto.NewCounter(prometheus.CounterOpts{ + Name: "swap_events_processed_error_ops_total", + Help: "The total number of processed Swap event errors encountered", + }) BlocksProcessed = promauto.NewCounter(prometheus.CounterOpts{ Name: "blocks_processed_ops_total", Help: "The total number of processed blocks", diff --git a/packages/eventindexer/repo/event.go b/packages/eventindexer/repo/event.go index da647870fbe..4c8885c5923 100644 --- a/packages/eventindexer/repo/event.go +++ b/packages/eventindexer/repo/event.go @@ -134,3 +134,24 @@ func (r *EventRepository) GetByAddressAndEventName( return page, nil } + +func (r *EventRepository) FirstByAddressAndEventName( + ctx context.Context, + address string, + event string, +) (*eventindexer.Event, error) { + e := &eventindexer.Event{} + + if err := r.db.GormDB(). + Where("address = ?", address). + Where("event = ?", event). + First(e).Error; err != nil { + if err == gorm.ErrRecordNotFound { + return nil, nil + } + + return nil, err + } + + return e, nil +} diff --git a/packages/eventindexer/repo/event_test.go b/packages/eventindexer/repo/event_test.go index 62b69010a94..adc8d3d2922 100644 --- a/packages/eventindexer/repo/event_test.go +++ b/packages/eventindexer/repo/event_test.go @@ -257,3 +257,54 @@ func TestIntegration_Event_Delete(t *testing.T) { }) } } + +func TestIntegration_Event_FirstByAddressAndEvent(t *testing.T) { + db, close, err := testMysql(t) + assert.Equal(t, nil, err) + + defer close() + + eventRepo, err := NewEventRepository(db) + assert.Equal(t, nil, err) + + event, err := eventRepo.Save(context.Background(), dummyProveEventOpts) + + assert.Equal(t, nil, err) + + tests := []struct { + name string + address string + event string + wantErr error + wantEventID int + }{ + { + "success", + dummyProveEventOpts.Address, + dummyProveEventOpts.Name, + nil, + event.ID, + }, + { + "notFound", + dummyProveEventOpts.Address, + "fakeEvent", + nil, + 0, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + found, err := eventRepo.FirstByAddressAndEventName( + context.Background(), + tt.address, + tt.event, + ) + assert.Equal(t, tt.wantErr, err) + if tt.wantEventID != 0 { + assert.Equal(t, tt.wantEventID, found.ID) + } + }) + } +} diff --git a/packages/status-page/src/utils/getStateVariables.ts b/packages/status-page/src/utils/getStateVariables.ts index e2d60cc4e09..7e45b30db1c 100644 --- a/packages/status-page/src/utils/getStateVariables.ts +++ b/packages/status-page/src/utils/getStateVariables.ts @@ -25,6 +25,7 @@ export const getStateVariables = async ( const contract: Contract = new Contract(contractAddress, TaikoL1, provider); const vars = await contract.getStateVariables(); + stateVarsCache = { stateVars: vars, cachedAt: Date.now(),