From c4864dae85829a48588721cc64558282043b31fd Mon Sep 17 00:00:00 2001 From: Stefan Iliev <46542846+StefanIliev545@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:35:33 +0300 Subject: [PATCH] Gas mechanics phase 1 implementation. (#1471) * Added a new message topic for auto relaying. * WIP. * some stuff. * Working deposits and transfers tree. * Adding missing files. * Progress dump. * removed TransferTree. * Removed transfer tree from proto. * Revert "Removed transfer tree from proto." This reverts commit c85dba12062f44ea9187d2cfec204954c9dd22c4. * Revert "removed TransferTree." This reverts commit ecc84bf1a5d0908faea27a4fde7cb534b9747420. * Adding back removed line. * Working state. Gas not payed due to creator differences. * Working version. * Testing for gas mechanics in the sim tests. * Fix for tests. * Fixed linter issues. * Ran gofumpt. * Fixed more linter issues. * Linter fix. * Fixed in mem test. * Fixed race condition for gas price oracle. * Fix crash. * Changes to when no base fee is applied. * Update for chain validation. * Fix for build.' * Added gas price estimation return. * Seemingly fully working version. * Fixed compilation bug. * Ran gofumpt. * Fix linter issue.' * Resolved PR comments. * Ran gofumpt. * Added gas limit config. * Generate abi bindings. * Version that deploys. * Working version with baseFee == 1 * Adding forgotten file. * Fix for toml test. * Fixed immediate batch block bug. * Added testing contract. * Added default address for gas payments. * Fixes for PR review. * Ran gofumpt. * Stopped test that shouldn't run in GH. * Modified gas limit. * Linter fixes. * Gofumpt. --------- Co-authored-by: StefanIliev545 Co-authored-by: StefanIliev545 --- contracts/config/networks.json | 13 +- .../001_deploy_cross_chain_messenger.ts | 3 +- .../001_deploy_cross_chain_messenger.ts | 4 +- .../testing/001_gas_testing_deployment.ts | 28 +++ .../testnet/layer2/001_whitelist_tokens.ts | 18 +- .../CrossChainMessenger.go | 2 +- .../EthereumBridge/EthereumBridge.go | 2 +- .../ManagementContract/ManagementContract.go | 2 +- contracts/generated/MessageBus/MessageBus.go | 182 +++++++++++++++++- contracts/generated/ObsERC20/ObsERC20.go | 2 +- .../generated/ObscuroBridge/ObscuroBridge.go | 2 +- .../generated/WrappedERC20/WrappedERC20.go | 2 +- contracts/src/bridge/IBridge.sol | 8 +- contracts/src/bridge/L1/ObscuroBridge.sol | 22 +-- contracts/src/messaging/IMessageBus.sol | 17 ++ contracts/src/messaging/MessageBus.sol | 16 ++ .../messenger/CrossChainEnabledObscuro.sol | 4 + contracts/src/testing/GasConsumerBalance.sol | 18 ++ contracts/tasks/wallet-extension.ts | 6 +- go/common/gethencoding/geth_encoding.go | 12 +- go/common/headers.go | 32 +-- go/common/rpc/converters.go | 6 +- go/common/rpc/generated/enclave.pb.go | 28 ++- go/common/rpc/generated/enclave.proto | 2 + go/common/rpc/generated/enclave_grpc.pb.go | 162 ++++++++++------ go/common/types.go | 11 +- go/config/enclave_config.go | 8 + go/enclave/components/batch_executor.go | 129 +++++++++++-- go/enclave/components/block_processor.go | 13 +- go/enclave/components/interfaces.go | 3 +- go/enclave/components/rollup_compression.go | 56 ++++-- go/enclave/container/cli.go | 9 + go/enclave/core/batch.go | 7 +- .../crosschain/block_message_extractor.go | 73 +++++-- go/enclave/crosschain/common.go | 29 ++- go/enclave/crosschain/interfaces.go | 8 +- go/enclave/crosschain/message_bus_manager.go | 35 +++- go/enclave/crosschain/processors.go | 2 +- go/enclave/enclave.go | 19 +- go/enclave/enclave_test.go | 2 +- go/enclave/evm/evm_facade.go | 14 +- go/enclave/gas/README.md | 2 + go/enclave/gas/gas.go | 42 ++++ go/enclave/gas/oracle.go | 51 +++++ go/enclave/genesis/testnet_genesis.go | 2 + go/enclave/l2chain/l2_chain.go | 30 ++- go/enclave/nodetype/sequencer.go | 18 +- go/enclave/nodetype/validator.go | 8 +- go/enclave/storage/enclavedb/block.go | 17 +- go/enclave/storage/init/sqlite/001_init.sql | 3 +- go/enclave/storage/interfaces.go | 3 + go/enclave/storage/storage.go | 12 +- go/host/rpc/clientapi/client_api_eth.go | 12 +- go/node/config.go | 11 ++ go/wallet/wallet.go | 5 + .../networktest/userwallet/userwallet.go | 4 + integration/simulation/devnetwork/node.go | 5 + .../simulation/network/network_utils.go | 2 + .../simulation/network/obscuro_node_utils.go | 6 +- integration/simulation/network/socket.go | 1 + integration/simulation/output_stats.go | 4 +- integration/simulation/params/wallet_utils.go | 30 +-- integration/simulation/simulation.go | 1 + integration/simulation/simulation_tester.go | 1 + .../simulation/transaction_injector.go | 59 ++++++ .../transaction_injector_tracker.go | 19 ++ integration/simulation/utils.go | 3 + integration/simulation/validate_chain.go | 72 ++++++- 68 files changed, 1199 insertions(+), 235 deletions(-) create mode 100644 contracts/deployment_scripts/testing/001_gas_testing_deployment.ts create mode 100644 contracts/src/testing/GasConsumerBalance.sol create mode 100644 go/enclave/gas/README.md create mode 100644 go/enclave/gas/gas.go create mode 100644 go/enclave/gas/oracle.go diff --git a/contracts/config/networks.json b/contracts/config/networks.json index b36c0713ec..9a46bc367d 100644 --- a/contracts/config/networks.json +++ b/contracts/config/networks.json @@ -1,6 +1,6 @@ { "localGeth": { - "url": "http://127.0.0.1:8025", + "url": "http://127.0.0.1:37000", "deploy": [ "deployment_scripts/core/layer1/", "deployment_scripts/testnet/layer1/", @@ -13,15 +13,16 @@ }, "localObscuro": { "chainId": 777, - "url": "http://127.0.0.1:3000/v1", - "obscuroEncRpcUrl": "ws://127.0.0.1:81", - "gasPrice": 2000000000, + "url": "http://127.0.0.1:3000/v1/", + "obscuroEncRpcUrl": "ws://127.0.0.1:37901", "companionNetworks" : { "layer1" : "localGeth" }, "deploy": [ - "deployment_scripts/core/layer2/", - "deployment_scripts/bridge/layer2/", + "deployment_scripts/messenger/layer1", + "deployment_scripts/messenger/layer2", + "deployment_scripts/bridge/", + "deployment_scripts/testnet/layer1/", "deployment_scripts/testnet/layer2/" ], "accounts": [ diff --git a/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts b/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts index 2fe8715f19..007df8b18a 100644 --- a/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts +++ b/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts @@ -14,7 +14,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { deployer } = await hre.companionNetworks.layer1.getNamedAccounts(); // Read the message bus address from the management contract deployment. - const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS!! + const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS || "0xa1fdA5f6Df55a326f5f4300F3A716317f0f03110" + console.log(`Message Bus address ${messageBusAddress}`); // Setup the cross chain messenger and point it to the message bus from the management contract to be used for validation await deployments.deploy('CrossChainMessenger', { diff --git a/contracts/deployment_scripts/messenger/layer2/001_deploy_cross_chain_messenger.ts b/contracts/deployment_scripts/messenger/layer2/001_deploy_cross_chain_messenger.ts index d81fa9ca84..864dfaebd1 100644 --- a/contracts/deployment_scripts/messenger/layer2/001_deploy_cross_chain_messenger.ts +++ b/contracts/deployment_scripts/messenger/layer2/001_deploy_cross_chain_messenger.ts @@ -17,6 +17,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Get the prefunded L2 deployer account to use for deploying. const {deployer} = await getNamedAccounts(); + console.log(`Deployer acc ${deployer}`); + // TODO: Remove hardcoded L2 message bus address when properly exposed. const busAddress = hre.ethers.utils.getAddress("0x526c84529b2b8c11f57d93d3f5537aca3aecef9b") @@ -24,7 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Deploy the L2 Cross chain messenger and use the L2 bus for validation await deployments.deploy('CrossChainMessenger', { - from: deployer, + from: deployer, args: [ busAddress ], log: true, }); diff --git a/contracts/deployment_scripts/testing/001_gas_testing_deployment.ts b/contracts/deployment_scripts/testing/001_gas_testing_deployment.ts new file mode 100644 index 0000000000..d577d4b145 --- /dev/null +++ b/contracts/deployment_scripts/testing/001_gas_testing_deployment.ts @@ -0,0 +1,28 @@ +import {HardhatRuntimeEnvironment} from 'hardhat/types'; +import {DeployFunction} from 'hardhat-deploy/types'; +import { Receipt } from 'hardhat-deploy/dist/types'; + + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const l2Network = hre; + const {deployer} = await hre.getNamedAccounts(); + + const gcb = await l2Network.deployments.deploy("GasConsumerBalance", { + from: deployer, + log: true + }) + + + const gasConsumerBalance = await hre.ethers.getContractAt("GasConsumerBalance", gcb.address) + const gasEstimation = await gasConsumerBalance.estimateGas.get_balance({from: deployer}); + + await hre.deployments.execute("GasConsumerBalance", { + from: deployer, + gasLimit: gasEstimation.div(2), + log: true + }, "get_balance"); +}; + + +export default func; +func.tags = ['GasDebug']; diff --git a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts index b436fca919..d4e106d847 100644 --- a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts +++ b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts @@ -90,14 +90,26 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { let messages = getXChainMessages(hocResult); messages = messages.concat(getXChainMessages(pocResult)); + console.log("Attempting to verify cross chain message transfer."); + // Poll message submission await new Promise(async (resolve, fail)=> { setTimeout(fail, 30_000) const messageBusContract = (await hre.ethers.getContractAt('MessageBus', '0x526c84529b2b8c11f57d93d3f5537aca3aecef9b')); - while (await messageBusContract.callStatic.verifyMessageFinalized(messages[1]) != true) { - console.log(`Messages not stored on L2 yet, retrying...`); - await sleep(1_000); + try { + while (await messageBusContract.callStatic.verifyMessageFinalized(messages[1], { + maxFeePerGas: 2, + }) != true) { + console.log(`Messages not stored on L2 yet, retrying...`); + await sleep(1_000); + } + }catch (err) { + console.log(err) + fail(err) } + + + resolve(true); }); diff --git a/contracts/generated/CrossChainMessenger/CrossChainMessenger.go b/contracts/generated/CrossChainMessenger/CrossChainMessenger.go index eff438fe82..0af3876ecd 100644 --- a/contracts/generated/CrossChainMessenger/CrossChainMessenger.go +++ b/contracts/generated/CrossChainMessenger/CrossChainMessenger.go @@ -42,7 +42,7 @@ type StructsCrossChainMessage struct { // CrossChainMessengerMetaData contains all meta data concerning the CrossChainMessenger contract. var CrossChainMessengerMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"messageBusAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"error\",\"type\":\"bytes\"}],\"name\":\"CallFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"crossChainSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"encodeCall\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageBus\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6080604052600180546001600160a01b031916905534801561002057600080fd5b506040516109ad3803806109ad83398101604081905261003f91610064565b600080546001600160a01b0319166001600160a01b0392909216919091179055610094565b60006020828403121561007657600080fd5b81516001600160a01b038116811461008d57600080fd5b9392505050565b61090a806100a36000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635b76f28b1461005157806363012de51461007a5780639b7cf1ee146100a5578063a1a227fa146100ba575b600080fd5b61006461005f366004610425565b6100cb565b6040516100719190610504565b60405180910390f35b60015461008d906001600160a01b031681565b6040516001600160a01b039091168152602001610071565b6100b86100b336600461051e565b61014b565b005b6000546001600160a01b031661008d565b60606040518060600160405280856001600160a01b0316815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602091820152604051610133929101610559565b60405160208183030381529060405290509392505050565b6101548161027d565b610161602082018261059e565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055600061019d60808301836105b9565b8101906101aa9190610690565b905060008082600001516001600160a01b03165a84602001516040516101d09190610764565b60006040518083038160008787f1925050503d806000811461020e576040519150601f19603f3d011682016040523d82523d6000602084013e610213565b606091505b50915091508161025a57806040517fa5fa8d2b0000000000000000000000000000000000000000000000000000000081526004016102519190610504565b60405180910390fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff191690555050565b6000546040517f33a88c720000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906333a88c72906102c69084906004016107ce565b60206040518083038186803b1580156102de57600080fd5b505afa1580156102f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031691906108b2565b6103625760405162461bcd60e51b815260206004820152601f60248201527f4d657373616765206e6f7420666f756e64206f722066696e616c697a65642e006044820152606401610251565b60008160405160200161037591906107ce565b60408051601f1981840301815291815281516020928301206000818152600290935291205490915060ff16156103ed5760405162461bcd60e51b815260206004820152601960248201527f4d65737361676520616c726561647920636f6e73756d65642e000000000000006044820152606401610251565b6000908152600260205260409020805460ff1916600117905550565b80356001600160a01b038116811461042057600080fd5b919050565b60008060006040848603121561043a57600080fd5b61044384610409565b9250602084013567ffffffffffffffff8082111561046057600080fd5b818601915086601f83011261047457600080fd5b81358181111561048357600080fd5b87602082850101111561049557600080fd5b6020830194508093505050509250925092565b60005b838110156104c35781810151838201526020016104ab565b838111156104d2576000848401525b50505050565b600081518084526104f08160208601602086016104a8565b601f01601f19169290920160200192915050565b60208152600061051760208301846104d8565b9392505050565b60006020828403121561053057600080fd5b813567ffffffffffffffff81111561054757600080fd5b820160c0818503121561051757600080fd5b602081526001600160a01b038251166020820152600060208301516060604084015261058860808401826104d8565b9050604084015160608401528091505092915050565b6000602082840312156105b057600080fd5b61051782610409565b6000808335601e198436030181126105d057600080fd5b83018035915067ffffffffffffffff8211156105eb57600080fd5b60200191503681900382131561060057600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561065957610659610607565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561068857610688610607565b604052919050565b600060208083850312156106a357600080fd5b823567ffffffffffffffff808211156106bb57600080fd5b90840190606082870312156106cf57600080fd5b6106d7610636565b6106e083610409565b815283830135828111156106f357600080fd5b8301601f8101881361070457600080fd5b80358381111561071657610716610607565b610728601f8201601f1916870161065f565b9350808452888682840101111561073e57600080fd5b808683018786013760009084018601525092830152604090810135908201529392505050565b600082516107768184602087016104a8565b9190910192915050565b803563ffffffff8116811461042057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461042057600080fd5b602081526001600160a01b036107e383610409565b1660208201526000602083013567ffffffffffffffff80821680831461080857600080fd5b8060408601525061081b60408601610780565b915063ffffffff80831660608601528061083760608801610780565b1660808601525060808501359150601e1985360301821261085757600080fd5b9084019081358181111561086a57600080fd5b80360386131561087957600080fd5b60c060a086015261089160e086018260208601610794565b925050506108a160a085016107bd565b60ff811660c0850152509392505050565b6000602082840312156108c457600080fd5b8151801515811461051757600080fdfea264697066735822122071fa1493675e54327867ea735dcb5aade210e1ddfbd9c82187a8baab562a574064736f6c63430008090033", + Bin: "0x6080604052600180546001600160a01b031916905534801561002057600080fd5b506040516109ad3803806109ad83398101604081905261003f91610064565b600080546001600160a01b0319166001600160a01b0392909216919091179055610094565b60006020828403121561007657600080fd5b81516001600160a01b038116811461008d57600080fd5b9392505050565b61090a806100a36000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635b76f28b1461005157806363012de51461007a5780639b7cf1ee146100a5578063a1a227fa146100ba575b600080fd5b61006461005f366004610425565b6100cb565b6040516100719190610504565b60405180910390f35b60015461008d906001600160a01b031681565b6040516001600160a01b039091168152602001610071565b6100b86100b336600461051e565b61014b565b005b6000546001600160a01b031661008d565b60606040518060600160405280856001600160a01b0316815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602091820152604051610133929101610559565b60405160208183030381529060405290509392505050565b6101548161027d565b610161602082018261059e565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055600061019d60808301836105b9565b8101906101aa9190610690565b905060008082600001516001600160a01b03165a84602001516040516101d09190610764565b60006040518083038160008787f1925050503d806000811461020e576040519150601f19603f3d011682016040523d82523d6000602084013e610213565b606091505b50915091508161025a57806040517fa5fa8d2b0000000000000000000000000000000000000000000000000000000081526004016102519190610504565b60405180910390fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff191690555050565b6000546040517f33a88c720000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906333a88c72906102c69084906004016107ce565b60206040518083038186803b1580156102de57600080fd5b505afa1580156102f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031691906108b2565b6103625760405162461bcd60e51b815260206004820152601f60248201527f4d657373616765206e6f7420666f756e64206f722066696e616c697a65642e006044820152606401610251565b60008160405160200161037591906107ce565b60408051601f1981840301815291815281516020928301206000818152600290935291205490915060ff16156103ed5760405162461bcd60e51b815260206004820152601960248201527f4d65737361676520616c726561647920636f6e73756d65642e000000000000006044820152606401610251565b6000908152600260205260409020805460ff1916600117905550565b80356001600160a01b038116811461042057600080fd5b919050565b60008060006040848603121561043a57600080fd5b61044384610409565b9250602084013567ffffffffffffffff8082111561046057600080fd5b818601915086601f83011261047457600080fd5b81358181111561048357600080fd5b87602082850101111561049557600080fd5b6020830194508093505050509250925092565b60005b838110156104c35781810151838201526020016104ab565b838111156104d2576000848401525b50505050565b600081518084526104f08160208601602086016104a8565b601f01601f19169290920160200192915050565b60208152600061051760208301846104d8565b9392505050565b60006020828403121561053057600080fd5b813567ffffffffffffffff81111561054757600080fd5b820160c0818503121561051757600080fd5b602081526001600160a01b038251166020820152600060208301516060604084015261058860808401826104d8565b9050604084015160608401528091505092915050565b6000602082840312156105b057600080fd5b61051782610409565b6000808335601e198436030181126105d057600080fd5b83018035915067ffffffffffffffff8211156105eb57600080fd5b60200191503681900382131561060057600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516060810167ffffffffffffffff8111828210171561065957610659610607565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561068857610688610607565b604052919050565b600060208083850312156106a357600080fd5b823567ffffffffffffffff808211156106bb57600080fd5b90840190606082870312156106cf57600080fd5b6106d7610636565b6106e083610409565b815283830135828111156106f357600080fd5b8301601f8101881361070457600080fd5b80358381111561071657610716610607565b610728601f8201601f1916870161065f565b9350808452888682840101111561073e57600080fd5b808683018786013760009084018601525092830152604090810135908201529392505050565b600082516107768184602087016104a8565b9190910192915050565b803563ffffffff8116811461042057600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461042057600080fd5b602081526001600160a01b036107e383610409565b1660208201526000602083013567ffffffffffffffff80821680831461080857600080fd5b8060408601525061081b60408601610780565b915063ffffffff80831660608601528061083760608801610780565b1660808601525060808501359150601e1985360301821261085757600080fd5b9084019081358181111561086a57600080fd5b80360386131561087957600080fd5b60c060a086015261089160e086018260208601610794565b925050506108a160a085016107bd565b60ff811660c0850152509392505050565b6000602082840312156108c457600080fd5b8151801515811461051757600080fdfea26469706673582212200acc607690386a002676eb2cb59eb38fb8dded8b683c5c2b9237a9f2c7ae948b64736f6c63430008090033", } // CrossChainMessengerABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/EthereumBridge/EthereumBridge.go b/contracts/generated/EthereumBridge/EthereumBridge.go index 6b03fe7aa5..1ba1afaa04 100644 --- a/contracts/generated/EthereumBridge/EthereumBridge.go +++ b/contracts/generated/EthereumBridge/EthereumBridge.go @@ -32,7 +32,7 @@ var ( // EthereumBridgeMetaData contains all meta data concerning the EthereumBridge contract. var EthereumBridgeMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"messenger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"remoteBridge\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"remoteAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"localAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"name\":\"CreatedWrappedToken\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wrappedToken\",\"type\":\"address\"}],\"name\":\"hasTokenMapping\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"localToRemoteToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"crossChainAddress\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"name\":\"onCreateTokenCommand\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"receiveAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"remoteToLocalToken\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"sendERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"sendNative\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"wrappedTokens\",\"outputs\":[{\"internalType\":\"contractWrappedERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x60806040526001805463ffffffff60a01b191690553480156200002157600080fd5b5060405162002b7f38038062002b7f83398101604081905262000044916200012c565b600080546001600160a01b0319166001600160a01b038416908117909155604080516350d113fd60e11b8152905184929163a1a227fa916004808301926020929190829003018186803b1580156200009b57600080fd5b505afa158015620000b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d6919062000164565b600180546001600160a01b039283166001600160a01b031991821617909155600580549490921693169290921790915550620001899050565b80516001600160a01b03811681146200012757600080fd5b919050565b600080604083850312156200014057600080fd5b6200014b836200010f565b91506200015b602084016200010f565b90509250929050565b6000602082840312156200017757600080fd5b62000182826200010f565b9392505050565b6129e680620001996000396000f3fe6080604052600436106200008a5760003560e01c80639813c7b211620000555780639813c7b214620002065780639e405b711462000256578063a381c8e21462000290578063d5c6b50414620002b55762000103565b80628d48e3146200014c5780631888d71214620001a3578063458ffd6314620001bc57806383bece4d14620001e15762000103565b36620001035760405162461bcd60e51b815260206004820152602360248201527f436f6e747261637420646f6573206e6f7420737570706f72742072656365697660448201527f652829000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152601d60248201527f66616c6c6261636b2829206d6574686f6420756e737570706f727465640000006044820152606401620000fa565b3480156200015957600080fd5b50620001866200016b36600462000c75565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b620001ba620001b436600462000c75565b620002ef565b005b348015620001c957600080fd5b50620001ba620001db36600462000ce8565b620004a0565b348015620001ee57600080fd5b50620001ba6200020036600462000d74565b620006be565b3480156200021357600080fd5b50620002456200022536600462000c75565b6001600160a01b0390811660009081526002602052604090205416151590565b60405190151581526020016200019a565b3480156200026357600080fd5b50620001866200027536600462000c75565b6003602052600090815260409020546001600160a01b031681565b3480156200029d57600080fd5b50620001ba620002af36600462000d74565b62000901565b348015620002c257600080fd5b5062000186620002d436600462000c75565b6002602052600090815260409020546001600160a01b031681565b60003411620003415760405162461bcd60e51b815260206004820152600d60248201527f4e6f7468696e672073656e742e000000000000000000000000000000000000006044820152606401620000fa565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b546001600160a01b0316620003c35760405162461bcd60e51b815260206004820152601560248201527f4e6f206d617070696e6720666f7220746f6b656e2e00000000000000000000006044820152606401620000fa565b600080805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff546040516001600160a01b03918216602482015234604482015290831660648201526383bece4d60e01b9060840160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526005549091506200049c906001600160a01b03168260005b60008062000a90565b5050565b6005546000546001600160a01b0391821691163314620005295760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e67657221000000000000000000000000000000006064820152608401620000fa565b806001600160a01b03166200053d62000bbe565b6001600160a01b031614620005bb5760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e646572210000000000000000000000000000006064820152608401620000fa565b600085858585604051620005cf9062000c4e565b620005de949392919062000de4565b604051809103906000f080158015620005fb573d6000803e3d6000fd5b506001600160a01b03808216600081815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168617909155600383528184208054968f169682168717905594835260049091529081902080549093169091179091555190915081907f30c05779f384e0ae9d43bbf7ec4417f28bdc53d02a35551b6eb270a9c4c71dca90620006ac908a9084908b908b908b908b9062000e1a565b60405180910390a15050505050505050565b6005546000546001600160a01b0391821691163314620007475760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e67657221000000000000000000000000000000006064820152608401620000fa565b806001600160a01b03166200075b62000bbe565b6001600160a01b031614620007d95760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e646572210000000000000000000000000000006064820152608401620000fa565b6001600160a01b038085166000908152600460209081526040808320548416808452600290925290912054909116806200087c5760405162461bcd60e51b815260206004820152602b60248201527f526563656976696e672061737365747320666f7220756e6b6e6f776e2077726160448201527f7070656420746f6b656e210000000000000000000000000000000000000000006064820152608401620000fa565b6040517f979005ad0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820187905282169063979005ad90604401600060405180830381600087803b158015620008e057600080fd5b505af1158015620008f5573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b03808416600090815260026020526040902054166200096a5760405162461bcd60e51b815260206004820152601560248201527f4e6f206d617070696e6720666f7220746f6b656e2e00000000000000000000006044820152606401620000fa565b6001600160a01b03838116600090815260026020526040908190205490517f1dd319cb000000000000000000000000000000000000000000000000000000008152336004820152602481018590529116908190631dd319cb90604401600060405180830381600087803b158015620009e157600080fd5b505af1158015620009f6573d6000803e3d6000fd5b505050506001600160a01b03848116600090815260036020908152604080832054815190851660248201526044810188905286851660648083019190915282518083039091018152608490910190915290810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166383bece4d60e01b179052600554909262000a8992911690839062000493565b5050505050565b60006040518060600160405280876001600160a01b031681526020018681526020018481525060405160200162000ac8919062000ebb565b60408051808303601f19018152919052600180549192506001600160a01b0382169163b1454caa917401000000000000000000000000000000000000000090910463ffffffff1690601462000b1d8362000f02565b91906101000a81548163ffffffff021916908363ffffffff1602179055508684866040518563ffffffff1660e01b815260040162000b5f949392919062000f4e565b602060405180830381600087803b15801562000b7a57600080fd5b505af115801562000b8f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bb5919062000f8d565b50505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166363012de56040518163ffffffff1660e01b815260040160206040518083038186803b15801562000c0e57600080fd5b505afa15801562000c23573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c49919062000fb9565b905090565b6119d78062000fda83390190565b6001600160a01b038116811462000c7257600080fd5b50565b60006020828403121562000c8857600080fd5b813562000c958162000c5c565b9392505050565b60008083601f84011262000caf57600080fd5b50813567ffffffffffffffff81111562000cc857600080fd5b60208301915083602082850101111562000ce157600080fd5b9250929050565b60008060008060006060868803121562000d0157600080fd5b853562000d0e8162000c5c565b9450602086013567ffffffffffffffff8082111562000d2c57600080fd5b62000d3a89838a0162000c9c565b9096509450604088013591508082111562000d5457600080fd5b5062000d638882890162000c9c565b969995985093965092949392505050565b60008060006060848603121562000d8a57600080fd5b833562000d978162000c5c565b925060208401359150604084013562000db08162000c5c565b809150509250925092565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60408152600062000dfa60408301868862000dbb565b828103602084015262000e0f81858762000dbb565b979650505050505050565b60006001600160a01b0380891683528088166020840152506080604083015262000e4960808301868862000dbb565b828103606084015262000e5e81858762000dbb565b9998505050505050505050565b6000815180845260005b8181101562000e935760208185018101518683018201520162000e75565b8181111562000ea6576000602083870101525b50601f01601f19169290920160200192915050565b602081526001600160a01b038251166020820152600060208301516060604084015262000eec608084018262000e6b565b9050604084015160608401528091505092915050565b600063ffffffff8083168181141562000f44577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6001019392505050565b600063ffffffff80871683528086166020840152506080604083015262000f79608083018562000e6b565b905060ff8316606083015295945050505050565b60006020828403121562000fa057600080fd5b815167ffffffffffffffff8116811462000c9557600080fd5b60006020828403121562000fcc57600080fd5b815162000c958162000c5c56fe6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b50604051620019d7380380620019d78339810160408190526200005a91620002e3565b8181818181600390805190602001906200007692919062000170565b5080516200008c90600490602084019062000170565b5050505050620000c37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177533620000cb60201b60201c565b50506200038a565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166200016c5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200012b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b8280546200017e906200034d565b90600052602060002090601f016020900481019282620001a25760008555620001ed565b82601f10620001bd57805160ff1916838001178555620001ed565b82800160010185558215620001ed579182015b82811115620001ed578251825591602001919060010190620001d0565b50620001fb929150620001ff565b5090565b5b80821115620001fb576000815560010162000200565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023e57600080fd5b81516001600160401b03808211156200025b576200025b62000216565b604051601f8301601f19908116603f0116810190828211818310171562000286576200028662000216565b81604052838152602092508683858801011115620002a357600080fd5b600091505b83821015620002c75785820183015181830184015290820190620002a8565b83821115620002d95760008385830101525b9695505050505050565b60008060408385031215620002f757600080fd5b82516001600160401b03808211156200030f57600080fd5b6200031d868387016200022c565b935060208501519150808211156200033457600080fd5b5062000343858286016200022c565b9150509250929050565b600181811c908216806200036257607f821691505b602082108114156200038457634e487b7160e01b600052602260045260246000fd5b50919050565b61163d806200039a6000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806339509351116100d8578063979005ad1161008c578063a9059cbb11610066578063a9059cbb1461031a578063d547741f1461032d578063dd62ed3e1461034057600080fd5b8063979005ad146102ec578063a217fddf146102ff578063a457c2d71461030757600080fd5b806375b238fc116100bd57806375b238fc1461028457806391d14854146102ab57806395d89b41146102e457600080fd5b8063395093511461025e57806370a082311461027157600080fd5b806323b872dd1161012f5780632f2ff15d116101145780632f2ff15d14610229578063313ce5671461023c57806336568abe1461024b57600080fd5b806323b872dd146101f3578063248a9ca31461020657600080fd5b8063095ea7b311610160578063095ea7b3146101b957806318160ddd146101cc5780631dd319cb146101de57600080fd5b806301ffc9a71461017c57806306fdde03146101a4575b600080fd5b61018f61018a3660046112f7565b610353565b60405190151581526020015b60405180910390f35b6101ac6103ec565b60405161019b9190611365565b61018f6101c73660046113b4565b61047e565b6002545b60405190815260200161019b565b6101f16101ec3660046113b4565b610496565b005b61018f6102013660046113de565b61052d565b6101d061021436600461141a565b60009081526007602052604090206001015490565b6101f1610237366004611433565b610551565b6040516012815260200161019b565b6101f1610259366004611433565b610577565b61018f61026c3660046113b4565b610603565b6101d061027f36600461145f565b610642565b6101d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61018f6102b9366004611433565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101ac6106ea565b6101f16102fa3660046113b4565b6106f9565b6101d0600081565b61018f6103153660046113b4565b61072e565b61018f6103283660046113b4565b6107d8565b6101f161033b366004611433565b6107e6565b6101d061034e36600461147a565b61080c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806103e657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600380546103fb906114a4565b80601f0160208091040260200160405190810160405280929190818152602001828054610427906114a4565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60003361048c81858561091d565b5060019392505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104c18133610a75565b816104cb84610642565b101561051e5760405162461bcd60e51b815260206004820152601560248201527f496e73756666696369656e742062616c616e63652e000000000000000000000060448201526064015b60405180910390fd5b6105288383610af5565b505050565b60003361053b858285610c7a565b610546858585610cf4565b506001949350505050565b60008281526007602052604090206001015461056d8133610a75565b6105288383610f0b565b6001600160a01b03811633146105f55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610515565b6105ff8282610fad565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061048c908290869061063d9087906114f5565b61091d565b6000326001600160a01b0383161415610673576001600160a01b0382166000908152602081905260409020546103e6565b336001600160a01b03831614156106a2576001600160a01b0382166000908152602081905260409020546103e6565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e6365006044820152606401610515565b6060600480546103fb906114a4565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756107248133610a75565b6105288383611030565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107cb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610515565b610546828686840361091d565b60003361048c818585610cf4565b6000828152600760205260409020600101546108028133610a75565b6105288383610fad565b6000326001600160a01b038416148061082d5750326001600160a01b038316145b15610860576001600160a01b038084166000908152600160209081526040808320938616835292905220545b90506103e6565b336001600160a01b038416148061087f5750336001600160a01b038316145b156108af576001600160a01b03808416600090815260016020908152604080832093861683529290522054610859565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166109985760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610a145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff57610ab3816001600160a01b0316601461110f565b610abe83602061110f565b604051602001610acf92919061150d565b60408051601f198184030181529082905262461bcd60e51b825261051591600401611365565b6001600160a01b038216610b715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03821660009081526020819052604090205481811015610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c2f90849061158e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610c86848461080c565b90506000198114610cee5781811015610ce15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610515565b610cee848484840361091d565b50505050565b6001600160a01b038316610d705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610dec5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03831660009081526020819052604090205481811015610e7b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610eb29084906114f5565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610efe91815260200190565b60405180910390a3610cee565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16156105ff5760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166110865760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610515565b806002600082825461109891906114f5565b90915550506001600160a01b038216600090815260208190526040812080548392906110c59084906114f5565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060600061111e8360026115a5565b6111299060026114f5565b67ffffffffffffffff811115611141576111416115c4565b6040519080825280601f01601f19166020018201604052801561116b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106111a2576111a26115da565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111ed576111ed6115da565b60200101906001600160f81b031916908160001a90535060006112118460026115a5565b61121c9060016114f5565b90505b60018111156112a1577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061125d5761125d6115da565b1a60f81b828281518110611273576112736115da565b60200101906001600160f81b031916908160001a90535060049490941c9361129a816115f0565b905061121f565b5083156112f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610515565b9392505050565b60006020828403121561130957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f057600080fd5b60005b8381101561135457818101518382015260200161133c565b83811115610cee5750506000910152565b6020815260008251806020840152611384816040850160208701611339565b601f01601f19169190910160400192915050565b80356001600160a01b03811681146113af57600080fd5b919050565b600080604083850312156113c757600080fd5b6113d083611398565b946020939093013593505050565b6000806000606084860312156113f357600080fd5b6113fc84611398565b925061140a60208501611398565b9150604084013590509250925092565b60006020828403121561142c57600080fd5b5035919050565b6000806040838503121561144657600080fd5b8235915061145660208401611398565b90509250929050565b60006020828403121561147157600080fd5b6112f082611398565b6000806040838503121561148d57600080fd5b61149683611398565b915061145660208401611398565b600181811c908216806114b857607f821691505b602082108114156114d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611508576115086114df565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611545816017850160208801611339565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611582816028840160208801611339565b01602801949350505050565b6000828210156115a0576115a06114df565b500390565b60008160001904831182151516156115bf576115bf6114df565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816115ff576115ff6114df565b50600019019056fea26469706673582212203d4cd3ed17d72b2f94aa2bf3da11f2d447bbf1eab55024ccf72a1f938cbe214064736f6c63430008090033a26469706673582212202fe10727c126a1b1c4a8866a019847d8014f97068730fe77aae15ae1bbedce0064736f6c63430008090033", + Bin: "0x60806040526001805463ffffffff60a01b191690553480156200002157600080fd5b5060405162002b7f38038062002b7f83398101604081905262000044916200012c565b600080546001600160a01b0319166001600160a01b038416908117909155604080516350d113fd60e11b8152905184929163a1a227fa916004808301926020929190829003018186803b1580156200009b57600080fd5b505afa158015620000b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d6919062000164565b600180546001600160a01b039283166001600160a01b031991821617909155600580549490921693169290921790915550620001899050565b80516001600160a01b03811681146200012757600080fd5b919050565b600080604083850312156200014057600080fd5b6200014b836200010f565b91506200015b602084016200010f565b90509250929050565b6000602082840312156200017757600080fd5b62000182826200010f565b9392505050565b6129e680620001996000396000f3fe6080604052600436106200008a5760003560e01c80639813c7b211620000555780639813c7b214620002065780639e405b711462000256578063a381c8e21462000290578063d5c6b50414620002b55762000103565b80628d48e3146200014c5780631888d71214620001a3578063458ffd6314620001bc57806383bece4d14620001e15762000103565b36620001035760405162461bcd60e51b815260206004820152602360248201527f436f6e747261637420646f6573206e6f7420737570706f72742072656365697660448201527f652829000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152601d60248201527f66616c6c6261636b2829206d6574686f6420756e737570706f727465640000006044820152606401620000fa565b3480156200015957600080fd5b50620001866200016b36600462000c75565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b620001ba620001b436600462000c75565b620002ef565b005b348015620001c957600080fd5b50620001ba620001db36600462000ce8565b620004a0565b348015620001ee57600080fd5b50620001ba6200020036600462000d74565b620006be565b3480156200021357600080fd5b50620002456200022536600462000c75565b6001600160a01b0390811660009081526002602052604090205416151590565b60405190151581526020016200019a565b3480156200026357600080fd5b50620001866200027536600462000c75565b6003602052600090815260409020546001600160a01b031681565b3480156200029d57600080fd5b50620001ba620002af36600462000d74565b62000901565b348015620002c257600080fd5b5062000186620002d436600462000c75565b6002602052600090815260409020546001600160a01b031681565b60003411620003415760405162461bcd60e51b815260206004820152600d60248201527f4e6f7468696e672073656e742e000000000000000000000000000000000000006044820152606401620000fa565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b546001600160a01b0316620003c35760405162461bcd60e51b815260206004820152601560248201527f4e6f206d617070696e6720666f7220746f6b656e2e00000000000000000000006044820152606401620000fa565b600080805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff546040516001600160a01b03918216602482015234604482015290831660648201526383bece4d60e01b9060840160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526005549091506200049c906001600160a01b03168260005b60008062000a90565b5050565b6005546000546001600160a01b0391821691163314620005295760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e67657221000000000000000000000000000000006064820152608401620000fa565b806001600160a01b03166200053d62000bbe565b6001600160a01b031614620005bb5760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e646572210000000000000000000000000000006064820152608401620000fa565b600085858585604051620005cf9062000c4e565b620005de949392919062000de4565b604051809103906000f080158015620005fb573d6000803e3d6000fd5b506001600160a01b03808216600081815260026020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168617909155600383528184208054968f169682168717905594835260049091529081902080549093169091179091555190915081907f30c05779f384e0ae9d43bbf7ec4417f28bdc53d02a35551b6eb270a9c4c71dca90620006ac908a9084908b908b908b908b9062000e1a565b60405180910390a15050505050505050565b6005546000546001600160a01b0391821691163314620007475760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e67657221000000000000000000000000000000006064820152608401620000fa565b806001600160a01b03166200075b62000bbe565b6001600160a01b031614620007d95760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e646572210000000000000000000000000000006064820152608401620000fa565b6001600160a01b038085166000908152600460209081526040808320548416808452600290925290912054909116806200087c5760405162461bcd60e51b815260206004820152602b60248201527f526563656976696e672061737365747320666f7220756e6b6e6f776e2077726160448201527f7070656420746f6b656e210000000000000000000000000000000000000000006064820152608401620000fa565b6040517f979005ad0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820187905282169063979005ad90604401600060405180830381600087803b158015620008e057600080fd5b505af1158015620008f5573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b03808416600090815260026020526040902054166200096a5760405162461bcd60e51b815260206004820152601560248201527f4e6f206d617070696e6720666f7220746f6b656e2e00000000000000000000006044820152606401620000fa565b6001600160a01b03838116600090815260026020526040908190205490517f1dd319cb000000000000000000000000000000000000000000000000000000008152336004820152602481018590529116908190631dd319cb90604401600060405180830381600087803b158015620009e157600080fd5b505af1158015620009f6573d6000803e3d6000fd5b505050506001600160a01b03848116600090815260036020908152604080832054815190851660248201526044810188905286851660648083019190915282518083039091018152608490910190915290810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166383bece4d60e01b179052600554909262000a8992911690839062000493565b5050505050565b60006040518060600160405280876001600160a01b031681526020018681526020018481525060405160200162000ac8919062000ebb565b60408051808303601f19018152919052600180549192506001600160a01b0382169163b1454caa917401000000000000000000000000000000000000000090910463ffffffff1690601462000b1d8362000f02565b91906101000a81548163ffffffff021916908363ffffffff1602179055508684866040518563ffffffff1660e01b815260040162000b5f949392919062000f4e565b602060405180830381600087803b15801562000b7a57600080fd5b505af115801562000b8f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bb5919062000f8d565b50505050505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166363012de56040518163ffffffff1660e01b815260040160206040518083038186803b15801562000c0e57600080fd5b505afa15801562000c23573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c49919062000fb9565b905090565b6119d78062000fda83390190565b6001600160a01b038116811462000c7257600080fd5b50565b60006020828403121562000c8857600080fd5b813562000c958162000c5c565b9392505050565b60008083601f84011262000caf57600080fd5b50813567ffffffffffffffff81111562000cc857600080fd5b60208301915083602082850101111562000ce157600080fd5b9250929050565b60008060008060006060868803121562000d0157600080fd5b853562000d0e8162000c5c565b9450602086013567ffffffffffffffff8082111562000d2c57600080fd5b62000d3a89838a0162000c9c565b9096509450604088013591508082111562000d5457600080fd5b5062000d638882890162000c9c565b969995985093965092949392505050565b60008060006060848603121562000d8a57600080fd5b833562000d978162000c5c565b925060208401359150604084013562000db08162000c5c565b809150509250925092565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60408152600062000dfa60408301868862000dbb565b828103602084015262000e0f81858762000dbb565b979650505050505050565b60006001600160a01b0380891683528088166020840152506080604083015262000e4960808301868862000dbb565b828103606084015262000e5e81858762000dbb565b9998505050505050505050565b6000815180845260005b8181101562000e935760208185018101518683018201520162000e75565b8181111562000ea6576000602083870101525b50601f01601f19169290920160200192915050565b602081526001600160a01b038251166020820152600060208301516060604084015262000eec608084018262000e6b565b9050604084015160608401528091505092915050565b600063ffffffff8083168181141562000f44577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6001019392505050565b600063ffffffff80871683528086166020840152506080604083015262000f79608083018562000e6b565b905060ff8316606083015295945050505050565b60006020828403121562000fa057600080fd5b815167ffffffffffffffff8116811462000c9557600080fd5b60006020828403121562000fcc57600080fd5b815162000c958162000c5c56fe6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b50604051620019d7380380620019d78339810160408190526200005a91620002e3565b8181818181600390805190602001906200007692919062000170565b5080516200008c90600490602084019062000170565b5050505050620000c37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177533620000cb60201b60201c565b50506200038a565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166200016c5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200012b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b8280546200017e906200034d565b90600052602060002090601f016020900481019282620001a25760008555620001ed565b82601f10620001bd57805160ff1916838001178555620001ed565b82800160010185558215620001ed579182015b82811115620001ed578251825591602001919060010190620001d0565b50620001fb929150620001ff565b5090565b5b80821115620001fb576000815560010162000200565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023e57600080fd5b81516001600160401b03808211156200025b576200025b62000216565b604051601f8301601f19908116603f0116810190828211818310171562000286576200028662000216565b81604052838152602092508683858801011115620002a357600080fd5b600091505b83821015620002c75785820183015181830184015290820190620002a8565b83821115620002d95760008385830101525b9695505050505050565b60008060408385031215620002f757600080fd5b82516001600160401b03808211156200030f57600080fd5b6200031d868387016200022c565b935060208501519150808211156200033457600080fd5b5062000343858286016200022c565b9150509250929050565b600181811c908216806200036257607f821691505b602082108114156200038457634e487b7160e01b600052602260045260246000fd5b50919050565b61163d806200039a6000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806339509351116100d8578063979005ad1161008c578063a9059cbb11610066578063a9059cbb1461031a578063d547741f1461032d578063dd62ed3e1461034057600080fd5b8063979005ad146102ec578063a217fddf146102ff578063a457c2d71461030757600080fd5b806375b238fc116100bd57806375b238fc1461028457806391d14854146102ab57806395d89b41146102e457600080fd5b8063395093511461025e57806370a082311461027157600080fd5b806323b872dd1161012f5780632f2ff15d116101145780632f2ff15d14610229578063313ce5671461023c57806336568abe1461024b57600080fd5b806323b872dd146101f3578063248a9ca31461020657600080fd5b8063095ea7b311610160578063095ea7b3146101b957806318160ddd146101cc5780631dd319cb146101de57600080fd5b806301ffc9a71461017c57806306fdde03146101a4575b600080fd5b61018f61018a3660046112f7565b610353565b60405190151581526020015b60405180910390f35b6101ac6103ec565b60405161019b9190611365565b61018f6101c73660046113b4565b61047e565b6002545b60405190815260200161019b565b6101f16101ec3660046113b4565b610496565b005b61018f6102013660046113de565b61052d565b6101d061021436600461141a565b60009081526007602052604090206001015490565b6101f1610237366004611433565b610551565b6040516012815260200161019b565b6101f1610259366004611433565b610577565b61018f61026c3660046113b4565b610603565b6101d061027f36600461145f565b610642565b6101d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61018f6102b9366004611433565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101ac6106ea565b6101f16102fa3660046113b4565b6106f9565b6101d0600081565b61018f6103153660046113b4565b61072e565b61018f6103283660046113b4565b6107d8565b6101f161033b366004611433565b6107e6565b6101d061034e36600461147a565b61080c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806103e657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600380546103fb906114a4565b80601f0160208091040260200160405190810160405280929190818152602001828054610427906114a4565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60003361048c81858561091d565b5060019392505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104c18133610a75565b816104cb84610642565b101561051e5760405162461bcd60e51b815260206004820152601560248201527f496e73756666696369656e742062616c616e63652e000000000000000000000060448201526064015b60405180910390fd5b6105288383610af5565b505050565b60003361053b858285610c7a565b610546858585610cf4565b506001949350505050565b60008281526007602052604090206001015461056d8133610a75565b6105288383610f0b565b6001600160a01b03811633146105f55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610515565b6105ff8282610fad565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061048c908290869061063d9087906114f5565b61091d565b6000326001600160a01b0383161415610673576001600160a01b0382166000908152602081905260409020546103e6565b336001600160a01b03831614156106a2576001600160a01b0382166000908152602081905260409020546103e6565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e6365006044820152606401610515565b6060600480546103fb906114a4565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756107248133610a75565b6105288383611030565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107cb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610515565b610546828686840361091d565b60003361048c818585610cf4565b6000828152600760205260409020600101546108028133610a75565b6105288383610fad565b6000326001600160a01b038416148061082d5750326001600160a01b038316145b15610860576001600160a01b038084166000908152600160209081526040808320938616835292905220545b90506103e6565b336001600160a01b038416148061087f5750336001600160a01b038316145b156108af576001600160a01b03808416600090815260016020908152604080832093861683529290522054610859565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166109985760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610a145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff57610ab3816001600160a01b0316601461110f565b610abe83602061110f565b604051602001610acf92919061150d565b60408051601f198184030181529082905262461bcd60e51b825261051591600401611365565b6001600160a01b038216610b715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03821660009081526020819052604090205481811015610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c2f90849061158e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610c86848461080c565b90506000198114610cee5781811015610ce15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610515565b610cee848484840361091d565b50505050565b6001600160a01b038316610d705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610dec5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03831660009081526020819052604090205481811015610e7b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610eb29084906114f5565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610efe91815260200190565b60405180910390a3610cee565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16156105ff5760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166110865760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610515565b806002600082825461109891906114f5565b90915550506001600160a01b038216600090815260208190526040812080548392906110c59084906114f5565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060600061111e8360026115a5565b6111299060026114f5565b67ffffffffffffffff811115611141576111416115c4565b6040519080825280601f01601f19166020018201604052801561116b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106111a2576111a26115da565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111ed576111ed6115da565b60200101906001600160f81b031916908160001a90535060006112118460026115a5565b61121c9060016114f5565b90505b60018111156112a1577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061125d5761125d6115da565b1a60f81b828281518110611273576112736115da565b60200101906001600160f81b031916908160001a90535060049490941c9361129a816115f0565b905061121f565b5083156112f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610515565b9392505050565b60006020828403121561130957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f057600080fd5b60005b8381101561135457818101518382015260200161133c565b83811115610cee5750506000910152565b6020815260008251806020840152611384816040850160208701611339565b601f01601f19169190910160400192915050565b80356001600160a01b03811681146113af57600080fd5b919050565b600080604083850312156113c757600080fd5b6113d083611398565b946020939093013593505050565b6000806000606084860312156113f357600080fd5b6113fc84611398565b925061140a60208501611398565b9150604084013590509250925092565b60006020828403121561142c57600080fd5b5035919050565b6000806040838503121561144657600080fd5b8235915061145660208401611398565b90509250929050565b60006020828403121561147157600080fd5b6112f082611398565b6000806040838503121561148d57600080fd5b61149683611398565b915061145660208401611398565b600181811c908216806114b857607f821691505b602082108114156114d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611508576115086114df565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611545816017850160208801611339565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611582816028840160208801611339565b01602801949350505050565b6000828210156115a0576115a06114df565b500390565b60008160001904831182151516156115bf576115bf6114df565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816115ff576115ff6114df565b50600019019056fea2646970667358221220848f35fdc28f22577d7d393858f44350cbde245dc770487cf991c8a21210b53864736f6c63430008090033a26469706673582212201cb68080b09cb661012c058defbf9bd2a3be17a1afc6d3912fd82b970de25b5d64736f6c63430008090033", } // EthereumBridgeABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/ManagementContract/ManagementContract.go b/contracts/generated/ManagementContract/ManagementContract.go index 52e73989bb..55ce77e434 100644 --- a/contracts/generated/ManagementContract/ManagementContract.go +++ b/contracts/generated/ManagementContract/ManagementContract.go @@ -54,7 +54,7 @@ type StructsMetaRollup struct { // ManagementContractMetaData contains all meta data concerning the ManagementContract contract. var ManagementContractMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"messageBusAddress\",\"type\":\"address\"}],\"name\":\"LogManagementContractCreated\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"AggregatorID\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"LastSequenceNumber\",\"type\":\"uint256\"}],\"internalType\":\"structStructs.MetaRollup\",\"name\":\"r\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_rollupData\",\"type\":\"string\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage[]\",\"name\":\"messages\",\"type\":\"tuple[]\"}],\"internalType\":\"structStructs.HeaderCrossChainData\",\"name\":\"crossChainData\",\"type\":\"tuple\"}],\"name\":\"AddRollup\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"Attested\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetHostAddresses\",\"outputs\":[{\"internalType\":\"string[]\",\"name\":\"\",\"type\":\"string[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"rollupHash\",\"type\":\"bytes32\"}],\"name\":\"GetRollupByHash\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"AggregatorID\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"LastSequenceNumber\",\"type\":\"uint256\"}],\"internalType\":\"structStructs.MetaRollup\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_aggregatorID\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_initSecret\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_hostAddress\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_genesisAttestation\",\"type\":\"string\"}],\"name\":\"InitializeNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"IsWithdrawalAvailable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"requestReport\",\"type\":\"string\"}],\"name\":\"RequestNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"attesterID\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"requesterID\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"attesterSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"responseSecret\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"hostAddress\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"verifyAttester\",\"type\":\"bool\"}],\"name\":\"RespondNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBatchSeqNo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageBus\",\"outputs\":[{\"internalType\":\"contractIMessageBus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x6080604052600060045534801561001557600080fd5b5060405161002290610096565b604051809103906000f08015801561003e573d6000803e3d6000fd5b50600680546001600160a01b0319166001600160a01b039290921691821790556040519081527fbd726cf82ac9c3260b1495107182e336e0654b25c10915648c0cc15b2bb72cbf9060200160405180910390a16100a3565b610e918061159f83390190565b6114ed806100b26000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638fa0d05311610076578063a52f433c1161005b578063a52f433c14610222578063bbd79e1514610232578063e34fbfc81461024557600080fd5b80638fa0d053146101e4578063a1a227fa146101f757600080fd5b8063440c953b116100a7578063440c953b1461011d57806359a90071146101345780638236a7ba1461014957600080fd5b8063324ff866146100c357806343348b2f146100e1575b600080fd5b6100cb610258565b6040516100d89190610d03565b60405180910390f35b61010d6100ef366004610d92565b6001600160a01b031660009081526001602052604090205460ff1690565b60405190151581526020016100d8565b61012660045481565b6040519081526020016100d8565b610147610142366004610e9b565b610331565b005b6101b1610157366004610f42565b6040805160608082018352600080835260208084018290529284018190528481526005835283902083519182018452805480835260018201546001600160a01b031693830193909352600201549281019290925290911491565b60408051921515835281516020808501919091528201516001600160a01b031683820152015160608201526080016100d8565b6101476101f2366004610f5b565b6103b9565b60065461020a906001600160a01b031681565b6040516001600160a01b0390911681526020016100d8565b600354610100900460ff1661010d565b610147610240366004610fe2565b610453565b6101476102533660046110a8565b6105b6565b60606002805480602002602001604051908101604052809291908181526020016000905b8282101561032857838290600052602060002001805461029b906110ea565b80601f01602080910402602001604051908101604052809291908181526020018280546102c7906110ea565b80156103145780601f106102e957610100808354040283529160200191610314565b820191906000526020600020905b8154815290600101906020018083116102f757829003601f168201915b50505050508152602001906001019061027c565b50505050905090565b60035460ff161561034157600080fd5b60038054600160ff1991821681179092556001600160a01b038816600090815260208381526040822080549093168417909255600280549384018155905284516103b0927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0191860190610bca565b50505050505050565b600160006103cd6040870160208801610d92565b6001600160a01b0316815260208101919091526040016000205460ff1661043b5760405162461bcd60e51b815260206004820152601760248201527f61676772656761746f72206e6f7420617474657374656400000000000000000060448201526064015b60405180910390fd5b610444846105d5565b61044d8161060d565b50505050565b6001600160a01b03861660009081526001602052604090205460ff168061047957600080fd5b81156105495760006104af8888868860405160200161049b9493929190611125565b6040516020818303038152906040526106c7565b905060006104bd8288610702565b9050886001600160a01b0316816001600160a01b0316146105465760405162461bcd60e51b815260206004820152602c60248201527f63616c63756c61746564206164647265737320616e642061747465737465724960448201527f4420646f6e74206d6174636800000000000000000000000000000000000000006064820152608401610432565b50505b6001600160a01b03861660009081526001602081815260408320805460ff19168317905560028054928301815590925284516105ac927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90920191860190610bca565b5050505050505050565b3360009081526020819052604090206105d0908383610c4e565b505050565b8035600090815260056020526040902081906105f18282611181565b50506004546040820135111561060a5760408101356004555b50565b600061061982806111d8565b9050905060005b818110156105d0576006546001600160a01b0316639730886d61064385806111d8565b8481811061065357610653611222565b90506020028101906106659190611238565b60016040518363ffffffff1660e01b81526004016106849291906112f1565b600060405180830381600087803b15801561069e57600080fd5b505af11580156106b2573d6000803e3d6000fd5b50505050806106c0906113be565b9050610620565b60006106d38251610726565b826040516020016106e59291906113d9565b604051602081830303815290604052805190602001209050919050565b60008060006107118585610860565b9150915061071e816108d0565b509392505050565b60608161076657505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610790578061077a816113be565b91506107899050600a8361144a565b915061076a565b60008167ffffffffffffffff8111156107ab576107ab610df8565b6040519080825280601f01601f1916602001820160405280156107d5576020820181803683370190505b5090505b8415610858576107ea60018361145e565b91506107f7600a86611475565b610802906030611489565b60f81b81838151811061081757610817611222565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610851600a8661144a565b94506107d9565b949350505050565b6000808251604114156108975760208301516040840151606085015160001a61088b87828585610a8b565b945094505050506108c9565b8251604014156108c157602083015160408401516108b6868383610b78565b9350935050506108c9565b506000905060025b9250929050565b60008160048111156108e4576108e46114a1565b14156108ed5750565b6001816004811115610901576109016114a1565b141561094f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610432565b6002816004811115610963576109636114a1565b14156109b15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610432565b60038160048111156109c5576109c56114a1565b1415610a1e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610432565b6004816004811115610a3257610a326114a1565b141561060a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610432565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610ac25750600090506003610b6f565b8460ff16601b14158015610ada57508460ff16601c14155b15610aeb5750600090506004610b6f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b3f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b6857600060019250925050610b6f565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681610bae60ff86901c601b611489565b9050610bbc87828885610a8b565b935093505050935093915050565b828054610bd6906110ea565b90600052602060002090601f016020900481019282610bf85760008555610c3e565b82601f10610c1157805160ff1916838001178555610c3e565b82800160010185558215610c3e579182015b82811115610c3e578251825591602001919060010190610c23565b50610c4a929150610cc2565b5090565b828054610c5a906110ea565b90600052602060002090601f016020900481019282610c7c5760008555610c3e565b82601f10610c955782800160ff19823516178555610c3e565b82800160010185558215610c3e579182015b82811115610c3e578235825591602001919060010190610ca7565b5b80821115610c4a5760008155600101610cc3565b60005b83811015610cf2578181015183820152602001610cda565b8381111561044d5750506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610d7057878503603f1901845281518051808752610d51818989018a8501610cd7565b601f01601f191695909501860194509285019290850190600101610d2a565b5092979650505050505050565b6001600160a01b038116811461060a57600080fd5b600060208284031215610da457600080fd5b8135610daf81610d7d565b9392505050565b60008083601f840112610dc857600080fd5b50813567ffffffffffffffff811115610de057600080fd5b6020830191508360208285010111156108c957600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112610e1f57600080fd5b813567ffffffffffffffff80821115610e3a57610e3a610df8565b604051601f8301601f19908116603f01168101908282118183101715610e6257610e62610df8565b81604052838152866020858801011115610e7b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060808789031215610eb457600080fd5b8635610ebf81610d7d565b9550602087013567ffffffffffffffff80821115610edc57600080fd5b610ee88a838b01610db6565b90975095506040890135915080821115610f0157600080fd5b610f0d8a838b01610e0e565b94506060890135915080821115610f2357600080fd5b50610f3089828a01610db6565b979a9699509497509295939492505050565b600060208284031215610f5457600080fd5b5035919050565b60008060008084860360a0811215610f7257600080fd5b6060811215610f8057600080fd5b50849350606085013567ffffffffffffffff80821115610f9f57600080fd5b610fab88838901610db6565b90955093506080870135915080821115610fc457600080fd5b50850160208188031215610fd757600080fd5b939692955090935050565b60008060008060008060c08789031215610ffb57600080fd5b863561100681610d7d565b9550602087013561101681610d7d565b9450604087013567ffffffffffffffff8082111561103357600080fd5b61103f8a838b01610e0e565b9550606089013591508082111561105557600080fd5b6110618a838b01610e0e565b9450608089013591508082111561107757600080fd5b5061108489828a01610e0e565b92505060a0870135801515811461109a57600080fd5b809150509295509295509295565b600080602083850312156110bb57600080fd5b823567ffffffffffffffff8111156110d257600080fd5b6110de85828601610db6565b90969095509350505050565b600181811c908216806110fe57607f821691505b6020821081141561111f57634e487b7160e01b600052602260045260246000fd5b50919050565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250835161115c816028850160208801610cd7565b835190830190611173816028840160208801610cd7565b016028019695505050505050565b8135815560018101602083013561119781610d7d565b6001600160a01b0381167fffffffffffffffffffffffff00000000000000000000000000000000000000008354161782555050604082013560028201555050565b6000808335601e198436030181126111ef57600080fd5b83018035915067ffffffffffffffff82111561120a57600080fd5b6020019150600581901b36038213156108c957600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be1983360301811261124e57600080fd5b9190910192915050565b803563ffffffff8116811461126c57600080fd5b919050565b6000808335601e1984360301811261128857600080fd5b830160208101925035905067ffffffffffffffff8111156112a857600080fd5b8036038313156108c957600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461126c57600080fd5b604081526000833561130281610d7d565b6001600160a01b03166040830152602084013567ffffffffffffffff811680821461132c57600080fd5b60608401525061133e60408501611258565b63ffffffff16608083015261135560608501611258565b63ffffffff1660a083015261136d6080850185611271565b60c080850152611382610100850182846112b7565b91505061139160a086016112e0565b60ff1660e084015260209092019290925292915050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156113d2576113d26113a8565b5060010190565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161141181601a850160208801610cd7565b83519083019061142881601a840160208801610cd7565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261145957611459611434565b500490565b600082821015611470576114706113a8565b500390565b60008261148457611484611434565b500690565b6000821982111561149c5761149c6113a8565b500190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212208e2048f7e310b52ad336bef61c6d2caae7e77ab88301de76bdd6b231e4450a0664736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e138061007e6000396000f3fe6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146101ae5780639730886d146101d6578063b1454caa146101f6578063f2fde38b1461022f576100ec565b80630fcfbd111461013457806333a88c7214610167578063715018a614610197576100ec565b366100ec5760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f7274656400000000000000000000000000000000000000000060448201526064016100e3565b34801561014057600080fd5b5061015461014f366004610770565b61024f565b6040519081526020015b60405180910390f35b34801561017357600080fd5b50610187610182366004610770565b610305565b604051901515815260200161015e565b3480156101a357600080fd5b506101ac610358565b005b3480156101ba57600080fd5b506000546040516001600160a01b03909116815260200161015e565b3480156101e257600080fd5b506101ac6101f13660046107a5565b6103be565b34801561020257600080fd5b5061021661021136600461081b565b610562565b60405167ffffffffffffffff909116815260200161015e565b34801561023b57600080fd5b506101ac61024a3660046108dd565b6105bb565b600080826040516020016102639190610939565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806102fe5760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e0000000000000000000000000000000000000000000000000000000000000060648201526084016100e3565b9392505050565b600080826040516020016103199190610939565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103505750428111155b949350505050565b6000546001600160a01b031633146103b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b6103bc600061069d565b565b6000546001600160a01b031633146104185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b60006104248242610a39565b90506000836040516020016104399190610939565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156104d45760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f210000000000000000000000000000000000000000000000000000000000000060648201526084016100e3565b60008181526001602090815260408220849055600291906104f7908701876108dd565b6001600160a01b0316815260208101919091526040016000908120906105236080870160608801610a51565b63ffffffff1681526020808201929092526040016000908120805460018101825590825291902085916004020161055a8282610c33565b505050505050565b600061056d336106fa565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef775937338288888888886040516105aa9796959493929190610d51565b60405180910390a195945050505050565b6000546001600160a01b031633146106155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b6001600160a01b0381166106915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016100e3565b61069a8161069d565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff16916001919061072d8385610db1565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c0828403121561076a57600080fd5b50919050565b60006020828403121561078257600080fd5b813567ffffffffffffffff81111561079957600080fd5b61035084828501610758565b600080604083850312156107b857600080fd5b823567ffffffffffffffff8111156107cf57600080fd5b6107db85828601610758565b95602094909401359450505050565b63ffffffff8116811461069a57600080fd5b60ff8116811461069a57600080fd5b8035610816816107fc565b919050565b60008060008060006080868803121561083357600080fd5b853561083e816107ea565b9450602086013561084e816107ea565b9350604086013567ffffffffffffffff8082111561086b57600080fd5b818801915088601f83011261087f57600080fd5b81358181111561088e57600080fd5b8960208285010111156108a057600080fd5b60208301955080945050505060608601356108ba816107fc565b809150509295509295909350565b6001600160a01b038116811461069a57600080fd5b6000602082840312156108ef57600080fd5b81356102fe816108c8565b67ffffffffffffffff8116811461069a57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000823561094a816108c8565b6001600160a01b0381166020840152506020830135610968816108fa565b67ffffffffffffffff808216604085015260408501359150610989826107ea565b63ffffffff8083166060860152606086013592506109a6836107ea565b80831660808601525060808501359150601e198536030182126109c857600080fd5b908401908135818111156109db57600080fd5b8036038613156109ea57600080fd5b60c060a0860152610a0260e086018260208601610910565b92505050610a1260a0850161080b565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610a4c57610a4c610a23565b500190565b600060208284031215610a6357600080fd5b81356102fe816107ea565b60008135610a7b816107ea565b92915050565b6000808335601e19843603018112610a9857600080fd5b83018035915067ffffffffffffffff821115610ab357600080fd5b602001915036819003821315610ac857600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610af957607f821691505b6020821081141561076a57634e487b7160e01b600052602260045260246000fd5b601f821115610b6057600081815260208120601f850160051c81016020861015610b415750805b601f850160051c820191505b8181101561055a57828155600101610b4d565b505050565b67ffffffffffffffff831115610b7d57610b7d610acf565b610b9183610b8b8354610ae5565b83610b1a565b6000601f841160018114610bc55760008515610bad5750838201355b600019600387901b1c1916600186901b178355610c1f565b600083815260209020601f19861690835b82811015610bf65786850135825560209485019460019092019101610bd6565b5086821015610c135760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610a7b816107fc565b8135610c3e816108c8565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff1982161783556020840135610c76816108fa565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff0000000000000000000000000000000000000000000000000000000081848285161717855560408601359250610cd4836107ea565b921760e09190911b909116178155610d0c610cf160608401610a6e565b6001830163ffffffff821663ffffffff198254161781555050565b610d196080830183610a81565b610d27818360028601610b65565b5050610d4d610d3860a08401610c26565b6003830160ff821660ff198254161781555050565b5050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c06080830152610d9a60c083018587610910565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff808316818516808303821115610dd457610dd4610a23565b0194935050505056fea2646970667358221220e790a069b7a49368e0f1c281855881b133f1eac9bbac989876cb3bc659282fbe64736f6c63430008090033", + Bin: "0x6080604052600060045534801561001557600080fd5b5060405161002290610096565b604051809103906000f08015801561003e573d6000803e3d6000fd5b50600680546001600160a01b0319166001600160a01b039290921691821790556040519081527fbd726cf82ac9c3260b1495107182e336e0654b25c10915648c0cc15b2bb72cbf9060200160405180910390a16100a3565b6110df8061159f83390190565b6114ed806100b26000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638fa0d05311610076578063a52f433c1161005b578063a52f433c14610222578063bbd79e1514610232578063e34fbfc81461024557600080fd5b80638fa0d053146101e4578063a1a227fa146101f757600080fd5b8063440c953b116100a7578063440c953b1461011d57806359a90071146101345780638236a7ba1461014957600080fd5b8063324ff866146100c357806343348b2f146100e1575b600080fd5b6100cb610258565b6040516100d89190610d03565b60405180910390f35b61010d6100ef366004610d92565b6001600160a01b031660009081526001602052604090205460ff1690565b60405190151581526020016100d8565b61012660045481565b6040519081526020016100d8565b610147610142366004610e9b565b610331565b005b6101b1610157366004610f42565b6040805160608082018352600080835260208084018290529284018190528481526005835283902083519182018452805480835260018201546001600160a01b031693830193909352600201549281019290925290911491565b60408051921515835281516020808501919091528201516001600160a01b031683820152015160608201526080016100d8565b6101476101f2366004610f5b565b6103b9565b60065461020a906001600160a01b031681565b6040516001600160a01b0390911681526020016100d8565b600354610100900460ff1661010d565b610147610240366004610fe2565b610453565b6101476102533660046110a8565b6105b6565b60606002805480602002602001604051908101604052809291908181526020016000905b8282101561032857838290600052602060002001805461029b906110ea565b80601f01602080910402602001604051908101604052809291908181526020018280546102c7906110ea565b80156103145780601f106102e957610100808354040283529160200191610314565b820191906000526020600020905b8154815290600101906020018083116102f757829003601f168201915b50505050508152602001906001019061027c565b50505050905090565b60035460ff161561034157600080fd5b60038054600160ff1991821681179092556001600160a01b038816600090815260208381526040822080549093168417909255600280549384018155905284516103b0927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0191860190610bca565b50505050505050565b600160006103cd6040870160208801610d92565b6001600160a01b0316815260208101919091526040016000205460ff1661043b5760405162461bcd60e51b815260206004820152601760248201527f61676772656761746f72206e6f7420617474657374656400000000000000000060448201526064015b60405180910390fd5b610444846105d5565b61044d8161060d565b50505050565b6001600160a01b03861660009081526001602052604090205460ff168061047957600080fd5b81156105495760006104af8888868860405160200161049b9493929190611125565b6040516020818303038152906040526106c7565b905060006104bd8288610702565b9050886001600160a01b0316816001600160a01b0316146105465760405162461bcd60e51b815260206004820152602c60248201527f63616c63756c61746564206164647265737320616e642061747465737465724960448201527f4420646f6e74206d6174636800000000000000000000000000000000000000006064820152608401610432565b50505b6001600160a01b03861660009081526001602081815260408320805460ff19168317905560028054928301815590925284516105ac927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90920191860190610bca565b5050505050505050565b3360009081526020819052604090206105d0908383610c4e565b505050565b8035600090815260056020526040902081906105f18282611181565b50506004546040820135111561060a5760408101356004555b50565b600061061982806111d8565b9050905060005b818110156105d0576006546001600160a01b0316639730886d61064385806111d8565b8481811061065357610653611222565b90506020028101906106659190611238565b60016040518363ffffffff1660e01b81526004016106849291906112f1565b600060405180830381600087803b15801561069e57600080fd5b505af11580156106b2573d6000803e3d6000fd5b50505050806106c0906113be565b9050610620565b60006106d38251610726565b826040516020016106e59291906113d9565b604051602081830303815290604052805190602001209050919050565b60008060006107118585610860565b9150915061071e816108d0565b509392505050565b60608161076657505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610790578061077a816113be565b91506107899050600a8361144a565b915061076a565b60008167ffffffffffffffff8111156107ab576107ab610df8565b6040519080825280601f01601f1916602001820160405280156107d5576020820181803683370190505b5090505b8415610858576107ea60018361145e565b91506107f7600a86611475565b610802906030611489565b60f81b81838151811061081757610817611222565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610851600a8661144a565b94506107d9565b949350505050565b6000808251604114156108975760208301516040840151606085015160001a61088b87828585610a8b565b945094505050506108c9565b8251604014156108c157602083015160408401516108b6868383610b78565b9350935050506108c9565b506000905060025b9250929050565b60008160048111156108e4576108e46114a1565b14156108ed5750565b6001816004811115610901576109016114a1565b141561094f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610432565b6002816004811115610963576109636114a1565b14156109b15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610432565b60038160048111156109c5576109c56114a1565b1415610a1e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610432565b6004816004811115610a3257610a326114a1565b141561060a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610432565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610ac25750600090506003610b6f565b8460ff16601b14158015610ada57508460ff16601c14155b15610aeb5750600090506004610b6f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610b3f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610b6857600060019250925050610b6f565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681610bae60ff86901c601b611489565b9050610bbc87828885610a8b565b935093505050935093915050565b828054610bd6906110ea565b90600052602060002090601f016020900481019282610bf85760008555610c3e565b82601f10610c1157805160ff1916838001178555610c3e565b82800160010185558215610c3e579182015b82811115610c3e578251825591602001919060010190610c23565b50610c4a929150610cc2565b5090565b828054610c5a906110ea565b90600052602060002090601f016020900481019282610c7c5760008555610c3e565b82601f10610c955782800160ff19823516178555610c3e565b82800160010185558215610c3e579182015b82811115610c3e578235825591602001919060010190610ca7565b5b80821115610c4a5760008155600101610cc3565b60005b83811015610cf2578181015183820152602001610cda565b8381111561044d5750506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015610d7057878503603f1901845281518051808752610d51818989018a8501610cd7565b601f01601f191695909501860194509285019290850190600101610d2a565b5092979650505050505050565b6001600160a01b038116811461060a57600080fd5b600060208284031215610da457600080fd5b8135610daf81610d7d565b9392505050565b60008083601f840112610dc857600080fd5b50813567ffffffffffffffff811115610de057600080fd5b6020830191508360208285010111156108c957600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112610e1f57600080fd5b813567ffffffffffffffff80821115610e3a57610e3a610df8565b604051601f8301601f19908116603f01168101908282118183101715610e6257610e62610df8565b81604052838152866020858801011115610e7b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060808789031215610eb457600080fd5b8635610ebf81610d7d565b9550602087013567ffffffffffffffff80821115610edc57600080fd5b610ee88a838b01610db6565b90975095506040890135915080821115610f0157600080fd5b610f0d8a838b01610e0e565b94506060890135915080821115610f2357600080fd5b50610f3089828a01610db6565b979a9699509497509295939492505050565b600060208284031215610f5457600080fd5b5035919050565b60008060008084860360a0811215610f7257600080fd5b6060811215610f8057600080fd5b50849350606085013567ffffffffffffffff80821115610f9f57600080fd5b610fab88838901610db6565b90955093506080870135915080821115610fc457600080fd5b50850160208188031215610fd757600080fd5b939692955090935050565b60008060008060008060c08789031215610ffb57600080fd5b863561100681610d7d565b9550602087013561101681610d7d565b9450604087013567ffffffffffffffff8082111561103357600080fd5b61103f8a838b01610e0e565b9550606089013591508082111561105557600080fd5b6110618a838b01610e0e565b9450608089013591508082111561107757600080fd5b5061108489828a01610e0e565b92505060a0870135801515811461109a57600080fd5b809150509295509295509295565b600080602083850312156110bb57600080fd5b823567ffffffffffffffff8111156110d257600080fd5b6110de85828601610db6565b90969095509350505050565b600181811c908216806110fe57607f821691505b6020821081141561111f57634e487b7160e01b600052602260045260246000fd5b50919050565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250835161115c816028850160208801610cd7565b835190830190611173816028840160208801610cd7565b016028019695505050505050565b8135815560018101602083013561119781610d7d565b6001600160a01b0381167fffffffffffffffffffffffff00000000000000000000000000000000000000008354161782555050604082013560028201555050565b6000808335601e198436030181126111ef57600080fd5b83018035915067ffffffffffffffff82111561120a57600080fd5b6020019150600581901b36038213156108c957600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be1983360301811261124e57600080fd5b9190910192915050565b803563ffffffff8116811461126c57600080fd5b919050565b6000808335601e1984360301811261128857600080fd5b830160208101925035905067ffffffffffffffff8111156112a857600080fd5b8036038313156108c957600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461126c57600080fd5b604081526000833561130281610d7d565b6001600160a01b03166040830152602084013567ffffffffffffffff811680821461132c57600080fd5b60608401525061133e60408501611258565b63ffffffff16608083015261135560608501611258565b63ffffffff1660a083015261136d6080850185611271565b60c080850152611382610100850182846112b7565b91505061139160a086016112e0565b60ff1660e084015260209092019290925292915050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156113d2576113d26113a8565b5060010190565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161141181601a850160208801610cd7565b83519083019061142881601a840160208801610cd7565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261145957611459611434565b500490565b600082821015611470576114706113a8565b500390565b60008261148457611484611434565b500690565b6000821982111561149c5761149c6113a8565b500190565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220ebb5984de7c4f9d730ed0ba5cd008fbe0c4de0db6b9a6bcf972fc7009a467c0764736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6110618061007e6000396000f3fe60806040526004361061009a5760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad211461022f578063b1454caa1461024f578063f2fde38b1461028857610112565b80638da5cb5b146101e75780639730886d1461020f57610112565b80630fcfbd111461015a57806333a88c721461018d578063346633fb146101bd578063715018a6146101d257610112565b366101125760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f727465640000000000000000000000000000000000000000006044820152606401610109565b34801561016657600080fd5b5061017a610175366004610997565b6102a8565b6040519081526020015b60405180910390f35b34801561019957600080fd5b506101ad6101a8366004610997565b61035e565b6040519015158152602001610184565b6101d06101cb3660046109e1565b6103b1565b005b3480156101de57600080fd5b506101d061047d565b3480156101f357600080fd5b506000546040516001600160a01b039091168152602001610184565b34801561021b57600080fd5b506101d061022a366004610a0d565b6104e3565b34801561023b57600080fd5b506101d061024a3660046109e1565b610687565b34801561025b57600080fd5b5061026f61026a366004610a83565b610789565b60405167ffffffffffffffff9091168152602001610184565b34801561029457600080fd5b506101d06102a3366004610b30565b6107e2565b600080826040516020016102bc9190610b8c565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103575760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610109565b9392505050565b600080826040516020016103729190610b8c565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103a95750428111155b949350505050565b6000341180156103c057508034145b6104325760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610109565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146104d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6104e160006108c4565b565b6000546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b60006105498242610c8c565b905060008360405160200161055e9190610b8c565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156105f95760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610109565b600081815260016020908152604082208490556002919061061c90870187610b30565b6001600160a01b0316815260208101919091526040016000908120906106486080870160608801610ca4565b63ffffffff1681526020808201929092526040016000908120805460018101825590825291902085916004020161067f8282610e81565b505050505050565b6000546001600160a01b031633146106e15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461072e576040519150601f19603f3d011682016040523d82523d6000602084013e610733565b606091505b50509050806107845760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610109565b505050565b600061079433610921565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef775937338288888888886040516107d19796959493929190610f9f565b60405180910390a195945050505050565b6000546001600160a01b0316331461083c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6001600160a01b0381166108b85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610109565b6108c1816108c4565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff1691600191906109548385610fff565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c0828403121561099157600080fd5b50919050565b6000602082840312156109a957600080fd5b813567ffffffffffffffff8111156109c057600080fd5b6103a98482850161097f565b6001600160a01b03811681146108c157600080fd5b600080604083850312156109f457600080fd5b82356109ff816109cc565b946020939093013593505050565b60008060408385031215610a2057600080fd5b823567ffffffffffffffff811115610a3757600080fd5b610a438582860161097f565b95602094909401359450505050565b63ffffffff811681146108c157600080fd5b60ff811681146108c157600080fd5b8035610a7e81610a64565b919050565b600080600080600060808688031215610a9b57600080fd5b8535610aa681610a52565b94506020860135610ab681610a52565b9350604086013567ffffffffffffffff80821115610ad357600080fd5b818801915088601f830112610ae757600080fd5b813581811115610af657600080fd5b896020828501011115610b0857600080fd5b6020830195508094505050506060860135610b2281610a64565b809150509295509295909350565b600060208284031215610b4257600080fd5b8135610357816109cc565b67ffffffffffffffff811681146108c157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610b9d816109cc565b6001600160a01b0381166020840152506020830135610bbb81610b4d565b67ffffffffffffffff808216604085015260408501359150610bdc82610a52565b63ffffffff808316606086015260608601359250610bf983610a52565b80831660808601525060808501359150601e19853603018212610c1b57600080fd5b90840190813581811115610c2e57600080fd5b803603861315610c3d57600080fd5b60c060a0860152610c5560e086018260208601610b63565b92505050610c6560a08501610a73565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610c9f57610c9f610c76565b500190565b600060208284031215610cb657600080fd5b813561035781610a52565b60008135610cce81610a52565b92915050565b6000808335601e19843603018112610ceb57600080fd5b83018035915067ffffffffffffffff821115610d0657600080fd5b602001915036819003821315610d1b57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610d4c57607f821691505b6020821081141561099157634e487b7160e01b600052602260045260246000fd5b601f82111561078457600081815260208120601f850160051c81016020861015610d945750805b601f850160051c820191505b8181101561067f57828155600101610da0565b67ffffffffffffffff831115610dcb57610dcb610d22565b610ddf83610dd98354610d38565b83610d6d565b6000601f841160018114610e135760008515610dfb5750838201355b600019600387901b1c1916600186901b178355610e6d565b600083815260209020601f19861690835b82811015610e445786850135825560209485019460019092019101610e24565b5086821015610e615760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610cce81610a64565b8135610e8c816109cc565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff1982161783556020840135610ec481610b4d565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff0000000000000000000000000000000000000000000000000000000081848285161717855560408601359250610f2283610a52565b921760e09190911b909116178155610f5a610f3f60608401610cc1565b6001830163ffffffff821663ffffffff198254161781555050565b610f676080830183610cd4565b610f75818360028601610db3565b5050610f9b610f8660a08401610e74565b6003830160ff821660ff198254161781555050565b5050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c06080830152610fe860c083018587610b63565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561102257611022610c76565b0194935050505056fea264697066735822122063109a6cdc9bbd5b431dfdf74254f19660b33a9cf39810db7a8fd6169622f75364736f6c63430008090033", } // ManagementContractABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/MessageBus/MessageBus.go b/contracts/generated/MessageBus/MessageBus.go index 9df9300e66..3e21d47a4e 100644 --- a/contracts/generated/MessageBus/MessageBus.go +++ b/contracts/generated/MessageBus/MessageBus.go @@ -41,8 +41,8 @@ type StructsCrossChainMessage struct { // MessageBusMetaData contains all meta data concerning the MessageBus contract. var MessageBusMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"LogMessagePublished\",\"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\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"getMessageTimeOfFinality\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"publishMessage\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"finalAfterTimestamp\",\"type\":\"uint256\"}],\"name\":\"storeCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"verifyMessageFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e138061007e6000396000f3fe6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146101ae5780639730886d146101d6578063b1454caa146101f6578063f2fde38b1461022f576100ec565b80630fcfbd111461013457806333a88c7214610167578063715018a614610197576100ec565b366100ec5760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f7274656400000000000000000000000000000000000000000060448201526064016100e3565b34801561014057600080fd5b5061015461014f366004610770565b61024f565b6040519081526020015b60405180910390f35b34801561017357600080fd5b50610187610182366004610770565b610305565b604051901515815260200161015e565b3480156101a357600080fd5b506101ac610358565b005b3480156101ba57600080fd5b506000546040516001600160a01b03909116815260200161015e565b3480156101e257600080fd5b506101ac6101f13660046107a5565b6103be565b34801561020257600080fd5b5061021661021136600461081b565b610562565b60405167ffffffffffffffff909116815260200161015e565b34801561023b57600080fd5b506101ac61024a3660046108dd565b6105bb565b600080826040516020016102639190610939565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806102fe5760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e0000000000000000000000000000000000000000000000000000000000000060648201526084016100e3565b9392505050565b600080826040516020016103199190610939565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103505750428111155b949350505050565b6000546001600160a01b031633146103b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b6103bc600061069d565b565b6000546001600160a01b031633146104185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b60006104248242610a39565b90506000836040516020016104399190610939565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156104d45760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f210000000000000000000000000000000000000000000000000000000000000060648201526084016100e3565b60008181526001602090815260408220849055600291906104f7908701876108dd565b6001600160a01b0316815260208101919091526040016000908120906105236080870160608801610a51565b63ffffffff1681526020808201929092526040016000908120805460018101825590825291902085916004020161055a8282610c33565b505050505050565b600061056d336106fa565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef775937338288888888886040516105aa9796959493929190610d51565b60405180910390a195945050505050565b6000546001600160a01b031633146106155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016100e3565b6001600160a01b0381166106915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016100e3565b61069a8161069d565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff16916001919061072d8385610db1565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c0828403121561076a57600080fd5b50919050565b60006020828403121561078257600080fd5b813567ffffffffffffffff81111561079957600080fd5b61035084828501610758565b600080604083850312156107b857600080fd5b823567ffffffffffffffff8111156107cf57600080fd5b6107db85828601610758565b95602094909401359450505050565b63ffffffff8116811461069a57600080fd5b60ff8116811461069a57600080fd5b8035610816816107fc565b919050565b60008060008060006080868803121561083357600080fd5b853561083e816107ea565b9450602086013561084e816107ea565b9350604086013567ffffffffffffffff8082111561086b57600080fd5b818801915088601f83011261087f57600080fd5b81358181111561088e57600080fd5b8960208285010111156108a057600080fd5b60208301955080945050505060608601356108ba816107fc565b809150509295509295909350565b6001600160a01b038116811461069a57600080fd5b6000602082840312156108ef57600080fd5b81356102fe816108c8565b67ffffffffffffffff8116811461069a57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000823561094a816108c8565b6001600160a01b0381166020840152506020830135610968816108fa565b67ffffffffffffffff808216604085015260408501359150610989826107ea565b63ffffffff8083166060860152606086013592506109a6836107ea565b80831660808601525060808501359150601e198536030182126109c857600080fd5b908401908135818111156109db57600080fd5b8036038613156109ea57600080fd5b60c060a0860152610a0260e086018260208601610910565b92505050610a1260a0850161080b565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610a4c57610a4c610a23565b500190565b600060208284031215610a6357600080fd5b81356102fe816107ea565b60008135610a7b816107ea565b92915050565b6000808335601e19843603018112610a9857600080fd5b83018035915067ffffffffffffffff821115610ab357600080fd5b602001915036819003821315610ac857600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610af957607f821691505b6020821081141561076a57634e487b7160e01b600052602260045260246000fd5b601f821115610b6057600081815260208120601f850160051c81016020861015610b415750805b601f850160051c820191505b8181101561055a57828155600101610b4d565b505050565b67ffffffffffffffff831115610b7d57610b7d610acf565b610b9183610b8b8354610ae5565b83610b1a565b6000601f841160018114610bc55760008515610bad5750838201355b600019600387901b1c1916600186901b178355610c1f565b600083815260209020601f19861690835b82811015610bf65786850135825560209485019460019092019101610bd6565b5086821015610c135760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610a7b816107fc565b8135610c3e816108c8565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff1982161783556020840135610c76816108fa565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff0000000000000000000000000000000000000000000000000000000081848285161717855560408601359250610cd4836107ea565b921760e09190911b909116178155610d0c610cf160608401610a6e565b6001830163ffffffff821663ffffffff198254161781555050565b610d196080830183610a81565b610d27818360028601610b65565b5050610d4d610d3860a08401610c26565b6003830160ff821660ff198254161781555050565b5050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c06080830152610d9a60c083018587610910565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff808316818516808303821115610dd457610dd4610a23565b0194935050505056fea2646970667358221220e790a069b7a49368e0f1c281855881b133f1eac9bbac989876cb3bc659282fbe64736f6c63430008090033", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"LogMessagePublished\",\"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\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ValueTransfer\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"getMessageTimeOfFinality\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"publishMessage\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveValueFromL2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sendValueToL2\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"finalAfterTimestamp\",\"type\":\"uint256\"}],\"name\":\"storeCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"verifyMessageFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6110618061007e6000396000f3fe60806040526004361061009a5760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad211461022f578063b1454caa1461024f578063f2fde38b1461028857610112565b80638da5cb5b146101e75780639730886d1461020f57610112565b80630fcfbd111461015a57806333a88c721461018d578063346633fb146101bd578063715018a6146101d257610112565b366101125760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f727465640000000000000000000000000000000000000000006044820152606401610109565b34801561016657600080fd5b5061017a610175366004610997565b6102a8565b6040519081526020015b60405180910390f35b34801561019957600080fd5b506101ad6101a8366004610997565b61035e565b6040519015158152602001610184565b6101d06101cb3660046109e1565b6103b1565b005b3480156101de57600080fd5b506101d061047d565b3480156101f357600080fd5b506000546040516001600160a01b039091168152602001610184565b34801561021b57600080fd5b506101d061022a366004610a0d565b6104e3565b34801561023b57600080fd5b506101d061024a3660046109e1565b610687565b34801561025b57600080fd5b5061026f61026a366004610a83565b610789565b60405167ffffffffffffffff9091168152602001610184565b34801561029457600080fd5b506101d06102a3366004610b30565b6107e2565b600080826040516020016102bc9190610b8c565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103575760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610109565b9392505050565b600080826040516020016103729190610b8c565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103a95750428111155b949350505050565b6000341180156103c057508034145b6104325760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610109565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146104d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6104e160006108c4565b565b6000546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b60006105498242610c8c565b905060008360405160200161055e9190610b8c565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156105f95760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610109565b600081815260016020908152604082208490556002919061061c90870187610b30565b6001600160a01b0316815260208101919091526040016000908120906106486080870160608801610ca4565b63ffffffff1681526020808201929092526040016000908120805460018101825590825291902085916004020161067f8282610e81565b505050505050565b6000546001600160a01b031633146106e15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461072e576040519150601f19603f3d011682016040523d82523d6000602084013e610733565b606091505b50509050806107845760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610109565b505050565b600061079433610921565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef775937338288888888886040516107d19796959493929190610f9f565b60405180910390a195945050505050565b6000546001600160a01b0316331461083c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610109565b6001600160a01b0381166108b85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610109565b6108c1816108c4565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff1691600191906109548385610fff565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c0828403121561099157600080fd5b50919050565b6000602082840312156109a957600080fd5b813567ffffffffffffffff8111156109c057600080fd5b6103a98482850161097f565b6001600160a01b03811681146108c157600080fd5b600080604083850312156109f457600080fd5b82356109ff816109cc565b946020939093013593505050565b60008060408385031215610a2057600080fd5b823567ffffffffffffffff811115610a3757600080fd5b610a438582860161097f565b95602094909401359450505050565b63ffffffff811681146108c157600080fd5b60ff811681146108c157600080fd5b8035610a7e81610a64565b919050565b600080600080600060808688031215610a9b57600080fd5b8535610aa681610a52565b94506020860135610ab681610a52565b9350604086013567ffffffffffffffff80821115610ad357600080fd5b818801915088601f830112610ae757600080fd5b813581811115610af657600080fd5b896020828501011115610b0857600080fd5b6020830195508094505050506060860135610b2281610a64565b809150509295509295909350565b600060208284031215610b4257600080fd5b8135610357816109cc565b67ffffffffffffffff811681146108c157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610b9d816109cc565b6001600160a01b0381166020840152506020830135610bbb81610b4d565b67ffffffffffffffff808216604085015260408501359150610bdc82610a52565b63ffffffff808316606086015260608601359250610bf983610a52565b80831660808601525060808501359150601e19853603018212610c1b57600080fd5b90840190813581811115610c2e57600080fd5b803603861315610c3d57600080fd5b60c060a0860152610c5560e086018260208601610b63565b92505050610c6560a08501610a73565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610c9f57610c9f610c76565b500190565b600060208284031215610cb657600080fd5b813561035781610a52565b60008135610cce81610a52565b92915050565b6000808335601e19843603018112610ceb57600080fd5b83018035915067ffffffffffffffff821115610d0657600080fd5b602001915036819003821315610d1b57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610d4c57607f821691505b6020821081141561099157634e487b7160e01b600052602260045260246000fd5b601f82111561078457600081815260208120601f850160051c81016020861015610d945750805b601f850160051c820191505b8181101561067f57828155600101610da0565b67ffffffffffffffff831115610dcb57610dcb610d22565b610ddf83610dd98354610d38565b83610d6d565b6000601f841160018114610e135760008515610dfb5750838201355b600019600387901b1c1916600186901b178355610e6d565b600083815260209020601f19861690835b82811015610e445786850135825560209485019460019092019101610e24565b5086821015610e615760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610cce81610a64565b8135610e8c816109cc565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff1982161783556020840135610ec481610b4d565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff0000000000000000000000000000000000000000000000000000000081848285161717855560408601359250610f2283610a52565b921760e09190911b909116178155610f5a610f3f60608401610cc1565b6001830163ffffffff821663ffffffff198254161781555050565b610f676080830183610cd4565b610f75818360028601610db3565b5050610f9b610f8660a08401610e74565b6003830160ff821660ff198254161781555050565b5050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c06080830152610fe860c083018587610b63565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561102257611022610c76565b0194935050505056fea264697066735822122063109a6cdc9bbd5b431dfdf74254f19660b33a9cf39810db7a8fd6169622f75364736f6c63430008090033", } // MessageBusABI is the input ABI used to generate the binding from. @@ -326,6 +326,27 @@ func (_MessageBus *MessageBusTransactorSession) PublishMessage(nonce uint32, top return _MessageBus.Contract.PublishMessage(&_MessageBus.TransactOpts, nonce, topic, payload, consistencyLevel) } +// ReceiveValueFromL2 is a paid mutator transaction binding the contract method 0x99a3ad21. +// +// Solidity: function receiveValueFromL2(address receiver, uint256 amount) returns() +func (_MessageBus *MessageBusTransactor) ReceiveValueFromL2(opts *bind.TransactOpts, receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.contract.Transact(opts, "receiveValueFromL2", receiver, amount) +} + +// ReceiveValueFromL2 is a paid mutator transaction binding the contract method 0x99a3ad21. +// +// Solidity: function receiveValueFromL2(address receiver, uint256 amount) returns() +func (_MessageBus *MessageBusSession) ReceiveValueFromL2(receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.Contract.ReceiveValueFromL2(&_MessageBus.TransactOpts, receiver, amount) +} + +// ReceiveValueFromL2 is a paid mutator transaction binding the contract method 0x99a3ad21. +// +// Solidity: function receiveValueFromL2(address receiver, uint256 amount) returns() +func (_MessageBus *MessageBusTransactorSession) ReceiveValueFromL2(receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.Contract.ReceiveValueFromL2(&_MessageBus.TransactOpts, receiver, amount) +} + // RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. // // Solidity: function renounceOwnership() returns() @@ -347,6 +368,27 @@ func (_MessageBus *MessageBusTransactorSession) RenounceOwnership() (*types.Tran return _MessageBus.Contract.RenounceOwnership(&_MessageBus.TransactOpts) } +// SendValueToL2 is a paid mutator transaction binding the contract method 0x346633fb. +// +// Solidity: function sendValueToL2(address receiver, uint256 amount) payable returns() +func (_MessageBus *MessageBusTransactor) SendValueToL2(opts *bind.TransactOpts, receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.contract.Transact(opts, "sendValueToL2", receiver, amount) +} + +// SendValueToL2 is a paid mutator transaction binding the contract method 0x346633fb. +// +// Solidity: function sendValueToL2(address receiver, uint256 amount) payable returns() +func (_MessageBus *MessageBusSession) SendValueToL2(receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.Contract.SendValueToL2(&_MessageBus.TransactOpts, receiver, amount) +} + +// SendValueToL2 is a paid mutator transaction binding the contract method 0x346633fb. +// +// Solidity: function sendValueToL2(address receiver, uint256 amount) payable returns() +func (_MessageBus *MessageBusTransactorSession) SendValueToL2(receiver common.Address, amount *big.Int) (*types.Transaction, error) { + return _MessageBus.Contract.SendValueToL2(&_MessageBus.TransactOpts, receiver, amount) +} + // StoreCrossChainMessage is a paid mutator transaction binding the contract method 0x9730886d. // // Solidity: function storeCrossChainMessage((address,uint64,uint32,uint32,bytes,uint8) crossChainMessage, uint256 finalAfterTimestamp) returns() @@ -722,3 +764,139 @@ func (_MessageBus *MessageBusFilterer) ParseOwnershipTransferred(log types.Log) event.Raw = log return event, nil } + +// MessageBusValueTransferIterator is returned from FilterValueTransfer and is used to iterate over the raw logs and unpacked data for ValueTransfer events raised by the MessageBus contract. +type MessageBusValueTransferIterator struct { + Event *MessageBusValueTransfer // 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 *MessageBusValueTransferIterator) 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(MessageBusValueTransfer) + 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(MessageBusValueTransfer) + 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 *MessageBusValueTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MessageBusValueTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MessageBusValueTransfer represents a ValueTransfer event raised by the MessageBus contract. +type MessageBusValueTransfer struct { + Sender common.Address + Receiver common.Address + Amount *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValueTransfer is a free log retrieval operation binding the contract event 0xf1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a1560. +// +// Solidity: event ValueTransfer(address sender, address receiver, uint256 amount) +func (_MessageBus *MessageBusFilterer) FilterValueTransfer(opts *bind.FilterOpts) (*MessageBusValueTransferIterator, error) { + + logs, sub, err := _MessageBus.contract.FilterLogs(opts, "ValueTransfer") + if err != nil { + return nil, err + } + return &MessageBusValueTransferIterator{contract: _MessageBus.contract, event: "ValueTransfer", logs: logs, sub: sub}, nil +} + +// WatchValueTransfer is a free log subscription operation binding the contract event 0xf1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a1560. +// +// Solidity: event ValueTransfer(address sender, address receiver, uint256 amount) +func (_MessageBus *MessageBusFilterer) WatchValueTransfer(opts *bind.WatchOpts, sink chan<- *MessageBusValueTransfer) (event.Subscription, error) { + + logs, sub, err := _MessageBus.contract.WatchLogs(opts, "ValueTransfer") + 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(MessageBusValueTransfer) + if err := _MessageBus.contract.UnpackLog(event, "ValueTransfer", 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 +} + +// ParseValueTransfer is a log parse operation binding the contract event 0xf1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a1560. +// +// Solidity: event ValueTransfer(address sender, address receiver, uint256 amount) +func (_MessageBus *MessageBusFilterer) ParseValueTransfer(log types.Log) (*MessageBusValueTransfer, error) { + event := new(MessageBusValueTransfer) + if err := _MessageBus.contract.UnpackLog(event, "ValueTransfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/generated/ObsERC20/ObsERC20.go b/contracts/generated/ObsERC20/ObsERC20.go index ceeb461384..c12d5386a5 100644 --- a/contracts/generated/ObsERC20/ObsERC20.go +++ b/contracts/generated/ObsERC20/ObsERC20.go @@ -32,7 +32,7 @@ var ( // ObsERC20MetaData contains all meta data concerning the ObsERC20 contract. var ObsERC20MetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b5060405162000da838038062000da88339810160408190526200005a9162000207565b8151829082906200007390600390602085019062000094565b5080516200008990600490602084019062000094565b5050505050620002ae565b828054620000a29062000271565b90600052602060002090601f016020900481019282620000c6576000855562000111565b82601f10620000e157805160ff191683800117855562000111565b8280016001018555821562000111579182015b8281111562000111578251825591602001919060010190620000f4565b506200011f92915062000123565b5090565b5b808211156200011f576000815560010162000124565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200016257600080fd5b81516001600160401b03808211156200017f576200017f6200013a565b604051601f8301601f19908116603f01168101908282118183101715620001aa57620001aa6200013a565b81604052838152602092508683858801011115620001c757600080fd5b600091505b83821015620001eb5785820183015181830184015290820190620001cc565b83821115620001fd5760008385830101525b9695505050505050565b600080604083850312156200021b57600080fd5b82516001600160401b03808211156200023357600080fd5b620002418683870162000150565b935060208501519150808211156200025857600080fd5b50620002678582860162000150565b9150509250929050565b600181811c908216806200028657607f821691505b60208210811415620002a857634e487b7160e01b600052602260045260246000fd5b50919050565b610aea80620002be6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610171578063a9059cbb14610184578063dd62ed3e1461019757600080fd5b8063395093511461014357806370a082311461015657806395d89b411461016957600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101aa565b6040516100e39190610927565b60405180910390f35b6100ff6100fa366004610998565b61023c565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f3660046109c2565b610256565b604051601281526020016100e3565b6100ff610151366004610998565b61027a565b6101136101643660046109fe565b6102b9565b6100d6610366565b6100ff61017f366004610998565b610375565b6100ff610192366004610998565b61041f565b6101136101a5366004610a20565b61042d565b6060600380546101b990610a53565b80601f01602080910402602001604051908101604052809291908181526020018280546101e590610a53565b80156102325780601f1061020757610100808354040283529160200191610232565b820191906000526020600020905b81548152906001019060200180831161021557829003601f168201915b5050505050905090565b60003361024a81858561053e565b60019150505b92915050565b600033610264858285610696565b61026f858585610710565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061024a90829086906102b4908790610a8e565b61053e565b6000326001600160a01b03831614156102ea576001600160a01b038216600090815260208190526040902054610250565b336001600160a01b0383161415610319576001600160a01b038216600090815260208190526040902054610250565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e63650060448201526064015b60405180910390fd5b6060600480546101b990610a53565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156104125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161035d565b61026f828686840361053e565b60003361024a818585610710565b6000326001600160a01b038416148061044e5750326001600160a01b038316145b15610481576001600160a01b038084166000908152600160209081526040808320938616835292905220545b9050610250565b336001600160a01b03841614806104a05750336001600160a01b038316145b156104d0576001600160a01b0380841660009081526001602090815260408083209386168352929052205461047a565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f6500000000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0383166105b95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0382166106355760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006106a2848461042d565b9050600019811461070a57818110156106fd5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161035d565b61070a848484840361053e565b50505050565b6001600160a01b03831661078c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0382166108085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b038316600090815260208190526040902054818110156108975760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906108ce908490610a8e565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161091a91815260200190565b60405180910390a361070a565b600060208083528351808285015260005b8181101561095457858101830151858201604001528201610938565b81811115610966576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461099357600080fd5b919050565b600080604083850312156109ab57600080fd5b6109b48361097c565b946020939093013593505050565b6000806000606084860312156109d757600080fd5b6109e08461097c565b92506109ee6020850161097c565b9150604084013590509250925092565b600060208284031215610a1057600080fd5b610a198261097c565b9392505050565b60008060408385031215610a3357600080fd5b610a3c8361097c565b9150610a4a6020840161097c565b90509250929050565b600181811c90821680610a6757607f821691505b60208210811415610a8857634e487b7160e01b600052602260045260246000fd5b50919050565b60008219821115610aaf57634e487b7160e01b600052601160045260246000fd5b50019056fea264697066735822122067ce0e5cfaecc7b81a06d0323f4293a9025d590255a84fde406570e5e6d996af64736f6c63430008090033", + Bin: "0x6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b5060405162000da838038062000da88339810160408190526200005a9162000207565b8151829082906200007390600390602085019062000094565b5080516200008990600490602084019062000094565b5050505050620002ae565b828054620000a29062000271565b90600052602060002090601f016020900481019282620000c6576000855562000111565b82601f10620000e157805160ff191683800117855562000111565b8280016001018555821562000111579182015b8281111562000111578251825591602001919060010190620000f4565b506200011f92915062000123565b5090565b5b808211156200011f576000815560010162000124565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200016257600080fd5b81516001600160401b03808211156200017f576200017f6200013a565b604051601f8301601f19908116603f01168101908282118183101715620001aa57620001aa6200013a565b81604052838152602092508683858801011115620001c757600080fd5b600091505b83821015620001eb5785820183015181830184015290820190620001cc565b83821115620001fd5760008385830101525b9695505050505050565b600080604083850312156200021b57600080fd5b82516001600160401b03808211156200023357600080fd5b620002418683870162000150565b935060208501519150808211156200025857600080fd5b50620002678582860162000150565b9150509250929050565b600181811c908216806200028657607f821691505b60208210811415620002a857634e487b7160e01b600052602260045260246000fd5b50919050565b610aea80620002be6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610171578063a9059cbb14610184578063dd62ed3e1461019757600080fd5b8063395093511461014357806370a082311461015657806395d89b411461016957600080fd5b806318160ddd116100b257806318160ddd1461010f57806323b872dd14610121578063313ce5671461013457600080fd5b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101aa565b6040516100e39190610927565b60405180910390f35b6100ff6100fa366004610998565b61023c565b60405190151581526020016100e3565b6002545b6040519081526020016100e3565b6100ff61012f3660046109c2565b610256565b604051601281526020016100e3565b6100ff610151366004610998565b61027a565b6101136101643660046109fe565b6102b9565b6100d6610366565b6100ff61017f366004610998565b610375565b6100ff610192366004610998565b61041f565b6101136101a5366004610a20565b61042d565b6060600380546101b990610a53565b80601f01602080910402602001604051908101604052809291908181526020018280546101e590610a53565b80156102325780601f1061020757610100808354040283529160200191610232565b820191906000526020600020905b81548152906001019060200180831161021557829003601f168201915b5050505050905090565b60003361024a81858561053e565b60019150505b92915050565b600033610264858285610696565b61026f858585610710565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061024a90829086906102b4908790610a8e565b61053e565b6000326001600160a01b03831614156102ea576001600160a01b038216600090815260208190526040902054610250565b336001600160a01b0383161415610319576001600160a01b038216600090815260208190526040902054610250565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e63650060448201526064015b60405180910390fd5b6060600480546101b990610a53565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156104125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161035d565b61026f828686840361053e565b60003361024a818585610710565b6000326001600160a01b038416148061044e5750326001600160a01b038316145b15610481576001600160a01b038084166000908152600160209081526040808320938616835292905220545b9050610250565b336001600160a01b03841614806104a05750336001600160a01b038316145b156104d0576001600160a01b0380841660009081526001602090815260408083209386168352929052205461047a565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f6500000000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0383166105b95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0382166106355760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006106a2848461042d565b9050600019811461070a57818110156106fd5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161035d565b61070a848484840361053e565b50505050565b6001600160a01b03831661078c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b0382166108085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b038316600090815260208190526040902054818110156108975760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161035d565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906108ce908490610a8e565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161091a91815260200190565b60405180910390a361070a565b600060208083528351808285015260005b8181101561095457858101830151858201604001528201610938565b81811115610966576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461099357600080fd5b919050565b600080604083850312156109ab57600080fd5b6109b48361097c565b946020939093013593505050565b6000806000606084860312156109d757600080fd5b6109e08461097c565b92506109ee6020850161097c565b9150604084013590509250925092565b600060208284031215610a1057600080fd5b610a198261097c565b9392505050565b60008060408385031215610a3357600080fd5b610a3c8361097c565b9150610a4a6020840161097c565b90509250929050565b600181811c90821680610a6757607f821691505b60208210811415610a8857634e487b7160e01b600052602260045260246000fd5b50919050565b60008219821115610aaf57634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220f6355dc25e10a7a88f5076ae4378073f41fca54f570f8ebea7ef5d68bcd1d47b64736f6c63430008090033", } // ObsERC20ABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/ObscuroBridge/ObscuroBridge.go b/contracts/generated/ObscuroBridge/ObscuroBridge.go index 7976c056b0..d292b65a17 100644 --- a/contracts/generated/ObscuroBridge/ObscuroBridge.go +++ b/contracts/generated/ObscuroBridge/ObscuroBridge.go @@ -32,7 +32,7 @@ var ( // ObscuroBridgeMetaData contains all meta data concerning the ObscuroBridge contract. var ObscuroBridgeMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"messenger\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC20_TOKEN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_TOKEN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"promoteToAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"receiveAssets\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"}],\"name\":\"removeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"sendERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"sendNative\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"}],\"name\":\"setRemoteBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"name\":\"whitelistToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040526001805463ffffffff60a01b191690553480156200002157600080fd5b5060405162001bb338038062001bb38339810160408190526200004491620001fc565b600080546001600160a01b0319166001600160a01b038316908117909155604080516350d113fd60e11b8152905183929163a1a227fa916004808301926020929190829003018186803b1580156200009b57600080fd5b505afa158015620000b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d69190620001fc565b600180546001600160a01b0319166001600160a01b039290921691909117905550620001237fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753362000157565b620001507fd2fb17ceaa388942529b17e0006ffc4d559f040dd4f2157b8070f17ad2110578600062000157565b506200022e565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16620001f85760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000602082840312156200020f57600080fd5b81516001600160a01b03811681146200022757600080fd5b9392505050565b611975806200023e6000396000f3fe60806040526004361061010e5760003560e01c80635fa7b584116100a557806393b3744211610074578063a381c8e211610059578063a381c8e21461033e578063d547741f1461035e578063e4c3ebc71461037e57600080fd5b806393b3744214610309578063a217fddf1461032957600080fd5b80635fa7b5841461024f57806375b238fc1461026f57806383bece4d146102a357806391d14854146102c357600080fd5b80632f2ff15d116100e15780632f2ff15d146101bb57806336568abe146101db578063498d82ab146101fb5780635d8729701461021b57600080fd5b806301ffc9a71461011357806316ce8149146101485780631888d7121461016a578063248a9ca31461017d575b600080fd5b34801561011f57600080fd5b5061013361012e366004611477565b6103b2565b60405190151581526020015b60405180910390f35b34801561015457600080fd5b506101686101633660046114b9565b61041b565b005b6101686101783660046114b9565b610481565b34801561018957600080fd5b506101ad6101983660046114d6565b60009081526002602052604090206001015490565b60405190815260200161013f565b3480156101c757600080fd5b506101686101d63660046114ef565b610543565b3480156101e757600080fd5b506101686101f63660046114ef565b61056e565b34801561020757600080fd5b50610168610216366004611568565b6105f6565b34801561022757600080fd5b506101ad7f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a81565b34801561025b57600080fd5b5061016861026a3660046114b9565b6106c4565b34801561027b57600080fd5b506101ad7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b3480156102af57600080fd5b506101686102be3660046115eb565b610719565b3480156102cf57600080fd5b506101336102de3660046114ef565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561031557600080fd5b506101686103243660046114b9565b61093c565b34801561033557600080fd5b506101ad600081565b34801561034a57600080fd5b506101686103593660046115eb565b610991565b34801561036a57600080fd5b506101686103793660046114ef565b610b25565b34801561038a57600080fd5b506101ad7fd2fb17ceaa388942529b17e0006ffc4d559f040dd4f2157b8070f17ad211057881565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061041557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104468133610b4b565b50600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600034116104d65760405162461bcd60e51b815260206004820152600f60248201527f456d707479207472616e736665722e000000000000000000000000000000000060448201526064015b60405180910390fd5b604080516000602482018190523460448301526001600160a01b038481166064808501919091528451808503909101815260849093019093526020820180516001600160e01b03166383bece4d60e01b179052600354919261053f92169083905b600080610bcb565b5050565b60008281526002602052604090206001015461055f8133610b4b565b6105698383610ce6565b505050565b6001600160a01b03811633146105ec5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016104cd565b61053f8282610d88565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106218133610b4b565b61064b7f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a87610ce6565b600063458ffd6360e01b878787878760405160240161066e959493929190611656565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526003549091506106bb906001600160a01b0316826001610537565b50505050505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756106ef8133610b4b565b61053f7f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a83610d88565b6003546000546001600160a01b03918216911633146107a05760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e676572210000000000000000000000000000000060648201526084016104cd565b806001600160a01b03166107b2610e0b565b6001600160a01b03161461082e5760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e6465722100000000000000000000000000000060648201526084016104cd565b6001600160a01b03841660009081527f32ef73018533fa188e9e42b313c0a4048c6052342b662fb7510c0d1abcea3413602052604090205460ff161561087e57610879848484610e97565b610936565b6001600160a01b03841660009081527f13ad2d85210d477fe1a6e25654c8250308cf29b050a4bf0b039d70467486712c602052604090205460ff16156108c8576108798383610ea2565b60405162461bcd60e51b815260206004820152602560248201527f417474656d7074696e6720746f20776974686472617720756e6b6e6f776e206160448201527f737365742e00000000000000000000000000000000000000000000000000000060648201526084016104cd565b50505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756109678133610b4b565b61053f7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583610ce6565b600082116109e15760405162461bcd60e51b815260206004820152601a60248201527f417474656d7074696e6720656d707479207472616e736665722e00000000000060448201526064016104cd565b6001600160a01b03831660009081527f32ef73018533fa188e9e42b313c0a4048c6052342b662fb7510c0d1abcea3413602052604090205460ff16610ab45760405162461bcd60e51b815260206004820152604e60248201527f54686973206164647265737320686173206e6f74206265656e20676976656e2060448201527f61207479706520616e64206973207468757320636f6e73696465726564206e6f60648201527f742077686974656c69737465642e000000000000000000000000000000000000608482015260a4016104cd565b610ac083333085610f45565b604080516001600160a01b038581166024830152604482018590528381166064808401919091528351808403909101815260849092019092526020810180516001600160e01b03166383bece4d60e01b17905260035490916109369116826000610537565b600082815260026020526040902060010154610b418133610b4b565b6105698383610d88565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff1661053f57610b89816001600160a01b03166014610fc9565b610b94836020610fc9565b604051602001610ba59291906116c4565b60408051601f198184030181529082905262461bcd60e51b82526104cd91600401611771565b60006040518060600160405280876001600160a01b0316815260200186815260200184815250604051602001610c019190611784565b60408051808303601f19018152919052600180549192506001600160a01b0382169163b1454caa917401000000000000000000000000000000000000000090910463ffffffff16906014610c54836117df565b91906101000a81548163ffffffff021916908363ffffffff1602179055508684866040518563ffffffff1660e01b8152600401610c949493929190611803565b602060405180830381600087803b158015610cae57600080fd5b505af1158015610cc2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bb9190611840565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff1661053f5760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610d443390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff161561053f5760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166363012de56040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5a57600080fd5b505afa158015610e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e92919061186a565b905090565b6105698382846111b1565b6000816001600160a01b03168360405160006040518083038185875af1925050503d8060008114610eef576040519150601f19603f3d011682016040523d82523d6000602084013e610ef4565b606091505b50509050806105695760405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e6420457468657200000000000000000000000060448201526064016104cd565b6040516001600160a01b03808516602483015283166044820152606481018290526109369085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526111fa565b60606000610fd8836002611887565b610fe39060026118a6565b67ffffffffffffffff811115610ffb57610ffb6118be565b6040519080825280601f01601f191660200182016040528015611025576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061105c5761105c6118d4565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106110a7576110a76118d4565b60200101906001600160f81b031916908160001a90535060006110cb846002611887565b6110d69060016118a6565b90505b600181111561115b577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611117576111176118d4565b1a60f81b82828151811061112d5761112d6118d4565b60200101906001600160f81b031916908160001a90535060049490941c93611154816118ea565b90506110d9565b5083156111aa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104cd565b9392505050565b6040516001600160a01b0383166024820152604481018290526105699084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610f92565b600061124f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166112df9092919063ffffffff16565b805190915015610569578080602001905181019061126d9190611901565b6105695760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104cd565b60606112ee84846000856112f6565b949350505050565b60608247101561136e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016104cd565b6001600160a01b0385163b6113c55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104cd565b600080866001600160a01b031685876040516113e19190611923565b60006040518083038185875af1925050503d806000811461141e576040519150601f19603f3d011682016040523d82523d6000602084013e611423565b606091505b509150915061143382828661143e565b979650505050505050565b6060831561144d5750816111aa565b82511561145d5782518084602001fd5b8160405162461bcd60e51b81526004016104cd9190611771565b60006020828403121561148957600080fd5b81356001600160e01b0319811681146111aa57600080fd5b6001600160a01b03811681146114b657600080fd5b50565b6000602082840312156114cb57600080fd5b81356111aa816114a1565b6000602082840312156114e857600080fd5b5035919050565b6000806040838503121561150257600080fd5b823591506020830135611514816114a1565b809150509250929050565b60008083601f84011261153157600080fd5b50813567ffffffffffffffff81111561154957600080fd5b60208301915083602082850101111561156157600080fd5b9250929050565b60008060008060006060868803121561158057600080fd5b853561158b816114a1565b9450602086013567ffffffffffffffff808211156115a857600080fd5b6115b489838a0161151f565b909650945060408801359150808211156115cd57600080fd5b506115da8882890161151f565b969995985093965092949392505050565b60008060006060848603121561160057600080fd5b833561160b816114a1565b9250602084013591506040840135611622816114a1565b809150509250925092565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b038616815260606020820152600061167960608301868861162d565b828103604084015261168c81858761162d565b98975050505050505050565b60005b838110156116b357818101518382015260200161169b565b838111156109365750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516116fc816017850160208801611698565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611739816028840160208801611698565b01602801949350505050565b6000815180845261175d816020860160208601611698565b601f01601f19169290920160200192915050565b6020815260006111aa6020830184611745565b602081526001600160a01b03825116602082015260006020830151606060408401526117b36080840182611745565b9050604084015160608401528091505092915050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff808316818114156117f9576117f96117c9565b6001019392505050565b600063ffffffff80871683528086166020840152506080604083015261182c6080830185611745565b905060ff8316606083015295945050505050565b60006020828403121561185257600080fd5b815167ffffffffffffffff811681146111aa57600080fd5b60006020828403121561187c57600080fd5b81516111aa816114a1565b60008160001904831182151516156118a1576118a16117c9565b500290565b600082198211156118b9576118b96117c9565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816118f9576118f96117c9565b506000190190565b60006020828403121561191357600080fd5b815180151581146111aa57600080fd5b60008251611935818460208701611698565b919091019291505056fea2646970667358221220db09595d8f197db3ddd74dca401a535afe66fc3eb46b53e2d55e8c732bd0083664736f6c63430008090033", + Bin: "0x60806040526001805463ffffffff60a01b191690553480156200002157600080fd5b5060405162001c3838038062001c388339810160408190526200004491620001fc565b600080546001600160a01b0319166001600160a01b038316908117909155604080516350d113fd60e11b8152905183929163a1a227fa916004808301926020929190829003018186803b1580156200009b57600080fd5b505afa158015620000b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d69190620001fc565b600180546001600160a01b0319166001600160a01b039290921691909117905550620001237fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753362000157565b620001507fd2fb17ceaa388942529b17e0006ffc4d559f040dd4f2157b8070f17ad2110578600062000157565b506200022e565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16620001f85760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000602082840312156200020f57600080fd5b81516001600160a01b03811681146200022757600080fd5b9392505050565b6119fa806200023e6000396000f3fe60806040526004361061010e5760003560e01c80635fa7b584116100a557806393b3744211610074578063a381c8e211610059578063a381c8e21461033e578063d547741f1461035e578063e4c3ebc71461037e57600080fd5b806393b3744214610309578063a217fddf1461032957600080fd5b80635fa7b5841461024f57806375b238fc1461026f57806383bece4d146102a357806391d14854146102c357600080fd5b80632f2ff15d116100e15780632f2ff15d146101bb57806336568abe146101db578063498d82ab146101fb5780635d8729701461021b57600080fd5b806301ffc9a71461011357806316ce8149146101485780631888d7121461016a578063248a9ca31461017d575b600080fd5b34801561011f57600080fd5b5061013361012e3660046114fc565b6103b2565b60405190151581526020015b60405180910390f35b34801561015457600080fd5b5061016861016336600461153e565b61041b565b005b61016861017836600461153e565b610481565b34801561018957600080fd5b506101ad61019836600461155b565b60009081526002602052604090206001015490565b60405190815260200161013f565b3480156101c757600080fd5b506101686101d6366004611574565b6105ba565b3480156101e757600080fd5b506101686101f6366004611574565b6105e5565b34801561020757600080fd5b506101686102163660046115ed565b610671565b34801561022757600080fd5b506101ad7f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a81565b34801561025b57600080fd5b5061016861026a36600461153e565b610736565b34801561027b57600080fd5b506101ad7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b3480156102af57600080fd5b506101686102be366004611670565b61078b565b3480156102cf57600080fd5b506101336102de366004611574565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561031557600080fd5b5061016861032436600461153e565b6109ad565b34801561033557600080fd5b506101ad600081565b34801561034a57600080fd5b50610168610359366004611670565b610a02565b34801561036a57600080fd5b50610168610379366004611574565b610baf565b34801561038a57600080fd5b506101ad7fd2fb17ceaa388942529b17e0006ffc4d559f040dd4f2157b8070f17ad211057881565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061041557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104468133610bd5565b50600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600034116104d65760405162461bcd60e51b815260206004820152600f60248201527f456d707479207472616e736665722e000000000000000000000000000000000060448201526064015b60405180910390fd5b604080518082018252348082526001600160a01b03848116602093840190815284519384019290925290518116828401528251808303840181526060909201909252600354909161052e91168260025b600080610c55565b6001546001600160a01b03166040517f346633fb0000000000000000000000000000000000000000000000000000000081526001600160a01b038481166004830152346024830181905292169163346633fb916044016000604051808303818588803b15801561059d57600080fd5b505af11580156105b1573d6000803e3d6000fd5b50505050505050565b6000828152600260205260409020600101546105d68133610bd5565b6105e08383610d70565b505050565b6001600160a01b03811633146106635760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084016104cd565b61066d8282610e12565b5050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177561069c8133610bd5565b6106c67f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a87610d70565b600063458ffd6360e01b87878787876040516024016106e99594939291906116db565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526003549091506105b1906001600160a01b0316826001610526565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756107618133610bd5565b61066d7f9f225881f6e7ac8a885b63aa2269cbce78dd6a669864ccd2cd2517a8e709d73a83610e12565b6003546000546001600160a01b03918216911633146108125760405162461bcd60e51b815260206004820152603060248201527f436f6e74726163742063616c6c6572206973206e6f742074686520726567697360448201527f7465726564206d657373656e676572210000000000000000000000000000000060648201526084016104cd565b806001600160a01b0316610824610e95565b6001600160a01b0316146108a05760405162461bcd60e51b815260206004820152603160248201527f43726f737320636861696e206d65737361676520636f6d696e672066726f6d2060448201527f696e636f72726563742073656e6465722100000000000000000000000000000060648201526084016104cd565b6001600160a01b03841660009081527f32ef73018533fa188e9e42b313c0a4048c6052342b662fb7510c0d1abcea3413602052604090205460ff16156108f0576108eb848484610f21565b6109a7565b6001600160a01b03841660009081527f13ad2d85210d477fe1a6e25654c8250308cf29b050a4bf0b039d70467486712c602052604090205460ff1615610939576108eb82610f2c565b60405162461bcd60e51b815260206004820152602560248201527f417474656d7074696e6720746f20776974686472617720756e6b6e6f776e206160448201527f737365742e00000000000000000000000000000000000000000000000000000060648201526084016104cd565b50505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756109d88133610bd5565b61066d7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177583610d70565b60008211610a525760405162461bcd60e51b815260206004820152601a60248201527f417474656d7074696e6720656d707479207472616e736665722e00000000000060448201526064016104cd565b6001600160a01b03831660009081527f32ef73018533fa188e9e42b313c0a4048c6052342b662fb7510c0d1abcea3413602052604090205460ff16610b255760405162461bcd60e51b815260206004820152604e60248201527f54686973206164647265737320686173206e6f74206265656e20676976656e2060448201527f61207479706520616e64206973207468757320636f6e73696465726564206e6f60648201527f742077686974656c69737465642e000000000000000000000000000000000000608482015260a4016104cd565b610b3183333085610fca565b604080516001600160a01b038581166024830152604482018590528381166064808401919091528351808403909101815260849092019092526020810180516001600160e01b03167f83bece4d0000000000000000000000000000000000000000000000000000000017905260035490916109a79116826000610526565b600082815260026020526040902060010154610bcb8133610bd5565b6105e08383610e12565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff1661066d57610c13816001600160a01b0316601461104e565b610c1e83602061104e565b604051602001610c2f929190611749565b60408051601f198184030181529082905262461bcd60e51b82526104cd916004016117f6565b60006040518060600160405280876001600160a01b0316815260200186815260200184815250604051602001610c8b9190611809565b60408051808303601f19018152919052600180549192506001600160a01b0382169163b1454caa917401000000000000000000000000000000000000000090910463ffffffff16906014610cde83611864565b91906101000a81548163ffffffff021916908363ffffffff1602179055508684866040518563ffffffff1660e01b8152600401610d1e9493929190611888565b602060405180830381600087803b158015610d3857600080fd5b505af1158015610d4c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b191906118c5565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff1661066d5760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610dce3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff161561066d5760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166363012de56040518163ffffffff1660e01b815260040160206040518083038186803b158015610ee457600080fd5b505afa158015610ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1c91906118ef565b905090565b6105e0838284611236565b6040516000906001600160a01b038316908281818181865af19150503d8060008114610f74576040519150601f19603f3d011682016040523d82523d6000602084013e610f79565b606091505b505090508061066d5760405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e6420457468657200000000000000000000000060448201526064016104cd565b6040516001600160a01b03808516602483015283166044820152606481018290526109a79085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261127f565b6060600061105d83600261190c565b61106890600261192b565b67ffffffffffffffff81111561108057611080611943565b6040519080825280601f01601f1916602001820160405280156110aa576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106110e1576110e1611959565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061112c5761112c611959565b60200101906001600160f81b031916908160001a905350600061115084600261190c565b61115b90600161192b565b90505b60018111156111e0577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061119c5761119c611959565b1a60f81b8282815181106111b2576111b2611959565b60200101906001600160f81b031916908160001a90535060049490941c936111d98161196f565b905061115e565b50831561122f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104cd565b9392505050565b6040516001600160a01b0383166024820152604481018290526105e09084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611017565b60006112d4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113649092919063ffffffff16565b8051909150156105e057808060200190518101906112f29190611986565b6105e05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104cd565b6060611373848460008561137b565b949350505050565b6060824710156113f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016104cd565b6001600160a01b0385163b61144a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104cd565b600080866001600160a01b0316858760405161146691906119a8565b60006040518083038185875af1925050503d80600081146114a3576040519150601f19603f3d011682016040523d82523d6000602084013e6114a8565b606091505b50915091506114b88282866114c3565b979650505050505050565b606083156114d257508161122f565b8251156114e25782518084602001fd5b8160405162461bcd60e51b81526004016104cd91906117f6565b60006020828403121561150e57600080fd5b81356001600160e01b03198116811461122f57600080fd5b6001600160a01b038116811461153b57600080fd5b50565b60006020828403121561155057600080fd5b813561122f81611526565b60006020828403121561156d57600080fd5b5035919050565b6000806040838503121561158757600080fd5b82359150602083013561159981611526565b809150509250929050565b60008083601f8401126115b657600080fd5b50813567ffffffffffffffff8111156115ce57600080fd5b6020830191508360208285010111156115e657600080fd5b9250929050565b60008060008060006060868803121561160557600080fd5b853561161081611526565b9450602086013567ffffffffffffffff8082111561162d57600080fd5b61163989838a016115a4565b9096509450604088013591508082111561165257600080fd5b5061165f888289016115a4565b969995985093965092949392505050565b60008060006060848603121561168557600080fd5b833561169081611526565b92506020840135915060408401356116a781611526565b809150509250925092565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082015260006116fe6060830186886116b2565b82810360408401526117118185876116b2565b98975050505050505050565b60005b83811015611738578181015183820152602001611720565b838111156109a75750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161178181601785016020880161171d565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516117be81602884016020880161171d565b01602801949350505050565b600081518084526117e281602086016020860161171d565b601f01601f19169290920160200192915050565b60208152600061122f60208301846117ca565b602081526001600160a01b038251166020820152600060208301516060604084015261183860808401826117ca565b9050604084015160608401528091505092915050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff8083168181141561187e5761187e61184e565b6001019392505050565b600063ffffffff8087168352808616602084015250608060408301526118b160808301856117ca565b905060ff8316606083015295945050505050565b6000602082840312156118d757600080fd5b815167ffffffffffffffff8116811461122f57600080fd5b60006020828403121561190157600080fd5b815161122f81611526565b60008160001904831182151516156119265761192661184e565b500290565b6000821982111561193e5761193e61184e565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008161197e5761197e61184e565b506000190190565b60006020828403121561199857600080fd5b8151801515811461122f57600080fd5b600082516119ba81846020870161171d565b919091019291505056fea26469706673582212206391571edec7bdbf99c2274c97a0cf208d149bda11b9144eb6f7eeff314c453264736f6c63430008090033", } // ObscuroBridgeABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/WrappedERC20/WrappedERC20.go b/contracts/generated/WrappedERC20/WrappedERC20.go index 347b1c03f1..658dbb7682 100644 --- a/contracts/generated/WrappedERC20/WrappedERC20.go +++ b/contracts/generated/WrappedERC20/WrappedERC20.go @@ -32,7 +32,7 @@ var ( // WrappedERC20MetaData contains all meta data concerning the WrappedERC20 contract. var WrappedERC20MetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"giver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"issueFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b50604051620019d7380380620019d78339810160408190526200005a91620002e3565b8181818181600390805190602001906200007692919062000170565b5080516200008c90600490602084019062000170565b5050505050620000c37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177533620000cb60201b60201c565b50506200038a565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166200016c5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200012b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b8280546200017e906200034d565b90600052602060002090601f016020900481019282620001a25760008555620001ed565b82601f10620001bd57805160ff1916838001178555620001ed565b82800160010185558215620001ed579182015b82811115620001ed578251825591602001919060010190620001d0565b50620001fb929150620001ff565b5090565b5b80821115620001fb576000815560010162000200565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023e57600080fd5b81516001600160401b03808211156200025b576200025b62000216565b604051601f8301601f19908116603f0116810190828211818310171562000286576200028662000216565b81604052838152602092508683858801011115620002a357600080fd5b600091505b83821015620002c75785820183015181830184015290820190620002a8565b83821115620002d95760008385830101525b9695505050505050565b60008060408385031215620002f757600080fd5b82516001600160401b03808211156200030f57600080fd5b6200031d868387016200022c565b935060208501519150808211156200033457600080fd5b5062000343858286016200022c565b9150509250929050565b600181811c908216806200036257607f821691505b602082108114156200038457634e487b7160e01b600052602260045260246000fd5b50919050565b61163d806200039a6000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806339509351116100d8578063979005ad1161008c578063a9059cbb11610066578063a9059cbb1461031a578063d547741f1461032d578063dd62ed3e1461034057600080fd5b8063979005ad146102ec578063a217fddf146102ff578063a457c2d71461030757600080fd5b806375b238fc116100bd57806375b238fc1461028457806391d14854146102ab57806395d89b41146102e457600080fd5b8063395093511461025e57806370a082311461027157600080fd5b806323b872dd1161012f5780632f2ff15d116101145780632f2ff15d14610229578063313ce5671461023c57806336568abe1461024b57600080fd5b806323b872dd146101f3578063248a9ca31461020657600080fd5b8063095ea7b311610160578063095ea7b3146101b957806318160ddd146101cc5780631dd319cb146101de57600080fd5b806301ffc9a71461017c57806306fdde03146101a4575b600080fd5b61018f61018a3660046112f7565b610353565b60405190151581526020015b60405180910390f35b6101ac6103ec565b60405161019b9190611365565b61018f6101c73660046113b4565b61047e565b6002545b60405190815260200161019b565b6101f16101ec3660046113b4565b610496565b005b61018f6102013660046113de565b61052d565b6101d061021436600461141a565b60009081526007602052604090206001015490565b6101f1610237366004611433565b610551565b6040516012815260200161019b565b6101f1610259366004611433565b610577565b61018f61026c3660046113b4565b610603565b6101d061027f36600461145f565b610642565b6101d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61018f6102b9366004611433565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101ac6106ea565b6101f16102fa3660046113b4565b6106f9565b6101d0600081565b61018f6103153660046113b4565b61072e565b61018f6103283660046113b4565b6107d8565b6101f161033b366004611433565b6107e6565b6101d061034e36600461147a565b61080c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806103e657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600380546103fb906114a4565b80601f0160208091040260200160405190810160405280929190818152602001828054610427906114a4565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60003361048c81858561091d565b5060019392505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104c18133610a75565b816104cb84610642565b101561051e5760405162461bcd60e51b815260206004820152601560248201527f496e73756666696369656e742062616c616e63652e000000000000000000000060448201526064015b60405180910390fd5b6105288383610af5565b505050565b60003361053b858285610c7a565b610546858585610cf4565b506001949350505050565b60008281526007602052604090206001015461056d8133610a75565b6105288383610f0b565b6001600160a01b03811633146105f55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610515565b6105ff8282610fad565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061048c908290869061063d9087906114f5565b61091d565b6000326001600160a01b0383161415610673576001600160a01b0382166000908152602081905260409020546103e6565b336001600160a01b03831614156106a2576001600160a01b0382166000908152602081905260409020546103e6565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e6365006044820152606401610515565b6060600480546103fb906114a4565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756107248133610a75565b6105288383611030565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107cb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610515565b610546828686840361091d565b60003361048c818585610cf4565b6000828152600760205260409020600101546108028133610a75565b6105288383610fad565b6000326001600160a01b038416148061082d5750326001600160a01b038316145b15610860576001600160a01b038084166000908152600160209081526040808320938616835292905220545b90506103e6565b336001600160a01b038416148061087f5750336001600160a01b038316145b156108af576001600160a01b03808416600090815260016020908152604080832093861683529290522054610859565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166109985760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610a145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff57610ab3816001600160a01b0316601461110f565b610abe83602061110f565b604051602001610acf92919061150d565b60408051601f198184030181529082905262461bcd60e51b825261051591600401611365565b6001600160a01b038216610b715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03821660009081526020819052604090205481811015610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c2f90849061158e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610c86848461080c565b90506000198114610cee5781811015610ce15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610515565b610cee848484840361091d565b50505050565b6001600160a01b038316610d705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610dec5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03831660009081526020819052604090205481811015610e7b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610eb29084906114f5565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610efe91815260200190565b60405180910390a3610cee565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16156105ff5760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166110865760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610515565b806002600082825461109891906114f5565b90915550506001600160a01b038216600090815260208190526040812080548392906110c59084906114f5565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060600061111e8360026115a5565b6111299060026114f5565b67ffffffffffffffff811115611141576111416115c4565b6040519080825280601f01601f19166020018201604052801561116b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106111a2576111a26115da565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111ed576111ed6115da565b60200101906001600160f81b031916908160001a90535060006112118460026115a5565b61121c9060016114f5565b90505b60018111156112a1577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061125d5761125d6115da565b1a60f81b828281518110611273576112736115da565b60200101906001600160f81b031916908160001a90535060049490941c9361129a816115f0565b905061121f565b5083156112f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610515565b9392505050565b60006020828403121561130957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f057600080fd5b60005b8381101561135457818101518382015260200161133c565b83811115610cee5750506000910152565b6020815260008251806020840152611384816040850160208701611339565b601f01601f19169190910160400192915050565b80356001600160a01b03811681146113af57600080fd5b919050565b600080604083850312156113c757600080fd5b6113d083611398565b946020939093013593505050565b6000806000606084860312156113f357600080fd5b6113fc84611398565b925061140a60208501611398565b9150604084013590509250925092565b60006020828403121561142c57600080fd5b5035919050565b6000806040838503121561144657600080fd5b8235915061145660208401611398565b90509250929050565b60006020828403121561147157600080fd5b6112f082611398565b6000806040838503121561148d57600080fd5b61149683611398565b915061145660208401611398565b600181811c908216806114b857607f821691505b602082108114156114d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611508576115086114df565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611545816017850160208801611339565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611582816028840160208801611339565b01602801949350505050565b6000828210156115a0576115a06114df565b500390565b60008160001904831182151516156115bf576115bf6114df565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816115ff576115ff6114df565b50600019019056fea26469706673582212203d4cd3ed17d72b2f94aa2bf3da11f2d447bbf1eab55024ccf72a1f938cbe214064736f6c63430008090033", + Bin: "0x6080604052600580546001600160a01b03191673deb34a740eca1ec42c8b8204cbec0ba34fdd27f31790553480156200003757600080fd5b50604051620019d7380380620019d78339810160408190526200005a91620002e3565b8181818181600390805190602001906200007692919062000170565b5080516200008c90600490602084019062000170565b5050505050620000c37fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177533620000cb60201b60201c565b50506200038a565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166200016c5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200012b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b8280546200017e906200034d565b90600052602060002090601f016020900481019282620001a25760008555620001ed565b82601f10620001bd57805160ff1916838001178555620001ed565b82800160010185558215620001ed579182015b82811115620001ed578251825591602001919060010190620001d0565b50620001fb929150620001ff565b5090565b5b80821115620001fb576000815560010162000200565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023e57600080fd5b81516001600160401b03808211156200025b576200025b62000216565b604051601f8301601f19908116603f0116810190828211818310171562000286576200028662000216565b81604052838152602092508683858801011115620002a357600080fd5b600091505b83821015620002c75785820183015181830184015290820190620002a8565b83821115620002d95760008385830101525b9695505050505050565b60008060408385031215620002f757600080fd5b82516001600160401b03808211156200030f57600080fd5b6200031d868387016200022c565b935060208501519150808211156200033457600080fd5b5062000343858286016200022c565b9150509250929050565b600181811c908216806200036257607f821691505b602082108114156200038457634e487b7160e01b600052602260045260246000fd5b50919050565b61163d806200039a6000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806339509351116100d8578063979005ad1161008c578063a9059cbb11610066578063a9059cbb1461031a578063d547741f1461032d578063dd62ed3e1461034057600080fd5b8063979005ad146102ec578063a217fddf146102ff578063a457c2d71461030757600080fd5b806375b238fc116100bd57806375b238fc1461028457806391d14854146102ab57806395d89b41146102e457600080fd5b8063395093511461025e57806370a082311461027157600080fd5b806323b872dd1161012f5780632f2ff15d116101145780632f2ff15d14610229578063313ce5671461023c57806336568abe1461024b57600080fd5b806323b872dd146101f3578063248a9ca31461020657600080fd5b8063095ea7b311610160578063095ea7b3146101b957806318160ddd146101cc5780631dd319cb146101de57600080fd5b806301ffc9a71461017c57806306fdde03146101a4575b600080fd5b61018f61018a3660046112f7565b610353565b60405190151581526020015b60405180910390f35b6101ac6103ec565b60405161019b9190611365565b61018f6101c73660046113b4565b61047e565b6002545b60405190815260200161019b565b6101f16101ec3660046113b4565b610496565b005b61018f6102013660046113de565b61052d565b6101d061021436600461141a565b60009081526007602052604090206001015490565b6101f1610237366004611433565b610551565b6040516012815260200161019b565b6101f1610259366004611433565b610577565b61018f61026c3660046113b4565b610603565b6101d061027f36600461145f565b610642565b6101d07fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177581565b61018f6102b9366004611433565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101ac6106ea565b6101f16102fa3660046113b4565b6106f9565b6101d0600081565b61018f6103153660046113b4565b61072e565b61018f6103283660046113b4565b6107d8565b6101f161033b366004611433565b6107e6565b6101d061034e36600461147a565b61080c565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806103e657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600380546103fb906114a4565b80601f0160208091040260200160405190810160405280929190818152602001828054610427906114a4565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60003361048c81858561091d565b5060019392505050565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756104c18133610a75565b816104cb84610642565b101561051e5760405162461bcd60e51b815260206004820152601560248201527f496e73756666696369656e742062616c616e63652e000000000000000000000060448201526064015b60405180910390fd5b6105288383610af5565b505050565b60003361053b858285610c7a565b610546858585610cf4565b506001949350505050565b60008281526007602052604090206001015461056d8133610a75565b6105288383610f0b565b6001600160a01b03811633146105f55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610515565b6105ff8282610fad565b5050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061048c908290869061063d9087906114f5565b61091d565b6000326001600160a01b0383161415610673576001600160a01b0382166000908152602081905260409020546103e6565b336001600160a01b03831614156106a2576001600160a01b0382166000908152602081905260409020546103e6565b60405162461bcd60e51b815260206004820152601f60248201527f4e6f7420616c6c6f77656420746f2072656164207468652062616c616e6365006044820152606401610515565b6060600480546103fb906114a4565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756107248133610a75565b6105288383611030565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107cb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610515565b610546828686840361091d565b60003361048c818585610cf4565b6000828152600760205260409020600101546108028133610a75565b6105288383610fad565b6000326001600160a01b038416148061082d5750326001600160a01b038316145b15610860576001600160a01b038084166000908152600160209081526040808320938616835292905220545b90506103e6565b336001600160a01b038416148061087f5750336001600160a01b038316145b156108af576001600160a01b03808416600090815260016020908152604080832093861683529290522054610859565b60405162461bcd60e51b815260206004820152602160248201527f4e6f7420616c6c6f77656420746f20726561642074686520616c6c6f77616e6360448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166109985760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610a145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff57610ab3816001600160a01b0316601461110f565b610abe83602061110f565b604051602001610acf92919061150d565b60408051601f198184030181529082905262461bcd60e51b825261051591600401611365565b6001600160a01b038216610b715760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03821660009081526020819052604090205481811015610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c2f90849061158e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000610c86848461080c565b90506000198114610cee5781811015610ce15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610515565b610cee848484840361091d565b50505050565b6001600160a01b038316610d705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b038216610dec5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03831660009081526020819052604090205481811015610e7b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610515565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610eb29084906114f5565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610efe91815260200190565b60405180910390a3610cee565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166105ff5760008281526007602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f693390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16156105ff5760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166110865760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610515565b806002600082825461109891906114f5565b90915550506001600160a01b038216600090815260208190526040812080548392906110c59084906114f5565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6060600061111e8360026115a5565b6111299060026114f5565b67ffffffffffffffff811115611141576111416115c4565b6040519080825280601f01601f19166020018201604052801561116b576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106111a2576111a26115da565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106111ed576111ed6115da565b60200101906001600160f81b031916908160001a90535060006112118460026115a5565b61121c9060016114f5565b90505b60018111156112a1577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061125d5761125d6115da565b1a60f81b828281518110611273576112736115da565b60200101906001600160f81b031916908160001a90535060049490941c9361129a816115f0565b905061121f565b5083156112f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610515565b9392505050565b60006020828403121561130957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f057600080fd5b60005b8381101561135457818101518382015260200161133c565b83811115610cee5750506000910152565b6020815260008251806020840152611384816040850160208701611339565b601f01601f19169190910160400192915050565b80356001600160a01b03811681146113af57600080fd5b919050565b600080604083850312156113c757600080fd5b6113d083611398565b946020939093013593505050565b6000806000606084860312156113f357600080fd5b6113fc84611398565b925061140a60208501611398565b9150604084013590509250925092565b60006020828403121561142c57600080fd5b5035919050565b6000806040838503121561144657600080fd5b8235915061145660208401611398565b90509250929050565b60006020828403121561147157600080fd5b6112f082611398565b6000806040838503121561148d57600080fd5b61149683611398565b915061145660208401611398565b600181811c908216806114b857607f821691505b602082108114156114d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611508576115086114df565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611545816017850160208801611339565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351611582816028840160208801611339565b01602801949350505050565b6000828210156115a0576115a06114df565b500390565b60008160001904831182151516156115bf576115bf6114df565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816115ff576115ff6114df565b50600019019056fea2646970667358221220848f35fdc28f22577d7d393858f44350cbde245dc770487cf991c8a21210b53864736f6c63430008090033", } // WrappedERC20ABI is the input ABI used to generate the binding from. diff --git a/contracts/src/bridge/IBridge.sol b/contracts/src/bridge/IBridge.sol index 411e01d077..ffdd3c0a22 100644 --- a/contracts/src/bridge/IBridge.sol +++ b/contracts/src/bridge/IBridge.sol @@ -7,7 +7,8 @@ pragma solidity >=0.7.0 <0.9.0; interface IBridge { enum Topics { TRANSFER, - MANAGEMENT + MANAGEMENT, + VALUE } // Sends the native currency to the other layer. On Layer 1 the native currency is ETH, while on Layer 2 it is OBX. @@ -35,4 +36,9 @@ interface IBridge { uint256 amount, address receiver ) external; + + struct ValueTransfer { + uint256 amount; + address recipient; + } } diff --git a/contracts/src/bridge/L1/ObscuroBridge.sol b/contracts/src/bridge/L1/ObscuroBridge.sol index 9ebb931190..49714d85d8 100644 --- a/contracts/src/bridge/L1/ObscuroBridge.sol +++ b/contracts/src/bridge/L1/ObscuroBridge.sol @@ -69,16 +69,16 @@ contract ObscuroBridge is remoteBridgeAddress = bridge; } + // This cross chain message is specialized and will result in automatic increase + // of balance on the other side. + // NOTE: If sent to a contract, there will be no fallback function executed. + // Instead after the contract receives it, one can relay the cross chain message to + // verify ETH deposit. function sendNative(address receiver) external payable override { require(msg.value > 0, "Empty transfer."); - - bytes memory data = abi.encodeWithSelector( - IBridge.receiveAssets.selector, - address(0x0), - msg.value, - receiver - ); - queueMessage(remoteBridgeAddress, data, uint32(Topics.TRANSFER), 0, 0); + bytes memory data = abi.encode(ValueTransfer(msg.value, receiver)); + queueMessage(remoteBridgeAddress, data, uint32(Topics.VALUE), 0, 0); + _messageBus().sendValueToL2{value: msg.value}(receiver, msg.value); } function sendERC20( @@ -117,7 +117,7 @@ contract ObscuroBridge is if (hasRole(ERC20_TOKEN_ROLE, asset)) { _receiveTokens(asset, amount, receiver); } else if (hasRole(NATIVE_TOKEN_ROLE, asset)) { - _receiveNative(amount, receiver); + _receiveNative(receiver); } else { revert("Attempting to withdraw unknown asset."); } @@ -131,8 +131,8 @@ contract ObscuroBridge is SafeERC20.safeTransfer(IERC20(asset), receiver, amount); } - function _receiveNative(uint256 amount, address receiver) private { - (bool sent, ) = receiver.call{value: amount}(""); + function _receiveNative(address receiver) private { + (bool sent, ) = receiver.call(""); require(sent, "Failed to send Ether"); } } diff --git a/contracts/src/messaging/IMessageBus.sol b/contracts/src/messaging/IMessageBus.sol index 8d7fb20f8c..c307c33fc5 100644 --- a/contracts/src/messaging/IMessageBus.sol +++ b/contracts/src/messaging/IMessageBus.sol @@ -20,6 +20,13 @@ interface IMessageBus { uint8 consistencyLevel ); + event ValueTransfer + ( + address sender, + address receiver, + uint256 amount + ); + // This method is called from contracts to publish messages to the other linked message bus. // nonce - This is provided and serves as deduplication nonce. It can also be used to group a batch of messages together. // topic - This is the topic for which the payload is published. @@ -35,6 +42,16 @@ interface IMessageBus { uint8 consistencyLevel ) external returns (uint64 sequence); + function sendValueToL2( + address receiver, + uint256 amount + ) external payable; + + function receiveValueFromL2( + address receiver, + uint256 amount + ) external; + // This function verifies that a cross chain message provided by the caller has indeed been submitted from the other network // and returns true only if the challenge period for the message has passed. function verifyMessageFinalized(Structs.CrossChainMessage calldata crossChainMessage) external view returns (bool); diff --git a/contracts/src/messaging/MessageBus.sol b/contracts/src/messaging/MessageBus.sol index a70ad00264..e19fb2219a 100644 --- a/contracts/src/messaging/MessageBus.sol +++ b/contracts/src/messaging/MessageBus.sol @@ -30,6 +30,22 @@ contract MessageBus is IMessageBus, Ownable { addressSequences[sender] += 1; } + function sendValueToL2( + address receiver, + uint256 amount + ) external payable { + require(msg.value > 0 && msg.value == amount, "Attempting to send value without providing Ether"); + emit ValueTransfer(msg.sender, receiver, msg.value); + } + + function receiveValueFromL2( + address receiver, + uint256 amount + ) external onlyOwner { + (bool ok, ) = receiver.call{value: amount}(""); + require(ok, "failed sending value"); + } + // This method is called from contracts to publish messages to the other linked message bus. // nonce - This is provided and serves as deduplication nonce. It can also be used to group a batch of messages together. // topic - This is the topic for which the payload is published. diff --git a/contracts/src/messaging/messenger/CrossChainEnabledObscuro.sol b/contracts/src/messaging/messenger/CrossChainEnabledObscuro.sol index 837b45081b..85f486d25a 100644 --- a/contracts/src/messaging/messenger/CrossChainEnabledObscuro.sol +++ b/contracts/src/messaging/messenger/CrossChainEnabledObscuro.sol @@ -22,6 +22,10 @@ abstract contract CrossChainEnabledObscuro { return msg.sender == address(messenger); } + function _messageBus() internal view returns (IMessageBus) { + return messageBus; + } + // Returns the address of the sender of the current cross chain message. // address 0x0 is considered null/no sender. function _crossChainSender() internal view returns (address) { diff --git a/contracts/src/testing/GasConsumerBalance.sol b/contracts/src/testing/GasConsumerBalance.sol new file mode 100644 index 0000000000..3b42c3334e --- /dev/null +++ b/contracts/src/testing/GasConsumerBalance.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache 2 +pragma solidity ^0.8.0; + +contract GasConsumerBalance { + address public owner; + + constructor() { + owner = msg.sender; + } + + // solc-ignore-next-line func-mutability + function get_balance() public { address(this).balance; } + + function destroy() public { + require(msg.sender == owner, "You are not the owner"); + selfdestruct(payable(address(this))); + } +} \ No newline at end of file diff --git a/contracts/tasks/wallet-extension.ts b/contracts/tasks/wallet-extension.ts index e72702262a..82f0b927dc 100644 --- a/contracts/tasks/wallet-extension.ts +++ b/contracts/tasks/wallet-extension.ts @@ -19,9 +19,9 @@ task("obscuro:wallet-extension:start:local") .setAction(async function(args, hre) { const nodeUrl = url.parse(args.rpcUrl) - if (args.withStdOut) { +/* if (args.withStdOut) { console.log(`Node url = ${JSON.stringify(nodeUrl, null, " ")}`); - } + }*/ const walletExtensionPath = path.resolve(hre.config.paths.root, "../tools/walletextension/bin/wallet_extension_linux"); const weProcess = spawn(walletExtensionPath, [ @@ -149,6 +149,7 @@ task("obscuro:wallet-extension:add-key", "Creates a viewing key for a specifiec } }, (response)=>{ if (response.statusCode != 200) { + console.error(response); fail(response.statusCode); return; } @@ -184,6 +185,7 @@ task("obscuro:wallet-extension:add-key", "Creates a viewing key for a specifiec if (response.statusCode == 200) { resolve(response.statusCode); } else { + console.log(response.statusMessage) fail(response.statusCode); } }); diff --git a/go/common/gethencoding/geth_encoding.go b/go/common/gethencoding/geth_encoding.go index b12d2773ea..9a414a6cfb 100644 --- a/go/common/gethencoding/geth_encoding.go +++ b/go/common/gethencoding/geth_encoding.go @@ -230,6 +230,11 @@ func CreateEthHeaderForBatch(h *common.BatchHeader, secret []byte) (*types.Heade // deterministically calculate private randomness that will be exposed to the evm randomness := crypto.CalculateRootBatchEntropy(secret, h.Number) + baseFee := uint64(0) + if h.BaseFee != nil { + baseFee = h.BaseFee.Uint64() + } + return &types.Header{ ParentHash: h.ParentHash, Root: h.Root, @@ -237,9 +242,10 @@ func CreateEthHeaderForBatch(h *common.BatchHeader, secret []byte) (*types.Heade ReceiptHash: h.ReceiptHash, Difficulty: big.NewInt(0), Number: h.Number, - GasLimit: 1_000_000_000, // todo (@stefan) - gas - GasUsed: 0, // todo (@stefan) - gas - BaseFee: gethcommon.Big0, // todo (@stefan) - gas + GasLimit: h.GasLimit, + GasUsed: 0, + BaseFee: big.NewInt(0).SetUint64(baseFee), + Coinbase: h.Coinbase, Time: h.Time, MixDigest: randomness, Nonce: types.BlockNonce{}, diff --git a/go/common/headers.go b/go/common/headers.go index bcd39e2a78..820cc5adf5 100644 --- a/go/common/headers.go +++ b/go/common/headers.go @@ -23,17 +23,18 @@ var hasherPool = sync.Pool{ // BatchHeader is a public / plaintext struct that holds common properties of batches. // Making changes to this struct will require GRPC + GRPC Converters regen type BatchHeader struct { - ParentHash L2BatchHash `json:"parentHash"` - Root StateRoot `json:"stateRoot"` - TxHash common.Hash `json:"transactionsRoot"` - ReceiptHash common.Hash `json:"receiptsRoot"` - Number *big.Int `json:"number"` // height of the batch - SequencerOrderNo *big.Int `json:"sequencerOrderNo"` // multiple batches can be created with the same height in case of L1 reorgs. The sequencer is responsible for including all of them in the rollups. - GasLimit uint64 `json:"gasLimit"` - GasUsed uint64 `json:"gasUsed"` - Time uint64 `json:"timestamp"` - Extra []byte `json:"extraData"` - BaseFee *big.Int `json:"baseFee"` + ParentHash L2BatchHash `json:"parentHash"` + Root StateRoot `json:"stateRoot"` + TxHash common.Hash `json:"transactionsRoot"` + ReceiptHash common.Hash `json:"receiptsRoot"` + Number *big.Int `json:"number"` // height of the batch + SequencerOrderNo *big.Int `json:"sequencerOrderNo"` // multiple batches can be created with the same height in case of L1 reorgs. The sequencer is responsible for including all of them in the rollups. + GasLimit uint64 `json:"gasLimit"` + GasUsed uint64 `json:"gasUsed"` + Time uint64 `json:"timestamp"` + Extra []byte `json:"extraData"` + BaseFee *big.Int `json:"baseFee"` + Coinbase common.Address `json:"coinbase"` // The custom Obscuro fields. L1Proof L1BlockHash `json:"l1Proof"` // the L1 block used by the enclave to generate the current batch @@ -41,6 +42,7 @@ type BatchHeader struct { CrossChainMessages []MessageBus.StructsCrossChainMessage `json:"crossChainMessages"` LatestInboundCrossChainHash common.Hash `json:"inboundCrossChainHash"` // The block hash of the latest block that has been scanned for cross chain messages. LatestInboundCrossChainHeight *big.Int `json:"inboundCrossChainHeight"` // The block height of the latest block that has been scanned for cross chain messages. + TransfersTree common.Hash `json:"transfersTree"` // This is a merkle tree of all of the outbound value transfers for the MainNet } // MarshalJSON custom marshals the BatchHeader into a json @@ -61,11 +63,11 @@ func (b *BatchHeader) MarshalJSON() ([]byte, error) { (*Alias)(b), b.Hash(), nil, + &b.Coinbase, nil, nil, nil, - nil, - nil, + b.BaseFee, }) } @@ -90,6 +92,10 @@ type CalldataRollupHeader struct { FirstCanonBatchHeight *big.Int FirstCanonParentHash L2BatchHash + Coinbase common.Address + BaseFee *big.Int + GasLimit uint64 + StartTime uint64 BatchTimeDeltas [][]byte // todo - minimize assuming a default of 1 sec and then store only exceptions diff --git a/go/common/rpc/converters.go b/go/common/rpc/converters.go index f57eb76df8..fcfe695600 100644 --- a/go/common/rpc/converters.go +++ b/go/common/rpc/converters.go @@ -144,6 +144,8 @@ func ToBatchHeaderMsg(header *common.BatchHeader) *generated.BatchHeaderMsg { GasUsed: header.GasUsed, Time: header.Time, BaseFee: baseFee, + TransferTree: header.TransfersTree.Bytes(), + Coinbase: header.Coinbase.Bytes(), CrossChainMessages: ToCrossChainMsgs(header.CrossChainMessages), LatestInboundCrossChainHash: header.LatestInboundCrossChainHash.Bytes(), } @@ -196,7 +198,9 @@ func FromBatchHeaderMsg(header *generated.BatchHeaderMsg) *common.BatchHeader { GasLimit: header.GasLimit, GasUsed: header.GasUsed, Time: header.Time, - BaseFee: big.NewInt(int64(header.BaseFee)), + TransfersTree: gethcommon.BytesToHash(header.TransferTree), + BaseFee: big.NewInt(0).SetUint64(header.BaseFee), + Coinbase: gethcommon.BytesToAddress(header.Coinbase), CrossChainMessages: FromCrossChainMsgs(header.CrossChainMessages), LatestInboundCrossChainHash: gethcommon.BytesToHash(header.LatestInboundCrossChainHash), LatestInboundCrossChainHeight: big.NewInt(0).SetBytes(header.LatestInboundCrossChainHeight), diff --git a/go/common/rpc/generated/enclave.pb.go b/go/common/rpc/generated/enclave.pb.go index 847f1336ff..3bdf2c46a5 100644 --- a/go/common/rpc/generated/enclave.pb.go +++ b/go/common/rpc/generated/enclave.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 -// protoc v3.21.9 +// protoc-gen-go v1.31.0 +// protoc v4.23.4 // source: enclave.proto package generated @@ -3408,6 +3408,8 @@ type BatchHeaderMsg struct { LatestInboundCrossChainHeight []byte `protobuf:"bytes,15,opt,name=LatestInboundCrossChainHeight,proto3" json:"LatestInboundCrossChainHeight,omitempty"` LatestInboundCrossChainHash []byte `protobuf:"bytes,16,opt,name=LatestInboundCrossChainHash,proto3" json:"LatestInboundCrossChainHash,omitempty"` CrossChainMessages []*CrossChainMsg `protobuf:"bytes,17,rep,name=CrossChainMessages,proto3" json:"CrossChainMessages,omitempty"` + TransferTree []byte `protobuf:"bytes,18,opt,name=TransferTree,proto3" json:"TransferTree,omitempty"` + Coinbase []byte `protobuf:"bytes,19,opt,name=Coinbase,proto3" json:"Coinbase,omitempty"` } func (x *BatchHeaderMsg) Reset() { @@ -3561,6 +3563,20 @@ func (x *BatchHeaderMsg) GetCrossChainMessages() []*CrossChainMsg { return nil } +func (x *BatchHeaderMsg) GetTransferTree() []byte { + if x != nil { + return x.TransferTree + } + return nil +} + +func (x *BatchHeaderMsg) GetCoinbase() []byte { + if x != nil { + return x.Coinbase + } + return nil +} + type ExtRollupMsg struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4252,7 +4268,7 @@ var file_enclave_proto_rawDesc = []byte{ 0x72, 0x4d, 0x73, 0x67, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x74, 0x78, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x74, 0x78, 0x73, 0x22, 0xc0, 0x04, 0x0a, 0x0e, 0x42, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x74, 0x78, 0x73, 0x22, 0x80, 0x05, 0x0a, 0x0e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, @@ -4288,7 +4304,11 @@ var file_enclave_proto_rawDesc = []byte{ 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x67, 0x52, 0x12, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x9c, 0x01, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x22, 0x0a, + 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x54, 0x72, 0x65, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x13, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x52, 0x6f, 0x6c, 0x6c, 0x75, 0x70, 0x4d, 0x73, 0x67, 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x52, 0x6f, 0x6c, 0x6c, 0x75, diff --git a/go/common/rpc/generated/enclave.proto b/go/common/rpc/generated/enclave.proto index b9542a6ae1..accb141556 100644 --- a/go/common/rpc/generated/enclave.proto +++ b/go/common/rpc/generated/enclave.proto @@ -386,6 +386,8 @@ message BatchHeaderMsg { bytes LatestInboundCrossChainHeight = 15; bytes LatestInboundCrossChainHash = 16; repeated CrossChainMsg CrossChainMessages = 17; + bytes TransferTree = 18; + bytes Coinbase = 19; } message ExtRollupMsg { diff --git a/go/common/rpc/generated/enclave_grpc.pb.go b/go/common/rpc/generated/enclave_grpc.pb.go index ce77edf796..89cb798f81 100644 --- a/go/common/rpc/generated/enclave_grpc.pb.go +++ b/go/common/rpc/generated/enclave_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.9 +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.23.4 // source: enclave.proto package generated @@ -18,6 +18,38 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + EnclaveProto_Status_FullMethodName = "/generated.EnclaveProto/Status" + EnclaveProto_Attestation_FullMethodName = "/generated.EnclaveProto/Attestation" + EnclaveProto_GenerateSecret_FullMethodName = "/generated.EnclaveProto/GenerateSecret" + EnclaveProto_InitEnclave_FullMethodName = "/generated.EnclaveProto/InitEnclave" + EnclaveProto_SubmitL1Block_FullMethodName = "/generated.EnclaveProto/SubmitL1Block" + EnclaveProto_SubmitTx_FullMethodName = "/generated.EnclaveProto/SubmitTx" + EnclaveProto_SubmitBatch_FullMethodName = "/generated.EnclaveProto/SubmitBatch" + EnclaveProto_ObsCall_FullMethodName = "/generated.EnclaveProto/ObsCall" + EnclaveProto_GetTransactionCount_FullMethodName = "/generated.EnclaveProto/GetTransactionCount" + EnclaveProto_Stop_FullMethodName = "/generated.EnclaveProto/Stop" + EnclaveProto_GetTransaction_FullMethodName = "/generated.EnclaveProto/GetTransaction" + EnclaveProto_GetTransactionReceipt_FullMethodName = "/generated.EnclaveProto/GetTransactionReceipt" + EnclaveProto_GetBalance_FullMethodName = "/generated.EnclaveProto/GetBalance" + EnclaveProto_GetCode_FullMethodName = "/generated.EnclaveProto/GetCode" + EnclaveProto_Subscribe_FullMethodName = "/generated.EnclaveProto/Subscribe" + EnclaveProto_Unsubscribe_FullMethodName = "/generated.EnclaveProto/Unsubscribe" + EnclaveProto_EstimateGas_FullMethodName = "/generated.EnclaveProto/EstimateGas" + EnclaveProto_GetLogs_FullMethodName = "/generated.EnclaveProto/GetLogs" + EnclaveProto_HealthCheck_FullMethodName = "/generated.EnclaveProto/HealthCheck" + EnclaveProto_GetBatch_FullMethodName = "/generated.EnclaveProto/GetBatch" + EnclaveProto_GetBatchBySeqNo_FullMethodName = "/generated.EnclaveProto/GetBatchBySeqNo" + EnclaveProto_CreateBatch_FullMethodName = "/generated.EnclaveProto/CreateBatch" + EnclaveProto_CreateRollup_FullMethodName = "/generated.EnclaveProto/CreateRollup" + EnclaveProto_DebugTraceTransaction_FullMethodName = "/generated.EnclaveProto/DebugTraceTransaction" + EnclaveProto_StreamL2Updates_FullMethodName = "/generated.EnclaveProto/StreamL2Updates" + EnclaveProto_DebugEventLogRelevancy_FullMethodName = "/generated.EnclaveProto/DebugEventLogRelevancy" + EnclaveProto_GetTotalContractCount_FullMethodName = "/generated.EnclaveProto/GetTotalContractCount" + EnclaveProto_GetReceiptsByAddress_FullMethodName = "/generated.EnclaveProto/GetReceiptsByAddress" + EnclaveProto_GetPublicTransactionData_FullMethodName = "/generated.EnclaveProto/GetPublicTransactionData" +) + // EnclaveProtoClient is the client API for EnclaveProto service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -31,8 +63,10 @@ type EnclaveProtoClient interface { // Init - initialise an enclave with a seed received by another enclave InitEnclave(ctx context.Context, in *InitEnclaveRequest, opts ...grpc.CallOption) (*InitEnclaveResponse, error) // SubmitL1Block - Used for the host to submit blocks to the enclave, these may be: - // a. historic block - if the enclave is behind and in the process of catching up with the L1 state - // b. the latest block published by the L1, to which the enclave should respond with a rollup + // + // a. historic block - if the enclave is behind and in the process of catching up with the L1 state + // b. the latest block published by the L1, to which the enclave should respond with a rollup + // // It is the responsibility of the host to gossip the returned rollup // For good functioning the caller should always submit blocks ordered by height // submitting a block before receiving ancestors of it, will result in it being ignored @@ -89,7 +123,7 @@ func NewEnclaveProtoClient(cc grpc.ClientConnInterface) EnclaveProtoClient { func (c *enclaveProtoClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { out := new(StatusResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/Status", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_Status_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -98,7 +132,7 @@ func (c *enclaveProtoClient) Status(ctx context.Context, in *StatusRequest, opts func (c *enclaveProtoClient) Attestation(ctx context.Context, in *AttestationRequest, opts ...grpc.CallOption) (*AttestationResponse, error) { out := new(AttestationResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/Attestation", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_Attestation_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -107,7 +141,7 @@ func (c *enclaveProtoClient) Attestation(ctx context.Context, in *AttestationReq func (c *enclaveProtoClient) GenerateSecret(ctx context.Context, in *GenerateSecretRequest, opts ...grpc.CallOption) (*GenerateSecretResponse, error) { out := new(GenerateSecretResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GenerateSecret", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GenerateSecret_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -116,7 +150,7 @@ func (c *enclaveProtoClient) GenerateSecret(ctx context.Context, in *GenerateSec func (c *enclaveProtoClient) InitEnclave(ctx context.Context, in *InitEnclaveRequest, opts ...grpc.CallOption) (*InitEnclaveResponse, error) { out := new(InitEnclaveResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/InitEnclave", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_InitEnclave_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -125,7 +159,7 @@ func (c *enclaveProtoClient) InitEnclave(ctx context.Context, in *InitEnclaveReq func (c *enclaveProtoClient) SubmitL1Block(ctx context.Context, in *SubmitBlockRequest, opts ...grpc.CallOption) (*SubmitBlockResponse, error) { out := new(SubmitBlockResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/SubmitL1Block", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_SubmitL1Block_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -134,7 +168,7 @@ func (c *enclaveProtoClient) SubmitL1Block(ctx context.Context, in *SubmitBlockR func (c *enclaveProtoClient) SubmitTx(ctx context.Context, in *SubmitTxRequest, opts ...grpc.CallOption) (*SubmitTxResponse, error) { out := new(SubmitTxResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/SubmitTx", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_SubmitTx_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -143,7 +177,7 @@ func (c *enclaveProtoClient) SubmitTx(ctx context.Context, in *SubmitTxRequest, func (c *enclaveProtoClient) SubmitBatch(ctx context.Context, in *SubmitBatchRequest, opts ...grpc.CallOption) (*SubmitBatchResponse, error) { out := new(SubmitBatchResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/SubmitBatch", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_SubmitBatch_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -152,7 +186,7 @@ func (c *enclaveProtoClient) SubmitBatch(ctx context.Context, in *SubmitBatchReq func (c *enclaveProtoClient) ObsCall(ctx context.Context, in *ObsCallRequest, opts ...grpc.CallOption) (*ObsCallResponse, error) { out := new(ObsCallResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/ObsCall", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_ObsCall_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -161,7 +195,7 @@ func (c *enclaveProtoClient) ObsCall(ctx context.Context, in *ObsCallRequest, op func (c *enclaveProtoClient) GetTransactionCount(ctx context.Context, in *GetTransactionCountRequest, opts ...grpc.CallOption) (*GetTransactionCountResponse, error) { out := new(GetTransactionCountResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetTransactionCount", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetTransactionCount_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -170,7 +204,7 @@ func (c *enclaveProtoClient) GetTransactionCount(ctx context.Context, in *GetTra func (c *enclaveProtoClient) Stop(ctx context.Context, in *StopRequest, opts ...grpc.CallOption) (*StopResponse, error) { out := new(StopResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/Stop", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_Stop_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -179,7 +213,7 @@ func (c *enclaveProtoClient) Stop(ctx context.Context, in *StopRequest, opts ... func (c *enclaveProtoClient) GetTransaction(ctx context.Context, in *GetTransactionRequest, opts ...grpc.CallOption) (*GetTransactionResponse, error) { out := new(GetTransactionResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetTransaction", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetTransaction_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -188,7 +222,7 @@ func (c *enclaveProtoClient) GetTransaction(ctx context.Context, in *GetTransact func (c *enclaveProtoClient) GetTransactionReceipt(ctx context.Context, in *GetTransactionReceiptRequest, opts ...grpc.CallOption) (*GetTransactionReceiptResponse, error) { out := new(GetTransactionReceiptResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetTransactionReceipt", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetTransactionReceipt_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -197,7 +231,7 @@ func (c *enclaveProtoClient) GetTransactionReceipt(ctx context.Context, in *GetT func (c *enclaveProtoClient) GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error) { out := new(GetBalanceResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetBalance", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetBalance_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -206,7 +240,7 @@ func (c *enclaveProtoClient) GetBalance(ctx context.Context, in *GetBalanceReque func (c *enclaveProtoClient) GetCode(ctx context.Context, in *GetCodeRequest, opts ...grpc.CallOption) (*GetCodeResponse, error) { out := new(GetCodeResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetCode", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetCode_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -215,7 +249,7 @@ func (c *enclaveProtoClient) GetCode(ctx context.Context, in *GetCodeRequest, op func (c *enclaveProtoClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) { out := new(SubscribeResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/Subscribe", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_Subscribe_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -224,7 +258,7 @@ func (c *enclaveProtoClient) Subscribe(ctx context.Context, in *SubscribeRequest func (c *enclaveProtoClient) Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*UnsubscribeResponse, error) { out := new(UnsubscribeResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/Unsubscribe", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_Unsubscribe_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -233,7 +267,7 @@ func (c *enclaveProtoClient) Unsubscribe(ctx context.Context, in *UnsubscribeReq func (c *enclaveProtoClient) EstimateGas(ctx context.Context, in *EstimateGasRequest, opts ...grpc.CallOption) (*EstimateGasResponse, error) { out := new(EstimateGasResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/EstimateGas", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_EstimateGas_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -242,7 +276,7 @@ func (c *enclaveProtoClient) EstimateGas(ctx context.Context, in *EstimateGasReq func (c *enclaveProtoClient) GetLogs(ctx context.Context, in *GetLogsRequest, opts ...grpc.CallOption) (*GetLogsResponse, error) { out := new(GetLogsResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetLogs", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetLogs_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -251,7 +285,7 @@ func (c *enclaveProtoClient) GetLogs(ctx context.Context, in *GetLogsRequest, op func (c *enclaveProtoClient) HealthCheck(ctx context.Context, in *EmptyArgs, opts ...grpc.CallOption) (*HealthCheckResponse, error) { out := new(HealthCheckResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/HealthCheck", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_HealthCheck_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -260,7 +294,7 @@ func (c *enclaveProtoClient) HealthCheck(ctx context.Context, in *EmptyArgs, opt func (c *enclaveProtoClient) GetBatch(ctx context.Context, in *GetBatchRequest, opts ...grpc.CallOption) (*GetBatchResponse, error) { out := new(GetBatchResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetBatch", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetBatch_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -269,7 +303,7 @@ func (c *enclaveProtoClient) GetBatch(ctx context.Context, in *GetBatchRequest, func (c *enclaveProtoClient) GetBatchBySeqNo(ctx context.Context, in *GetBatchBySeqNoRequest, opts ...grpc.CallOption) (*GetBatchResponse, error) { out := new(GetBatchResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetBatchBySeqNo", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetBatchBySeqNo_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -278,7 +312,7 @@ func (c *enclaveProtoClient) GetBatchBySeqNo(ctx context.Context, in *GetBatchBy func (c *enclaveProtoClient) CreateBatch(ctx context.Context, in *CreateBatchRequest, opts ...grpc.CallOption) (*CreateBatchResponse, error) { out := new(CreateBatchResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/CreateBatch", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_CreateBatch_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -287,7 +321,7 @@ func (c *enclaveProtoClient) CreateBatch(ctx context.Context, in *CreateBatchReq func (c *enclaveProtoClient) CreateRollup(ctx context.Context, in *CreateRollupRequest, opts ...grpc.CallOption) (*CreateRollupResponse, error) { out := new(CreateRollupResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/CreateRollup", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_CreateRollup_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -296,7 +330,7 @@ func (c *enclaveProtoClient) CreateRollup(ctx context.Context, in *CreateRollupR func (c *enclaveProtoClient) DebugTraceTransaction(ctx context.Context, in *DebugTraceTransactionRequest, opts ...grpc.CallOption) (*DebugTraceTransactionResponse, error) { out := new(DebugTraceTransactionResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/DebugTraceTransaction", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_DebugTraceTransaction_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -304,7 +338,7 @@ func (c *enclaveProtoClient) DebugTraceTransaction(ctx context.Context, in *Debu } func (c *enclaveProtoClient) StreamL2Updates(ctx context.Context, in *StreamL2UpdatesRequest, opts ...grpc.CallOption) (EnclaveProto_StreamL2UpdatesClient, error) { - stream, err := c.cc.NewStream(ctx, &EnclaveProto_ServiceDesc.Streams[0], "/generated.EnclaveProto/StreamL2Updates", opts...) + stream, err := c.cc.NewStream(ctx, &EnclaveProto_ServiceDesc.Streams[0], EnclaveProto_StreamL2Updates_FullMethodName, opts...) if err != nil { return nil, err } @@ -337,7 +371,7 @@ func (x *enclaveProtoStreamL2UpdatesClient) Recv() (*EncodedUpdateResponse, erro func (c *enclaveProtoClient) DebugEventLogRelevancy(ctx context.Context, in *DebugEventLogRelevancyRequest, opts ...grpc.CallOption) (*DebugEventLogRelevancyResponse, error) { out := new(DebugEventLogRelevancyResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/DebugEventLogRelevancy", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_DebugEventLogRelevancy_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -346,7 +380,7 @@ func (c *enclaveProtoClient) DebugEventLogRelevancy(ctx context.Context, in *Deb func (c *enclaveProtoClient) GetTotalContractCount(ctx context.Context, in *GetTotalContractCountRequest, opts ...grpc.CallOption) (*GetTotalContractCountResponse, error) { out := new(GetTotalContractCountResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetTotalContractCount", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetTotalContractCount_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -355,7 +389,7 @@ func (c *enclaveProtoClient) GetTotalContractCount(ctx context.Context, in *GetT func (c *enclaveProtoClient) GetReceiptsByAddress(ctx context.Context, in *GetReceiptsByAddressRequest, opts ...grpc.CallOption) (*GetReceiptsByAddressResponse, error) { out := new(GetReceiptsByAddressResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetReceiptsByAddress", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetReceiptsByAddress_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -364,7 +398,7 @@ func (c *enclaveProtoClient) GetReceiptsByAddress(ctx context.Context, in *GetRe func (c *enclaveProtoClient) GetPublicTransactionData(ctx context.Context, in *GetPublicTransactionDataRequest, opts ...grpc.CallOption) (*GetPublicTransactionDataResponse, error) { out := new(GetPublicTransactionDataResponse) - err := c.cc.Invoke(ctx, "/generated.EnclaveProto/GetPublicTransactionData", in, out, opts...) + err := c.cc.Invoke(ctx, EnclaveProto_GetPublicTransactionData_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -384,8 +418,10 @@ type EnclaveProtoServer interface { // Init - initialise an enclave with a seed received by another enclave InitEnclave(context.Context, *InitEnclaveRequest) (*InitEnclaveResponse, error) // SubmitL1Block - Used for the host to submit blocks to the enclave, these may be: - // a. historic block - if the enclave is behind and in the process of catching up with the L1 state - // b. the latest block published by the L1, to which the enclave should respond with a rollup + // + // a. historic block - if the enclave is behind and in the process of catching up with the L1 state + // b. the latest block published by the L1, to which the enclave should respond with a rollup + // // It is the responsibility of the host to gossip the returned rollup // For good functioning the caller should always submit blocks ordered by height // submitting a block before receiving ancestors of it, will result in it being ignored @@ -547,7 +583,7 @@ func _EnclaveProto_Status_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/Status", + FullMethod: EnclaveProto_Status_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).Status(ctx, req.(*StatusRequest)) @@ -565,7 +601,7 @@ func _EnclaveProto_Attestation_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/Attestation", + FullMethod: EnclaveProto_Attestation_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).Attestation(ctx, req.(*AttestationRequest)) @@ -583,7 +619,7 @@ func _EnclaveProto_GenerateSecret_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GenerateSecret", + FullMethod: EnclaveProto_GenerateSecret_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GenerateSecret(ctx, req.(*GenerateSecretRequest)) @@ -601,7 +637,7 @@ func _EnclaveProto_InitEnclave_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/InitEnclave", + FullMethod: EnclaveProto_InitEnclave_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).InitEnclave(ctx, req.(*InitEnclaveRequest)) @@ -619,7 +655,7 @@ func _EnclaveProto_SubmitL1Block_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/SubmitL1Block", + FullMethod: EnclaveProto_SubmitL1Block_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).SubmitL1Block(ctx, req.(*SubmitBlockRequest)) @@ -637,7 +673,7 @@ func _EnclaveProto_SubmitTx_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/SubmitTx", + FullMethod: EnclaveProto_SubmitTx_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).SubmitTx(ctx, req.(*SubmitTxRequest)) @@ -655,7 +691,7 @@ func _EnclaveProto_SubmitBatch_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/SubmitBatch", + FullMethod: EnclaveProto_SubmitBatch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).SubmitBatch(ctx, req.(*SubmitBatchRequest)) @@ -673,7 +709,7 @@ func _EnclaveProto_ObsCall_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/ObsCall", + FullMethod: EnclaveProto_ObsCall_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).ObsCall(ctx, req.(*ObsCallRequest)) @@ -691,7 +727,7 @@ func _EnclaveProto_GetTransactionCount_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetTransactionCount", + FullMethod: EnclaveProto_GetTransactionCount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetTransactionCount(ctx, req.(*GetTransactionCountRequest)) @@ -709,7 +745,7 @@ func _EnclaveProto_Stop_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/Stop", + FullMethod: EnclaveProto_Stop_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).Stop(ctx, req.(*StopRequest)) @@ -727,7 +763,7 @@ func _EnclaveProto_GetTransaction_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetTransaction", + FullMethod: EnclaveProto_GetTransaction_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetTransaction(ctx, req.(*GetTransactionRequest)) @@ -745,7 +781,7 @@ func _EnclaveProto_GetTransactionReceipt_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetTransactionReceipt", + FullMethod: EnclaveProto_GetTransactionReceipt_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetTransactionReceipt(ctx, req.(*GetTransactionReceiptRequest)) @@ -763,7 +799,7 @@ func _EnclaveProto_GetBalance_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetBalance", + FullMethod: EnclaveProto_GetBalance_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetBalance(ctx, req.(*GetBalanceRequest)) @@ -781,7 +817,7 @@ func _EnclaveProto_GetCode_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetCode", + FullMethod: EnclaveProto_GetCode_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetCode(ctx, req.(*GetCodeRequest)) @@ -799,7 +835,7 @@ func _EnclaveProto_Subscribe_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/Subscribe", + FullMethod: EnclaveProto_Subscribe_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).Subscribe(ctx, req.(*SubscribeRequest)) @@ -817,7 +853,7 @@ func _EnclaveProto_Unsubscribe_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/Unsubscribe", + FullMethod: EnclaveProto_Unsubscribe_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).Unsubscribe(ctx, req.(*UnsubscribeRequest)) @@ -835,7 +871,7 @@ func _EnclaveProto_EstimateGas_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/EstimateGas", + FullMethod: EnclaveProto_EstimateGas_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).EstimateGas(ctx, req.(*EstimateGasRequest)) @@ -853,7 +889,7 @@ func _EnclaveProto_GetLogs_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetLogs", + FullMethod: EnclaveProto_GetLogs_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetLogs(ctx, req.(*GetLogsRequest)) @@ -871,7 +907,7 @@ func _EnclaveProto_HealthCheck_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/HealthCheck", + FullMethod: EnclaveProto_HealthCheck_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).HealthCheck(ctx, req.(*EmptyArgs)) @@ -889,7 +925,7 @@ func _EnclaveProto_GetBatch_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetBatch", + FullMethod: EnclaveProto_GetBatch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetBatch(ctx, req.(*GetBatchRequest)) @@ -907,7 +943,7 @@ func _EnclaveProto_GetBatchBySeqNo_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetBatchBySeqNo", + FullMethod: EnclaveProto_GetBatchBySeqNo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetBatchBySeqNo(ctx, req.(*GetBatchBySeqNoRequest)) @@ -925,7 +961,7 @@ func _EnclaveProto_CreateBatch_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/CreateBatch", + FullMethod: EnclaveProto_CreateBatch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).CreateBatch(ctx, req.(*CreateBatchRequest)) @@ -943,7 +979,7 @@ func _EnclaveProto_CreateRollup_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/CreateRollup", + FullMethod: EnclaveProto_CreateRollup_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).CreateRollup(ctx, req.(*CreateRollupRequest)) @@ -961,7 +997,7 @@ func _EnclaveProto_DebugTraceTransaction_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/DebugTraceTransaction", + FullMethod: EnclaveProto_DebugTraceTransaction_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).DebugTraceTransaction(ctx, req.(*DebugTraceTransactionRequest)) @@ -1000,7 +1036,7 @@ func _EnclaveProto_DebugEventLogRelevancy_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/DebugEventLogRelevancy", + FullMethod: EnclaveProto_DebugEventLogRelevancy_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).DebugEventLogRelevancy(ctx, req.(*DebugEventLogRelevancyRequest)) @@ -1018,7 +1054,7 @@ func _EnclaveProto_GetTotalContractCount_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetTotalContractCount", + FullMethod: EnclaveProto_GetTotalContractCount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetTotalContractCount(ctx, req.(*GetTotalContractCountRequest)) @@ -1036,7 +1072,7 @@ func _EnclaveProto_GetReceiptsByAddress_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetReceiptsByAddress", + FullMethod: EnclaveProto_GetReceiptsByAddress_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetReceiptsByAddress(ctx, req.(*GetReceiptsByAddressRequest)) @@ -1054,7 +1090,7 @@ func _EnclaveProto_GetPublicTransactionData_Handler(srv interface{}, ctx context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/generated.EnclaveProto/GetPublicTransactionData", + FullMethod: EnclaveProto_GetPublicTransactionData_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnclaveProtoServer).GetPublicTransactionData(ctx, req.(*GetPublicTransactionDataRequest)) diff --git a/go/common/types.go b/go/common/types.go index 689df50feb..9fcdae1530 100644 --- a/go/common/types.go +++ b/go/common/types.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "math/big" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -43,8 +44,14 @@ type ( L2Receipt = types.Receipt L2Receipts = types.Receipts - CrossChainMessage = MessageBus.StructsCrossChainMessage - CrossChainMessages = []CrossChainMessage + CrossChainMessage = MessageBus.StructsCrossChainMessage + CrossChainMessages = []CrossChainMessage + ValueTransferEvent struct { + Sender common.Address + Receiver common.Address + Amount *big.Int + } + ValueTransferEvents = []ValueTransferEvent EncryptedTx []byte // A single transaction, encoded as a JSON list of transaction binary hexes and encrypted using the enclave's public key EncryptedTransactions []byte // A blob of encrypted transactions, as they're stored in the rollup, with the nonce prepended. diff --git a/go/config/enclave_config.go b/go/config/enclave_config.go index 9b201bfcfa..f53d59b399 100644 --- a/go/config/enclave_config.go +++ b/go/config/enclave_config.go @@ -6,6 +6,7 @@ import ( "github.com/obscuronet/go-obscuro/go/common" gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/params" "github.com/obscuronet/go-obscuro/go/common/log" gethlog "github.com/ethereum/go-ethereum/log" @@ -63,6 +64,10 @@ type EnclaveConfig struct { // a protocol limit, but a miner imposed limit and it might be hard to find someone // to include a transaction if it goes above it MaxRollupSize uint64 + + GasPaymentAddress gethcommon.Address + BaseFee *big.Int + GasLimit *big.Int } // DefaultEnclaveConfig returns an EnclaveConfig with default values. @@ -90,5 +95,8 @@ func DefaultEnclaveConfig() *EnclaveConfig { DebugNamespaceEnabled: false, MaxBatchSize: 1024 * 25, MaxRollupSize: 1024 * 64, + GasPaymentAddress: gethcommon.HexToAddress("0xa714Ae85AA66424766ba4Df364EECc43197051A6"), + BaseFee: new(big.Int).SetUint64(1), + GasLimit: new(big.Int).SetUint64(params.MaxGasLimit / 6), } } diff --git a/go/enclave/components/batch_executor.go b/go/enclave/components/batch_executor.go index 3391a44943..71bda70edd 100644 --- a/go/enclave/components/batch_executor.go +++ b/go/enclave/components/batch_executor.go @@ -1,15 +1,18 @@ package components import ( + "bytes" "errors" "fmt" "math/big" "sort" "sync" + "github.com/obscuronet/go-obscuro/go/enclave/gas" "github.com/obscuronet/go-obscuro/go/enclave/storage" gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -32,23 +35,78 @@ type batchExecutor struct { crossChainProcessors *crosschain.Processors genesis *genesis.Genesis logger gethlog.Logger + gasOracle gas.Oracle chainConfig *params.ChainConfig // stateDBMutex - used to protect calls to stateDB.Commit as it is not safe for async access. stateDBMutex sync.Mutex } -func NewBatchExecutor(storage storage.Storage, cc *crosschain.Processors, genesis *genesis.Genesis, chainConfig *params.ChainConfig, logger gethlog.Logger) BatchExecutor { +func NewBatchExecutor( + storage storage.Storage, + cc *crosschain.Processors, + genesis *genesis.Genesis, + gasOracle gas.Oracle, + chainConfig *params.ChainConfig, + logger gethlog.Logger, +) BatchExecutor { return &batchExecutor{ storage: storage, crossChainProcessors: cc, genesis: genesis, chainConfig: chainConfig, logger: logger, + gasOracle: gasOracle, stateDBMutex: sync.Mutex{}, } } +// payL1Fees - this function modifies the state db according to the transactions contained within the batch context +// in order to subtract gas fees from the balance. It returns a list of the transactions that have prepaid for their L1 +// publishing costs. +func (executor *batchExecutor) payL1Fees(stateDB *state.StateDB, context *BatchExecutionContext) (common.L2Transactions, common.L2Transactions) { + transactions := make(common.L2Transactions, 0) + freeTransactions := make(common.L2Transactions, 0) + block, _ := executor.storage.FetchBlock(context.BlockPtr) + + for _, tx := range context.Transactions { + sender, err := core.GetAuthenticatedSender(context.ChainConfig.ChainID.Int64(), tx) + if err != nil { + executor.logger.Warn("Unable to extract sender for tx", log.TxKey, tx.Hash()) + continue + } + accBalance := stateDB.GetBalance(*sender) + + cost, err := executor.gasOracle.EstimateL1StorageGasCost(tx, block) + if err != nil { + executor.logger.Warn("Unable to get gas cost for tx", log.TxKey, tx.Hash(), log.ErrKey, err) + continue + } + + // Transactions that are created inside the enclave can have no GasPrice set. + // External transactions are always required to have a gas price set. Thus we filter + // those transactions for separate processing than the normal ones and we run them through the EVM + // with a flag that disables the baseFee logic and wont fail them for having price lower than the base fee. + isFreeTransaction := tx.GasFeeCap().Cmp(gethcommon.Big0) == 0 + isFreeTransaction = isFreeTransaction && tx.GasPrice().Cmp(gethcommon.Big0) == 0 + + if isFreeTransaction { + freeTransactions = append(freeTransactions, tx) + continue + } + if accBalance.Cmp(cost) == -1 { + executor.logger.Info("insufficient account balance for tx", log.TxKey, tx.Hash(), "addr", sender.Hex()) + continue + } + stateDB.SubBalance(*sender, cost) + stateDB.AddBalance(context.Creator, cost) + // todo - add refund logic. + + transactions = append(transactions, tx) + } + return transactions, freeTransactions +} + func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext) (*ComputedBatch, error) { defer executor.logger.Info("Batch context processed", log.DurationKey, measure.NewStopwatch()) @@ -81,7 +139,7 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext) (*Co } // Create a new batch based on the fromBlock of inclusion of the previous, including all new transactions - batch := core.DeterministicEmptyBatch(parent.Header, block, context.AtTime, context.SequencerNo) + batch := core.DeterministicEmptyBatch(parent.Header, block, context.AtTime, context.SequencerNo, context.BaseFee, context.Creator) stateDB, err := executor.storage.CreateStateDB(batch.Header.ParentHash) if err != nil { @@ -89,18 +147,24 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext) (*Co } var messages common.CrossChainMessages - // Cross chain data is not accessible until one after the genesis batch + var transfers common.ValueTransferEvents if context.SequencerNo.Int64() > int64(common.L2GenesisSeqNo+1) { - messages = executor.crossChainProcessors.Local.RetrieveInboundMessages(parentBlock, block, stateDB) + messages, transfers = executor.crossChainProcessors.Local.RetrieveInboundMessages(parentBlock, block, stateDB) } + crossChainTransactions := executor.crossChainProcessors.Local.CreateSyntheticTransactions(messages, stateDB) + executor.crossChainProcessors.Local.ExecuteValueTransfers(transfers, stateDB) + + transactionsToProcess, freeTransactions := executor.payL1Fees(stateDB, context) + + crossChainTransactions = append(crossChainTransactions, freeTransactions...) - successfulTxs, txReceipts, err := executor.processTransactions(batch, 0, context.Transactions, stateDB, context.ChainConfig) + successfulTxs, txReceipts, err := executor.processTransactions(batch, 0, transactionsToProcess, stateDB, context.ChainConfig, false) if err != nil { return nil, fmt.Errorf("could not process transactions. Cause: %w", err) } - ccSuccessfulTxs, ccReceipts, err := executor.processTransactions(batch, len(successfulTxs), crossChainTransactions, stateDB, context.ChainConfig) + ccSuccessfulTxs, ccReceipts, err := executor.processTransactions(batch, len(successfulTxs), crossChainTransactions, stateDB, context.ChainConfig, true) if err != nil { return nil, err } @@ -112,7 +176,7 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext) (*Co // we need to copy the batch to reset the internal hash cache copyBatch := *batch copyBatch.Header.Root = stateDB.IntermediateRoot(false) - copyBatch.Transactions = successfulTxs + copyBatch.Transactions = append(transactionsToProcess, freeTransactions...) copyBatch.ResetHash() if err = executor.populateOutboundCrossChainData(©Batch, block, txReceipts); err != nil { @@ -137,7 +201,7 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext) (*Co defer executor.stateDBMutex.Unlock() h, err := stateDB.Commit(copyBatch.Number().Uint64(), deleteEmptyObjects) if err != nil { - return gethcommon.Hash{}, err + return gethcommon.Hash{}, fmt.Errorf("commit failure for batch %d. Cause: %w", batch.SeqNo(), err) } trieDB := executor.storage.TrieDB() err = trieDB.Commit(h, true) @@ -161,6 +225,8 @@ func (executor *batchExecutor) ExecuteBatch(batch *core.Batch) (types.Receipts, AtTime: batch.Header.Time, ChainConfig: executor.chainConfig, SequencerNo: batch.Header.SequencerOrderNo, + Creator: batch.Header.Coinbase, + BaseFee: batch.Header.BaseFee, }) if err != nil { return nil, fmt.Errorf("failed computing batch %s. Cause: %w", batch.Hash(), err) @@ -168,7 +234,7 @@ func (executor *batchExecutor) ExecuteBatch(batch *core.Batch) (types.Receipts, if cb.Batch.Hash() != batch.Hash() { // todo @stefan - generate a validator challenge here and return it - executor.logger.Error(fmt.Sprintf("Error validating batch. Calculated: %+v\n Incoming: %+v\n", cb.Batch.Header, batch.Header)) + executor.logger.Error(fmt.Sprintf("Error validating batch. Calculated: %+v Incoming: %+v\n", cb.Batch.Header, batch.Header)) return nil, fmt.Errorf("batch is in invalid state. Incoming hash: %s Computed hash: %s", batch.Hash(), cb.Batch.Hash()) } @@ -179,12 +245,36 @@ func (executor *batchExecutor) ExecuteBatch(batch *core.Batch) (types.Receipts, return cb.Receipts, nil } -func (executor *batchExecutor) CreateGenesisState(blkHash common.L1BlockHash, timeNow uint64) (*core.Batch, *types.Transaction, error) { +type ValueTransfers []common.ValueTransferEvent + +func (vt ValueTransfers) Len() int { + return len(vt) +} + +func (vt ValueTransfers) EncodeIndex(index int, w *bytes.Buffer) { + transfer := vt[index] + if err := rlp.Encode(w, transfer); err != nil { + panic(err) + } +} + +func (executor *batchExecutor) CreateGenesisState( + blkHash common.L1BlockHash, + timeNow uint64, + coinbase gethcommon.Address, + baseFee *big.Int, + gasLimit *big.Int, +) (*core.Batch, *types.Transaction, error) { preFundGenesisState, err := executor.genesis.GetGenesisRoot(executor.storage) if err != nil { return nil, nil, err } + limit := params.MaxGasLimit / 6 + if gasLimit != nil { + limit = gasLimit.Uint64() + } + genesisBatch := &core.Batch{ Header: &common.BatchHeader{ ParentHash: common.L2BatchHash{}, @@ -194,7 +284,11 @@ func (executor *batchExecutor) CreateGenesisState(blkHash common.L1BlockHash, ti Number: big.NewInt(int64(0)), SequencerOrderNo: big.NewInt(int64(common.L2GenesisSeqNo)), // genesis batch has seq number 1 ReceiptHash: types.EmptyRootHash, + TransfersTree: types.EmptyRootHash, Time: timeNow, + Coinbase: coinbase, + BaseFee: baseFee, + GasLimit: limit, // todo (@siliev) - does the batch header need uint64? }, Transactions: []*common.L2Tx{}, } @@ -205,6 +299,8 @@ func (executor *batchExecutor) CreateGenesisState(blkHash common.L1BlockHash, ti executor.logger.Crit("Could not create message bus deployment transaction", "Error", err) } + executor.logger.Info("L2 Bus deploy", log.TxKey, deployTx.Hash()) + if err = executor.genesis.CommitGenesisState(executor.storage); err != nil { return nil, nil, fmt.Errorf("could not apply genesis preallocation. Cause: %w", err) } @@ -218,7 +314,16 @@ func (executor *batchExecutor) populateOutboundCrossChainData(batch *core.Batch, return fmt.Errorf("could not extract cross chain messages. Cause: %w", err) } + valueTransferMessages, err := executor.crossChainProcessors.Local.ExtractOutboundTransfers(receipts) + if err != nil { + executor.logger.Error("Extracting messages L2->L1 failed", log.ErrKey, err, log.CmpKey, log.CrossChainCmp) + return fmt.Errorf("could not extract cross chain messages. Cause: %w", err) + } + + transfersHash := types.DeriveSha(ValueTransfers(valueTransferMessages), &trie.StackTrie{}) + batch.Header.CrossChainMessages = crossChainMessages + batch.Header.TransfersTree = transfersHash executor.logger.Trace(fmt.Sprintf("Added %d cross chain messages to batch.", len(batch.Header.CrossChainMessages)), log.CmpKey, log.CrossChainCmp) @@ -257,11 +362,11 @@ func (executor *batchExecutor) verifyInboundCrossChainTransactions(transactions return nil } -func (executor *batchExecutor) processTransactions(batch *core.Batch, tCount int, txs []*common.L2Tx, stateDB *state.StateDB, cc *params.ChainConfig) ([]*common.L2Tx, []*types.Receipt, error) { +func (executor *batchExecutor) processTransactions(batch *core.Batch, tCount int, txs []*common.L2Tx, stateDB *state.StateDB, cc *params.ChainConfig, noBaseFee bool) ([]*common.L2Tx, []*types.Receipt, error) { var executedTransactions []*common.L2Tx var txReceipts []*types.Receipt - txResults := evm.ExecuteTransactions(txs, stateDB, batch.Header, executor.storage, cc, tCount, executor.logger) + txResults := evm.ExecuteTransactions(txs, stateDB, batch.Header, executor.storage, cc, tCount, noBaseFee, executor.logger) for _, tx := range txs { result, f := txResults[tx.Hash()] if !f { diff --git a/go/enclave/components/block_processor.go b/go/enclave/components/block_processor.go index 91da7849b5..5631ee28aa 100644 --- a/go/enclave/components/block_processor.go +++ b/go/enclave/components/block_processor.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" + "github.com/obscuronet/go-obscuro/go/enclave/gas" "github.com/obscuronet/go-obscuro/go/enclave/storage" gethcommon "github.com/ethereum/go-ethereum/common" @@ -18,14 +19,16 @@ import ( type l1BlockProcessor struct { storage storage.Storage + gasOracle gas.Oracle logger gethlog.Logger crossChainProcessors *crosschain.Processors } -func NewBlockProcessor(storage storage.Storage, cc *crosschain.Processors, logger gethlog.Logger) L1BlockProcessor { +func NewBlockProcessor(storage storage.Storage, cc *crosschain.Processors, gasOracle gas.Oracle, logger gethlog.Logger) L1BlockProcessor { return &l1BlockProcessor{ storage: storage, logger: logger, + gasOracle: gasOracle, crossChainProcessors: cc, } } @@ -44,8 +47,16 @@ func (bp *l1BlockProcessor) Process(br *common.BlockAndReceipts) (*BlockIngestio if err != nil { return nil, errors.New("failed to process cross chain messages") } + + err = bp.crossChainProcessors.Remote.StoreCrossChainValueTransfers(br.Block, *br.Receipts) + if err != nil { + return nil, fmt.Errorf("failed to process cross chain transfers. Cause: %w", err) + } } + // todo @siliev - not sure if this is the best way to update the price, will pick up random stale blocks from forks? + bp.gasOracle.ProcessL1Block(br.Block) + return ingestion, nil } diff --git a/go/enclave/components/interfaces.go b/go/enclave/components/interfaces.go index 233ac98545..aff1c08da1 100644 --- a/go/enclave/components/interfaces.go +++ b/go/enclave/components/interfaces.go @@ -48,6 +48,7 @@ type BatchExecutionContext struct { Creator gethcommon.Address ChainConfig *params.ChainConfig SequencerNo *big.Int + BaseFee *big.Int } // ComputedBatch - a structure representing the result of a batch @@ -74,7 +75,7 @@ type BatchExecutor interface { // CreateGenesisState - will create and commit the genesis state in the stateDB for the given block hash, // and uint64 timestamp representing the time now. In this genesis state is where one can // find preallocated funds for faucet. TODO - make this an option - CreateGenesisState(common.L1BlockHash, uint64) (*core.Batch, *types.Transaction, error) + CreateGenesisState(common.L1BlockHash, uint64, gethcommon.Address, *big.Int, *big.Int) (*core.Batch, *types.Transaction, error) } type BatchRegistry interface { diff --git a/go/enclave/components/rollup_compression.go b/go/enclave/components/rollup_compression.go index ed7c203272..382089ac35 100644 --- a/go/enclave/components/rollup_compression.go +++ b/go/enclave/components/rollup_compression.go @@ -80,6 +80,9 @@ type batchFromRollup struct { txHash gethcommon.Hash time uint64 l1Proof common.L1BlockHash + coinbase gethcommon.Address + baseFee *big.Int + gasLimit uint64 header *common.BatchHeader // for reorgs } @@ -241,8 +244,11 @@ func (rc *RollupCompression) createRollupHeader(batches []*core.Batch) (*common. BatchTimeDeltas: timeDeltasBA, ReOrgs: reorgsBA, L1HeightDeltas: l1DeltasBA, - // BatchHashes: batchHashes, - // BatchHeaders: batchHeaders, + // BatchHashes: batchHashes, + // BatchHeaders: batchHeaders, + Coinbase: batches[0].Header.Coinbase, + BaseFee: batches[0].Header.BaseFee, + GasLimit: batches[0].Header.GasLimit, } return calldataRollupHeader, nil @@ -333,6 +339,9 @@ func (rc *RollupCompression) createIncompleteBatches(calldataRollupHeader *commo time: uint64(currentTime), l1Proof: block.Hash(), header: fullReorgedHeader, + coinbase: calldataRollupHeader.Coinbase, + baseFee: calldataRollupHeader.BaseFee, + gasLimit: calldataRollupHeader.GasLimit, } rc.logger.Info("Rollup decompressed batch", log.BatchSeqNoKey, currentSeqNo, log.BatchHeightKey, currentHeight, "rollup_idx", currentBatchIdx, "l1_height", block.Number(), "l1_hash", block.Hash()) } @@ -375,15 +384,21 @@ func (rc *RollupCompression) executeAndSaveIncompleteBatches(calldataRollupHeade switch { // handle genesis case incompleteBatch.seqNo.Uint64() == common.L2GenesisSeqNo: - genBatch, _, err := rc.batchExecutor.CreateGenesisState(incompleteBatch.l1Proof, incompleteBatch.time) + genBatch, _, err := rc.batchExecutor.CreateGenesisState( + incompleteBatch.l1Proof, + incompleteBatch.time, + calldataRollupHeader.Coinbase, + calldataRollupHeader.BaseFee, + big.NewInt(0).SetUint64(calldataRollupHeader.GasLimit), + ) if err != nil { return err } // Sanity check - uncomment when debugging - //if genBatch.Hash() != calldataRollupHeader.BatchHashes[i] { - // rc.logger.Info(fmt.Sprintf("Good %+v\nCalc %+v", calldataRollupHeader.BatchHeaders[i], genBatch.Header)) - // rc.logger.Crit("Rollup decompression failure. The check hashes don't match") - //} + /*if genBatch.Hash() != calldataRollupHeader.BatchHashes[i] { + rc.logger.Info(fmt.Sprintf("Good %+v \n Calc %+v", calldataRollupHeader.BatchHeaders[i], genBatch.Header)) + rc.logger.Crit("Rollup decompression failure. The check hashes don't match") + }*/ err = rc.storage.StoreBatch(genBatch) if err != nil { @@ -416,15 +431,17 @@ func (rc *RollupCompression) executeAndSaveIncompleteBatches(calldataRollupHeade incompleteBatch.transactions, incompleteBatch.time, incompleteBatch.seqNo, + incompleteBatch.coinbase, + incompleteBatch.baseFee, ) if err != nil { return err } // Sanity check - uncomment when debugging - //if computedBatch.Batch.Hash() != calldataRollupHeader.BatchHashes[i] { - // rc.logger.Info(fmt.Sprintf("Good %+v\nCalc %+v", calldataRollupHeader.BatchHeaders[i], computedBatch.Batch.Header)) - // rc.logger.Crit("Rollup decompression failure. The check hashes don't match") - //} + /* if computedBatch.Batch.Hash() != calldataRollupHeader.BatchHashes[i] { + rc.logger.Info(fmt.Sprintf("Good %+v\nCalc %+v", calldataRollupHeader.BatchHeaders[i], computedBatch.Batch.Header)) + rc.logger.Crit("Rollup decompression failure. The check hashes don't match") + }*/ if _, err := computedBatch.Commit(true); err != nil { return fmt.Errorf("cannot commit stateDB for incoming valid batch seq=%d. Cause: %w", incompleteBatch.seqNo, err) @@ -478,15 +495,24 @@ func (rc *RollupCompression) decryptDecompressAndDeserialise(blob []byte, obj an return nil } -func (rc *RollupCompression) computeBatch(BlockPtr common.L1BlockHash, ParentPtr common.L2BatchHash, Transactions common.L2Transactions, AtTime uint64, SequencerNo *big.Int) (*ComputedBatch, error) { +func (rc *RollupCompression) computeBatch( + BlockPtr common.L1BlockHash, + ParentPtr common.L2BatchHash, + Transactions common.L2Transactions, + AtTime uint64, + SequencerNo *big.Int, + Coinbase gethcommon.Address, + BaseFee *big.Int, +) (*ComputedBatch, error) { return rc.batchExecutor.ComputeBatch(&BatchExecutionContext{ BlockPtr: BlockPtr, ParentPtr: ParentPtr, Transactions: Transactions, AtTime: AtTime, - // Creator: executor, - ChainConfig: rc.chainConfig, - SequencerNo: SequencerNo, + Creator: Coinbase, + ChainConfig: rc.chainConfig, + SequencerNo: SequencerNo, + BaseFee: big.NewInt(0).Set(BaseFee), }) } diff --git a/go/enclave/container/cli.go b/go/enclave/container/cli.go index 748c56af68..88928bbe19 100644 --- a/go/enclave/container/cli.go +++ b/go/enclave/container/cli.go @@ -38,6 +38,9 @@ type EnclaveConfigToml struct { DebugNamespaceEnabled bool MaxBatchSize uint64 MaxRollupSize uint64 + GasPaymentAddress string + BaseFee uint64 + GasLimit uint64 } // ParseConfig returns a config.EnclaveConfig based on either the file identified by the `config` flag, or the flags @@ -69,6 +72,9 @@ func ParseConfig() (*config.EnclaveConfig, error) { debugNamespaceEnabled := flag.Bool(debugNamespaceEnabledName, cfg.DebugNamespaceEnabled, flagUsageMap[debugNamespaceEnabledName]) maxBatchSize := flag.Uint64(maxBatchSizeName, cfg.MaxBatchSize, flagUsageMap[maxBatchSizeName]) maxRollupSize := flag.Uint64(maxRollupSizeName, cfg.MaxRollupSize, flagUsageMap[maxRollupSizeName]) + baseFee := flag.Uint64("l2BaseFee", cfg.BaseFee.Uint64(), "") + coinbaseAddress := flag.String("l2Coinbase", cfg.GasPaymentAddress.Hex(), "") + gasLimit := flag.Uint64("l2GasLimit", cfg.GasLimit.Uint64(), "") flag.Parse() @@ -103,6 +109,9 @@ func ParseConfig() (*config.EnclaveConfig, error) { cfg.DebugNamespaceEnabled = *debugNamespaceEnabled cfg.MaxBatchSize = *maxBatchSize cfg.MaxRollupSize = *maxRollupSize + cfg.BaseFee = big.NewInt(0).SetUint64(*baseFee) + cfg.GasPaymentAddress = gethcommon.HexToAddress(*coinbaseAddress) + cfg.GasLimit = big.NewInt(0).SetUint64(*gasLimit) return cfg, nil } diff --git a/go/enclave/core/batch.go b/go/enclave/core/batch.go index 4b0bdac4f4..67b4d3db77 100644 --- a/go/enclave/core/batch.go +++ b/go/enclave/core/batch.go @@ -105,6 +105,8 @@ func DeterministicEmptyBatch( block *types.Block, time uint64, sequencerNo *big.Int, + baseFee *big.Int, + coinbase gethcommon.Address, ) *Batch { h := common.BatchHeader{ ParentHash: parent.Hash(), @@ -112,7 +114,10 @@ func DeterministicEmptyBatch( Number: big.NewInt(0).Add(parent.Number, big.NewInt(1)), SequencerOrderNo: sequencerNo, // todo (#1548) - Consider how this time should align with the time of the L1 block used as proof. - Time: time, + Time: time, + BaseFee: baseFee, + Coinbase: coinbase, + GasLimit: parent.GasLimit, } b := Batch{ Header: &h, diff --git a/go/enclave/crosschain/block_message_extractor.go b/go/enclave/crosschain/block_message_extractor.go index 7fbc2311ce..7b3c173e5a 100644 --- a/go/enclave/crosschain/block_message_extractor.go +++ b/go/enclave/crosschain/block_message_extractor.go @@ -13,23 +13,20 @@ import ( ) type blockMessageExtractor struct { - busAddress *common.L1Address - l2MessageBus *common.L2Address // todo (@stefan) - remove this - storage storage.Storage - logger gethlog.Logger + busAddress *common.L1Address + storage storage.Storage + logger gethlog.Logger } func NewBlockMessageExtractor( busAddress *common.L1Address, - l2BusAddress *common.L2Address, storage storage.Storage, logger gethlog.Logger, ) BlockMessageExtractor { return &blockMessageExtractor{ - busAddress: busAddress, - l2MessageBus: l2BusAddress, - storage: storage, - logger: logger.New(log.CmpKey, log.CrossChainCmp), + busAddress: busAddress, + storage: storage, + logger: logger.New(log.CmpKey, log.CrossChainCmp), } } @@ -37,6 +34,41 @@ func (m *blockMessageExtractor) Enabled() bool { return m.GetBusAddress().Hash().Big().Cmp(gethcommon.Big0) != 0 } +func (m *blockMessageExtractor) StoreCrossChainValueTransfers(block *common.L1Block, receipts common.L1Receipts) error { + defer m.logger.Info("Block value transfer messages processed", log.BlockHashKey, block.Hash(), log.DurationKey, measure.NewStopwatch()) + + /*areReceiptsValid := common.VerifyReceiptHash(block, receipts) + + if !areReceiptsValid && m.Enabled() { + m.logger.Error("Invalid receipts submitted", log.BlockHashKey, block.Hash()) + return fmt.Errorf("receipts do not match the receipt root for the block") + }*/ + + if len(receipts) == 0 { + return nil + } + + transfers, err := m.getValueTransferMessages(receipts) + if err != nil { + m.logger.Error("Error encountered while getting inbound value transfers from block", log.BlockHashKey, block.Hash(), log.ErrKey, err) + return err + } + + hasTransfers := len(transfers) > 0 + if !hasTransfers { + return nil + } + + m.logger.Trace(fmt.Sprintf("Storing %d value transfers for block", len(transfers)), log.BlockHashKey, block.Hash()) + err = m.storage.StoreValueTransfers(block.Hash(), transfers) + if err != nil { + m.logger.Crit("Unable to store the transfers", log.ErrKey, err) + return err + } + + return nil +} + // StoreCrossChainMessages - extracts the cross chain messages for the corresponding block from the receipts. // The messages will be stored in DB storage for later usage. // block - the L1 block for which events are extracted. @@ -45,8 +77,6 @@ func (m *blockMessageExtractor) StoreCrossChainMessages(block *common.L1Block, r defer m.logger.Info("Block cross chain messages processed", log.BlockHashKey, block.Hash(), log.DurationKey, measure.NewStopwatch()) if len(receipts) == 0 { - // todo (@stefan) - error if block receipts root does not match receipts hash - // else nil return nil } @@ -98,3 +128,24 @@ func (m *blockMessageExtractor) getCrossChainMessages(block *common.L1Block, rec return messages, nil } + +func (m *blockMessageExtractor) getValueTransferMessages(receipts common.L1Receipts) (common.ValueTransferEvents, error) { + if len(receipts) == 0 { + return make(common.ValueTransferEvents, 0), nil + } + + // Retrieves the relevant logs from the message bus. + logs, err := filterLogsFromReceipts(receipts, m.GetBusAddress(), &ValueTransferEventID) + if err != nil { + m.logger.Error("Error encountered when filtering receipt logs.", log.ErrKey, err) + return make(common.ValueTransferEvents, 0), err + } + + transfers, err := convertLogsToValueTransfers(logs, ValueTransferEventName, MessageBusABI) + if err != nil { + m.logger.Error("Error encountered when converting value transfer receipt logs.", log.ErrKey, err) + return make(common.ValueTransferEvents, 0), err + } + + return transfers, nil +} diff --git a/go/enclave/crosschain/common.go b/go/enclave/crosschain/common.go index 810dcad480..fc0f0772ee 100644 --- a/go/enclave/crosschain/common.go +++ b/go/enclave/crosschain/common.go @@ -16,9 +16,11 @@ import ( ) var ( - MessageBusABI, _ = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI)) - CrossChainEventName = "LogMessagePublished" - CrossChainEventID = MessageBusABI.Events[CrossChainEventName].ID + MessageBusABI, _ = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI)) + CrossChainEventName = "LogMessagePublished" + CrossChainEventID = MessageBusABI.Events[CrossChainEventName].ID + ValueTransferEventName = "ValueTransfer" + ValueTransferEventID = MessageBusABI.Events["ValueTransfer"].ID ) func lazilyLogReceiptChecksum(msg string, receipts types.Receipts, logger gethlog.Logger) { @@ -146,3 +148,24 @@ func createCrossChainMessage(event MessageBus.MessageBusLogMessagePublished) Mes Payload: event.Payload, } } + +// convertLogsToMessages - converts the logs of the event to messages. The logs should be filtered, otherwise fails. +func convertLogsToValueTransfers(logs []types.Log, eventName string, messageBusABI abi.ABI) (common.ValueTransferEvents, error) { + messages := make(common.ValueTransferEvents, 0) + + for _, log := range logs { + var event MessageBus.MessageBusValueTransfer + err := messageBusABI.UnpackIntoInterface(&event, eventName, log.Data) + if err != nil { + return nil, err + } + + messages = append(messages, common.ValueTransferEvent{ + Sender: event.Sender, + Receiver: event.Receiver, + Amount: event.Amount, + }) + } + + return messages, nil +} diff --git a/go/enclave/crosschain/interfaces.go b/go/enclave/crosschain/interfaces.go index 9235012754..3500448c3a 100644 --- a/go/enclave/crosschain/interfaces.go +++ b/go/enclave/crosschain/interfaces.go @@ -16,6 +16,8 @@ type BlockMessageExtractor interface { // StoreCrossChainMessages - Verifies receipts belong to block and saves the relevant cross chain messages from the receipts StoreCrossChainMessages(block *common.L1Block, receipts common.L1Receipts) error + StoreCrossChainValueTransfers(block *common.L1Block, receipts common.L1Receipts) error + // GetBusAddress - Returns the L1 message bus address. GetBusAddress() *common.L1Address @@ -43,7 +45,11 @@ type Manager interface { // ExtractOutboundMessages - Finds relevant logs in the receipts and converts them to cross chain messages. ExtractOutboundMessages(receipts common.L2Receipts) (common.CrossChainMessages, error) + ExtractOutboundTransfers(receipts common.L2Receipts) (common.ValueTransferEvents, error) + CreateSyntheticTransactions(messages common.CrossChainMessages, rollupState *state.StateDB) common.L2Transactions - RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, rollupState *state.StateDB) common.CrossChainMessages + ExecuteValueTransfers(transfers common.ValueTransferEvents, rollupState *state.StateDB) + + RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, rollupState *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents) } diff --git a/go/enclave/crosschain/message_bus_manager.go b/go/enclave/crosschain/message_bus_manager.go index 57b519d449..533369b7d2 100644 --- a/go/enclave/crosschain/message_bus_manager.go +++ b/go/enclave/crosschain/message_bus_manager.go @@ -120,12 +120,30 @@ func (m *MessageBusManager) ExtractOutboundMessages(receipts common.L2Receipts) return messages, nil } +// ExtractLocalMessages - Finds relevant logs in the receipts and converts them to cross chain messages. +func (m *MessageBusManager) ExtractOutboundTransfers(receipts common.L2Receipts) (common.ValueTransferEvents, error) { + logs, err := filterLogsFromReceipts(receipts, m.messageBusAddress, &ValueTransferEventID) + if err != nil { + m.logger.Error("Error extracting logs from L2 message bus!", log.ErrKey, err) + return make(common.ValueTransferEvents, 0), err + } + + transfers, err := convertLogsToValueTransfers(logs, ValueTransferEventName, MessageBusABI) + if err != nil { + m.logger.Error("Error converting transfers from L2 message bus!", log.ErrKey, err) + return make(common.ValueTransferEvents, 0), err + } + + return transfers, nil +} + // RetrieveInboundMessages - Retrieves the cross chain messages between two blocks. // todo (@stefan) - fix ordering of messages, currently it is irrelevant. // todo (@stefan) - do not extract messages below their consistency level. Irrelevant security wise. // todo (@stefan) - surface errors -func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, _ *state.StateDB) common.CrossChainMessages { +func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, _ *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents) { messages := make(common.CrossChainMessages, 0) + transfers := make(common.ValueTransferEvents, 0) from := fromBlock.Hash() height := fromBlock.NumberU64() @@ -140,12 +158,19 @@ func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, t } m.logger.Trace(fmt.Sprintf("Looking for cross chain messages at block %s", b.Hash().Hex())) + messagesForBlock, err := m.storage.GetL1Messages(b.Hash()) if err != nil { m.logger.Crit("Reading the key for the block failed with uncommon reason.", log.ErrKey, err) } + transfersForBlock, err := m.storage.GetL1Transfers(b.Hash()) + if err != nil { + m.logger.Crit("Unable to get L1 transfers for block that should be there.", log.ErrKey, err) + } + messages = append(messages, messagesForBlock...) // Ordering here might work in POBI, but might be weird for fast finality + transfers = append(transfers, transfersForBlock...) // No deposits before genesis. if b.NumberU64() < height { @@ -160,7 +185,13 @@ func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, t m.logger.Info(fmt.Sprintf("Extracted cross chain messages for block height %d ->%d: %d.", fromBlock.NumberU64(), toBlock.NumberU64(), len(messages))) - return messages + return messages, transfers +} + +func (m *MessageBusManager) ExecuteValueTransfers(transfers common.ValueTransferEvents, rollupState *state.StateDB) { + for _, transfer := range transfers { + rollupState.AddBalance(transfer.Receiver, transfer.Amount) + } } // CreateSyntheticTransactions - generates transactions that the enclave should execute internally for the messages. diff --git a/go/enclave/crosschain/processors.go b/go/enclave/crosschain/processors.go index 331c356213..259a604f4b 100644 --- a/go/enclave/crosschain/processors.go +++ b/go/enclave/crosschain/processors.go @@ -24,7 +24,7 @@ func New( ) *Processors { processors := Processors{} processors.Local = NewObscuroMessageBusManager(storage, chainID, logger) - processors.Remote = NewBlockMessageExtractor(l1BusAddress, processors.Local.GetBusAddress(), storage, logger) + processors.Remote = NewBlockMessageExtractor(l1BusAddress, storage, logger) return &processors } diff --git a/go/enclave/enclave.go b/go/enclave/enclave.go index db25c42088..40f830f4dc 100644 --- a/go/enclave/enclave.go +++ b/go/enclave/enclave.go @@ -10,6 +10,7 @@ import ( "sync" "time" + "github.com/obscuronet/go-obscuro/go/enclave/gas" "github.com/obscuronet/go-obscuro/go/enclave/storage" "github.com/obscuronet/go-obscuro/go/enclave/vkhandler" @@ -203,8 +204,9 @@ func NewEnclave( subscriptionManager := events.NewSubscriptionManager(&rpcEncryptionManager, storage, logger) - blockProcessor := components.NewBlockProcessor(storage, crossChainProcessors, logger) - batchExecutor := components.NewBatchExecutor(storage, crossChainProcessors, genesis, &chainConfig, logger) + gasOracle := gas.NewGasOracle() + blockProcessor := components.NewBlockProcessor(storage, crossChainProcessors, gasOracle, logger) + batchExecutor := components.NewBatchExecutor(storage, crossChainProcessors, genesis, gasOracle, &chainConfig, logger) sigVerifier, err := components.NewSignatureValidator(config.SequencerID, storage) registry := components.NewBatchRegistry(storage, logger) rProducer := components.NewRollupProducer(config.SequencerID, dataEncryptionService, config.ObscuroChainID, config.L1ChainID, storage, registry, blockProcessor, logger) @@ -233,8 +235,11 @@ func NewEnclave( dataEncryptionService, dataCompressionService, nodetype.SequencerSettings{ - MaxBatchSize: config.MaxBatchSize, - MaxRollupSize: config.MaxRollupSize, + MaxBatchSize: config.MaxBatchSize, + MaxRollupSize: config.MaxRollupSize, + GasPaymentAddress: config.GasPaymentAddress, + BatchGasLimit: config.GasLimit, + BaseFee: config.BaseFee, }, ) } else { @@ -683,6 +688,8 @@ func (e *enclaveImpl) ObsCall(encryptedParams common.EncryptedParamsCall) (*resp encodedResult = hexutil.Encode(execResult.ReturnData) } + e.logger.Info("Call result success ", "result", encodedResult) + return responses.AsEncryptedResponse(&encodedResult, vkHandler), nil } @@ -1045,7 +1052,7 @@ func (e *enclaveImpl) EstimateGas(encryptedParams common.EncryptedParamsEstimate return responses.AsEncryptedError(err, vkHandler), nil } - gasEstimate, err := e.DoEstimateGas(callMsg, blockNumber, e.GlobalGasCap) + executionGasEstimate, err := e.DoEstimateGas(callMsg, blockNumber, e.GlobalGasCap) if err != nil { err = fmt.Errorf("unable to estimate transaction - %w", err) @@ -1062,7 +1069,7 @@ func (e *enclaveImpl) EstimateGas(encryptedParams common.EncryptedParamsEstimate return responses.AsEncryptedError(err, vkHandler), nil } - return responses.AsEncryptedResponse(&gasEstimate, vkHandler), nil + return responses.AsEncryptedResponse(&executionGasEstimate, vkHandler), nil } func (e *enclaveImpl) GetLogs(encryptedParams common.EncryptedParamsGetLogs) (*responses.Logs, common.SystemError) { //nolint diff --git a/go/enclave/enclave_test.go b/go/enclave/enclave_test.go index 91304bf6ba..1d10b1273d 100644 --- a/go/enclave/enclave_test.go +++ b/go/enclave/enclave_test.go @@ -38,7 +38,7 @@ const _testEnclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a04 // _successfulRollupGasPrice can be deterministically calculated when evaluating the management smart contract. // It should change only when there are changes to the smart contract or if the gas estimation algorithm is modified. // Other changes would mean something is broken. -const _successfulRollupGasPrice = 317480 +const _successfulRollupGasPrice = 336360 var _enclavePubKey *ecies.PublicKey diff --git a/go/enclave/evm/evm_facade.go b/go/enclave/evm/evm_facade.go index 9af1e8b821..b4e87e975a 100644 --- a/go/enclave/evm/evm_facade.go +++ b/go/enclave/evm/evm_facade.go @@ -35,9 +35,10 @@ func ExecuteTransactions( storage storage.Storage, chainConfig *params.ChainConfig, fromTxIndex int, + noBaseFee bool, logger gethlog.Logger, ) map[common.TxHash]interface{} { - chain, vmCfg, gp := initParams(storage, true, logger) + chain, vmCfg, gp := initParams(storage, noBaseFee, logger) zero := uint64(0) usedGas := &zero result := map[common.TxHash]interface{}{} @@ -115,7 +116,7 @@ func executeTransaction( header.MixDigest = before if err != nil { s.RevertToSnapshot(snap) - return nil, err + return receipt, err } return receipt, nil @@ -146,7 +147,13 @@ func ExecuteObsCall( chainConfig *params.ChainConfig, logger gethlog.Logger, ) (*gethcore.ExecutionResult, error) { - chain, vmCfg, gp := initParams(storage, true, nil) + noBaseFee := true + if header.BaseFee != nil && header.BaseFee.Cmp(gethcommon.Big0) != 0 && msg.GasPrice.Cmp(gethcommon.Big0) != 0 { + noBaseFee = false + logger.Info("ObsCall - with base fee ", "to", msg.To.Hex()) + } + + chain, vmCfg, gp := initParams(storage, noBaseFee, nil) ethHeader, err := gethencoding.CreateEthHeaderForBatch(header, secret(storage)) if err != nil { return nil, err @@ -179,6 +186,7 @@ func ExecuteObsCall( return result, err } + logger.Info("ObsCall - with result ", "gas", result.UsedGas) return result, nil } diff --git a/go/enclave/gas/README.md b/go/enclave/gas/README.md new file mode 100644 index 0000000000..4a890f16ff --- /dev/null +++ b/go/enclave/gas/README.md @@ -0,0 +1,2 @@ +The gas package contains the necessary code for estimating and pricing l1 gas. +Currently it's mostly barebone placeholders, but will evolve into precompiled smart contracts and binders for accessing their state in order to fit it in the gas mechanics. \ No newline at end of file diff --git a/go/enclave/gas/gas.go b/go/enclave/gas/gas.go new file mode 100644 index 0000000000..d6256eb1e0 --- /dev/null +++ b/go/enclave/gas/gas.go @@ -0,0 +1,42 @@ +package gas + +import ( + "math/big" + + gethcore "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" +) + +type ObscuroGasPool struct { + gp gethcore.GasPool +} + +func NewObscuroGasPool(gp *gethcore.GasPool) *ObscuroGasPool { + return &ObscuroGasPool{ + gp: gethcore.GasPool(gp.Gas()), + } +} + +func (gp *ObscuroGasPool) ForTransaction(tx *types.Transaction) (*gethcore.GasPool, error) { + encodedTx, err := rlp.EncodeToBytes(*tx) + if err != nil { + return nil, err + } + + l1Gas := CalculateL1GasUsed(encodedTx, big.NewInt(0)) + + gPool := gethcore.GasPool(l1Gas.Uint64()) + return &gPool, nil +} + +// CalculateL1GasUsed - calculates the gas cost of having a transaction on the l1. +func CalculateL1GasUsed(data []byte, overhead *big.Int) *big.Int { + reducedTxSize := uint64(len(data)) + reducedTxSize = (reducedTxSize * 75) / 100 + reducedTxSize = reducedTxSize * params.TxDataNonZeroGasEIP2028 + + l1Gas := new(big.Int).SetUint64(reducedTxSize) + return new(big.Int).Add(l1Gas, overhead) +} diff --git a/go/enclave/gas/oracle.go b/go/enclave/gas/oracle.go new file mode 100644 index 0000000000..31ff3ae3fa --- /dev/null +++ b/go/enclave/gas/oracle.go @@ -0,0 +1,51 @@ +package gas + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" +) + +// Oracle - the interface for the future precompiled gas oracle contract +// which will expose necessary l1 information. +type Oracle interface { + ProcessL1Block(block *types.Block) + EstimateL1StorageGasCost(tx *types.Transaction, block *types.Block) (*big.Int, error) +} + +type oracle struct { + baseFee *big.Int +} + +func NewGasOracle() Oracle { + return &oracle{ + baseFee: big.NewInt(1), + } +} + +// ProcessL1Block - should be used to update the gas oracle. Currently does not really +// fit into phase 1 gas mechanics as the information needs to be available per block. +// would be fixed when this becomes a smart contract using the stateDB +func (o *oracle) ProcessL1Block(block *types.Block) { + blockBaseFee := block.BaseFee() + if blockBaseFee != nil { + o.baseFee = blockBaseFee + } +} + +// EstimateL1StorageGasCost - Returns the expected l1 gas cost for a transaction at a given l1 block. +func (o *oracle) EstimateL1StorageGasCost(tx *types.Transaction, block *types.Block) (*big.Int, error) { + encodedTx, err := rlp.EncodeToBytes(tx) + if err != nil { + return nil, err + } + + blockBaseFee := block.BaseFee() + if blockBaseFee == nil { + return big.NewInt(0), nil + } + + l1Gas := CalculateL1GasUsed(encodedTx, big.NewInt(0)) + return big.NewInt(0).Mul(l1Gas, block.BaseFee()), nil +} diff --git a/go/enclave/genesis/testnet_genesis.go b/go/enclave/genesis/testnet_genesis.go index 02f6e61289..f4062331a1 100644 --- a/go/enclave/genesis/testnet_genesis.go +++ b/go/enclave/genesis/testnet_genesis.go @@ -5,9 +5,11 @@ import ( "math/big" gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" ) const TestnetPrefundedPK = "8dfb8083da6275ae3e4f41e3e8a8c19d028d32c9247e24530933782f2a05035b" // The genesis main account private key. +var GasBridgingKeys, _ = crypto.GenerateKey() // todo - make static var TestnetGenesis = Genesis{ Accounts: []Account{ diff --git a/go/enclave/l2chain/l2_chain.go b/go/enclave/l2chain/l2_chain.go index 3106612dd5..8804a6b449 100644 --- a/go/enclave/l2chain/l2_chain.go +++ b/go/enclave/l2chain/l2_chain.go @@ -34,11 +34,7 @@ type obscuroChain struct { logger gethlog.Logger - // Gas usage values - // todo (#627) - use the ethconfig.Config instead - GlobalGasCap uint64 - BaseFee *big.Int - Registry components.BatchRegistry + Registry components.BatchRegistry } func NewChain( @@ -49,13 +45,11 @@ func NewChain( registry components.BatchRegistry, ) ObscuroChain { return &obscuroChain{ - storage: storage, - chainConfig: chainConfig, - logger: logger, - GlobalGasCap: 5_000_000_000, // todo (#627) - make config - BaseFee: gethcommon.Big0, - genesis: genesis, - Registry: registry, + storage: storage, + chainConfig: chainConfig, + logger: logger, + genesis: genesis, + Registry: registry, } } @@ -125,12 +119,6 @@ func (oc *obscuroChain) ObsCall(apiArgs *gethapi.TransactionArgs, blockNumber *g } func (oc *obscuroChain) ObsCallAtBlock(apiArgs *gethapi.TransactionArgs, blockNumber *gethrpc.BlockNumber) (*gethcore.ExecutionResult, error) { - // todo (#627) - review this during gas mechanics implementation - callMsg, err := apiArgs.ToMessage(oc.GlobalGasCap, oc.BaseFee) - if err != nil { - return nil, fmt.Errorf("unable to convert TransactionArgs to Message - %w", err) - } - // fetch the chain state at given batch blockState, err := oc.Registry.GetBatchStateAtHeight(blockNumber) if err != nil { @@ -142,6 +130,11 @@ func (oc *obscuroChain) ObsCallAtBlock(apiArgs *gethapi.TransactionArgs, blockNu return nil, fmt.Errorf("unable to fetch head state batch. Cause: %w", err) } + callMsg, err := apiArgs.ToMessage(batch.Header.GasLimit, batch.Header.BaseFee) + if err != nil { + return nil, fmt.Errorf("unable to convert TransactionArgs to Message - %w", err) + } + oc.logger.Trace("Obs_Call: Successful result", "result", gethlog.Lazy{Fn: func() string { return fmt.Sprintf("contractAddress=%s, from=%s, data=%s, batch=%s, state=%s", callMsg.To, @@ -154,6 +147,7 @@ func (oc *obscuroChain) ObsCallAtBlock(apiArgs *gethapi.TransactionArgs, blockNu result, err := evm.ExecuteObsCall(callMsg, blockState, batch.Header, oc.storage, oc.chainConfig, oc.logger) if err != nil { // also return the result as the result can be evaluated on some errors like ErrIntrinsicGas + oc.logger.Info("Call failed with error", log.ErrKey, err) return result, err } diff --git a/go/enclave/nodetype/sequencer.go b/go/enclave/nodetype/sequencer.go index e624bc17e3..2dc7017619 100644 --- a/go/enclave/nodetype/sequencer.go +++ b/go/enclave/nodetype/sequencer.go @@ -33,8 +33,11 @@ import ( const RollupDelay = 2 // number of L1 blocks to exclude when creating a rollup. This will minimize compression reorg issues. type SequencerSettings struct { - MaxBatchSize uint64 - MaxRollupSize uint64 + MaxBatchSize uint64 + MaxRollupSize uint64 + GasPaymentAddress gethcommon.Address + BatchGasLimit *big.Int + BaseFee *big.Int } type sequencer struct { @@ -120,7 +123,13 @@ func (s *sequencer) CreateBatch() error { // won't be committed by the producer. func (s *sequencer) initGenesis(block *common.L1Block) error { s.logger.Info("Initializing genesis state", log.BlockHashKey, block.Hash()) - batch, msgBusTx, err := s.batchProducer.CreateGenesisState(block.Hash(), uint64(time.Now().Unix())) + batch, msgBusTx, err := s.batchProducer.CreateGenesisState( + block.Hash(), + uint64(time.Now().Unix()), + s.settings.GasPaymentAddress, + s.settings.BaseFee, + s.settings.BatchGasLimit, + ) if err != nil { return err } @@ -190,7 +199,8 @@ func (s *sequencer) produceBatch(sequencerNo *big.Int, l1Hash common.L1BlockHash ParentPtr: headBatch, Transactions: transactions, AtTime: batchTime, - Creator: s.hostID, + Creator: s.settings.GasPaymentAddress, + BaseFee: s.settings.BaseFee, ChainConfig: s.chainConfig, SequencerNo: sequencerNo, }) diff --git a/go/enclave/nodetype/validator.go b/go/enclave/nodetype/validator.go index dd6e19ee44..7039abfdf7 100644 --- a/go/enclave/nodetype/validator.go +++ b/go/enclave/nodetype/validator.go @@ -3,6 +3,7 @@ package nodetype import ( "errors" "fmt" + "math/big" "github.com/ethereum/go-ethereum/core/types" @@ -68,9 +69,8 @@ func (val *obsValidator) OnL1Fork(_ *common.ChainFork) error { return nil } -func (val *obsValidator) VerifySequencerSignature(*core.Batch) error { - // todo - return nil +func (val *obsValidator) VerifySequencerSignature(b *core.Batch) error { + return val.sigValidator.CheckSequencerSignature(b.Hash(), b.Header.R, b.Header.S) } func (val *obsValidator) ExecuteStoredBatches() error { @@ -129,7 +129,7 @@ func (val *obsValidator) executionPrerequisites(batch *core.Batch) (bool, error) } func (val *obsValidator) handleGenesis(batch *core.Batch) error { - genBatch, _, err := val.batchExecutor.CreateGenesisState(batch.Header.L1Proof, batch.Header.Time) + genBatch, _, err := val.batchExecutor.CreateGenesisState(batch.Header.L1Proof, batch.Header.Time, batch.Header.Coinbase, batch.Header.BaseFee, big.NewInt(0).SetUint64(batch.Header.GasLimit)) if err != nil { return err } diff --git a/go/enclave/storage/enclavedb/block.go b/go/enclave/storage/enclavedb/block.go index 75adfcbb2a..399816f410 100644 --- a/go/enclave/storage/enclavedb/block.go +++ b/go/enclave/storage/enclavedb/block.go @@ -18,8 +18,8 @@ const ( blockInsert = "insert into block values (?,?,?,?,?)" selectBlockHeader = "select header from block" - l1msgInsert = "insert into l1_msg (message, block) values " - l1msgValue = "(?,?)" + l1msgInsert = "insert into l1_msg (message, block, is_transfer) values " + l1msgValue = "(?,?,?)" selectL1Msg = "select message from l1_msg " rollupInsert = "replace into rollup values (?,?,?,?,?)" @@ -93,7 +93,7 @@ func FetchBlockHeaderByHeight(db *sql.DB, height *big.Int) (*types.Header, error return fetchBlockHeader(db, "where is_canonical=true and height=?", height.Int64()) } -func WriteL1Messages(db *sql.DB, blockHash common.L1BlockHash, messages common.CrossChainMessages) error { +func WriteL1Messages[T any](db *sql.DB, blockHash common.L1BlockHash, messages []T, isValueTransfer bool) error { insert := l1msgInsert + strings.Repeat(l1msgValue+",", len(messages)) insert = insert[0 : len(insert)-1] // remove trailing comma @@ -106,6 +106,7 @@ func WriteL1Messages(db *sql.DB, blockHash common.L1BlockHash, messages common.C } args = append(args, data) args = append(args, blockHash.Bytes()) + args = append(args, isValueTransfer) } if len(messages) > 0 { _, err := db.Exec(insert, args...) @@ -114,10 +115,10 @@ func WriteL1Messages(db *sql.DB, blockHash common.L1BlockHash, messages common.C return nil } -func FetchL1Messages(db *sql.DB, blockHash common.L1BlockHash) (common.CrossChainMessages, error) { - var result common.CrossChainMessages - query := selectL1Msg + " where block = ?" - rows, err := db.Query(query, blockHash.Bytes()) +func FetchL1Messages[T any](db *sql.DB, blockHash common.L1BlockHash, isTransfer bool) ([]T, error) { + var result []T + query := selectL1Msg + " where block = ? and is_transfer = ?" + rows, err := db.Query(query, blockHash.Bytes(), isTransfer) if err != nil { if errors.Is(err, sql.ErrNoRows) { // make sure the error is converted to obscuro-wide not found error @@ -132,7 +133,7 @@ func FetchL1Messages(db *sql.DB, blockHash common.L1BlockHash) (common.CrossChai if err != nil { return nil, err } - ccm := new(common.CrossChainMessage) + ccm := new(T) if err := rlp.Decode(bytes.NewReader(msg), ccm); err != nil { return nil, fmt.Errorf("could not decode cross chain message. Cause: %w", err) } diff --git a/go/enclave/storage/init/sqlite/001_init.sql b/go/enclave/storage/init/sqlite/001_init.sql index 1d48f5b435..2a20bf0f03 100644 --- a/go/enclave/storage/init/sqlite/001_init.sql +++ b/go/enclave/storage/init/sqlite/001_init.sql @@ -36,7 +36,8 @@ create table if not exists l1_msg ( id INTEGER PRIMARY KEY AUTOINCREMENT, message varbinary(1024) NOT NULL, - block binary(32) NOT NULL REFERENCES block + block binary(32) NOT NULL REFERENCES block, + is_transfer boolean ); create table if not exists rollup diff --git a/go/enclave/storage/interfaces.go b/go/enclave/storage/interfaces.go index b32a7efec4..4089d0c73d 100644 --- a/go/enclave/storage/interfaces.go +++ b/go/enclave/storage/interfaces.go @@ -105,6 +105,9 @@ type AttestationStorage interface { type CrossChainMessagesStorage interface { StoreL1Messages(blockHash common.L1BlockHash, messages common.CrossChainMessages) error GetL1Messages(blockHash common.L1BlockHash) (common.CrossChainMessages, error) + + StoreValueTransfers(blockHash common.L1BlockHash, transfers common.ValueTransferEvents) error + GetL1Transfers(blockHash common.L1BlockHash) (common.ValueTransferEvents, error) } type EnclaveKeyStorage interface { diff --git a/go/enclave/storage/storage.go b/go/enclave/storage/storage.go index 568f2ee8b5..86f78f42a4 100644 --- a/go/enclave/storage/storage.go +++ b/go/enclave/storage/storage.go @@ -420,16 +420,24 @@ func (s *storageImpl) StoreExecutedBatch(batch *core.Batch, receipts []*types.Re return nil } +func (s *storageImpl) StoreValueTransfers(blockHash common.L1BlockHash, transfers common.ValueTransferEvents) error { + return enclavedb.WriteL1Messages(s.db.GetSQLDB(), blockHash, transfers, true) +} + func (s *storageImpl) StoreL1Messages(blockHash common.L1BlockHash, messages common.CrossChainMessages) error { callStart := time.Now() defer s.logDuration("StoreL1Messages", callStart) - return enclavedb.WriteL1Messages(s.db.GetSQLDB(), blockHash, messages) + return enclavedb.WriteL1Messages(s.db.GetSQLDB(), blockHash, messages, false) } func (s *storageImpl) GetL1Messages(blockHash common.L1BlockHash) (common.CrossChainMessages, error) { callStart := time.Now() defer s.logDuration("GetL1Messages", callStart) - return enclavedb.FetchL1Messages(s.db.GetSQLDB(), blockHash) + return enclavedb.FetchL1Messages[common.CrossChainMessage](s.db.GetSQLDB(), blockHash, false) +} + +func (s *storageImpl) GetL1Transfers(blockHash common.L1BlockHash) (common.ValueTransferEvents, error) { + return enclavedb.FetchL1Messages[common.ValueTransferEvent](s.db.GetSQLDB(), blockHash, true) } const enclaveKeyKey = "ek" diff --git a/go/host/rpc/clientapi/client_api_eth.go b/go/host/rpc/clientapi/client_api_eth.go index 3eaf8e34fd..92c24bfde1 100644 --- a/go/host/rpc/clientapi/client_api_eth.go +++ b/go/host/rpc/clientapi/client_api_eth.go @@ -68,7 +68,16 @@ func (api *EthereumAPI) GetBlockByHash(_ context.Context, hash gethcommon.Hash, // GasPrice is a placeholder for an RPC method required by MetaMask/Remix. func (api *EthereumAPI) GasPrice(context.Context) (*hexutil.Big, error) { - return (*hexutil.Big)(big.NewInt(1)), nil + header, err := api.host.DB().GetHeadBatchHeader() + if err != nil { + return nil, err + } + + if header.BaseFee == nil || header.BaseFee.Cmp(gethcommon.Big0) == 0 { + return (*hexutil.Big)(big.NewInt(1)), nil + } + + return (*hexutil.Big)(big.NewInt(0).Set(header.BaseFee)), nil } // GetBalance returns the address's balance on the Obscuro network, encrypted with the viewing key corresponding to the @@ -178,6 +187,7 @@ func (api *EthereumAPI) GetStorageAt(_ context.Context, encryptedParams common.E // rpc.DecimalOrHex -> []byte func (api *EthereumAPI) FeeHistory(context.Context, []byte, rpc.BlockNumber, []float64) (*FeeHistoryResult, error) { // todo (#1621) - return a non-dummy fee history + return &FeeHistoryResult{ OldestBlock: (*hexutil.Big)(big.NewInt(0)), Reward: [][]*hexutil.Big{}, diff --git a/go/node/config.go b/go/node/config.go index ffd9b297b9..2a77968cf0 100644 --- a/go/node/config.go +++ b/go/node/config.go @@ -45,6 +45,7 @@ type Config struct { hostInMemDB bool debugNamespaceEnabled bool profilerEnabled bool + coinbaseAddress string logLevel int isInboundP2PDisabled bool l1BlockTime time.Duration @@ -79,6 +80,10 @@ func (c *Config) ToEnclaveConfig() *config.EnclaveConfig { cfg.Address = fmt.Sprintf("%s:%d", _localhost, c.enclaveWSPort) cfg.DebugNamespaceEnabled = c.debugNamespaceEnabled + if c.nodeType == "sequencer" && c.coinbaseAddress != "" { + cfg.GasPaymentAddress = gethcommon.HexToAddress(c.coinbaseAddress) + } + return cfg } @@ -121,6 +126,12 @@ func (c *Config) UpdateNodeConfig(opts ...Option) *Config { return c } +func WithCoinbase(s string) Option { + return func(c *Config) { + c.coinbaseAddress = s + } +} + func WithNodeName(s string) Option { return func(c *Config) { c.nodeName = s diff --git a/go/wallet/wallet.go b/go/wallet/wallet.go index 63d78a8073..1b69552655 100644 --- a/go/wallet/wallet.go +++ b/go/wallet/wallet.go @@ -27,6 +27,7 @@ type Wallet interface { // GetNonceAndIncrement atomically increments the nonce by one and returns the previous value GetNonceAndIncrement() uint64 GetNonce() uint64 + ChainID() *big.Int // PrivateKey returns the wallets private key PrivateKey() *ecdsa.PrivateKey @@ -75,6 +76,10 @@ func (m *inMemoryWallet) Address() common.Address { return m.pubKeyAddr } +func (m *inMemoryWallet) ChainID() *big.Int { + return big.NewInt(0).Set(m.chainID) +} + func (m *inMemoryWallet) GetNonceAndIncrement() uint64 { return atomic.AddUint64(&m.nonce, 1) - 1 } diff --git a/integration/networktest/userwallet/userwallet.go b/integration/networktest/userwallet/userwallet.go index 8f86323e6a..c6946a3556 100644 --- a/integration/networktest/userwallet/userwallet.go +++ b/integration/networktest/userwallet/userwallet.go @@ -81,6 +81,10 @@ func NewUserWallet(pk *ecdsa.PrivateKey, rpcEndpoint string, logger gethlog.Logg return wal } +func (s *UserWallet) ChainID() *big.Int { + return big.NewInt(integration.ObscuroChainID) +} + func (s *UserWallet) SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int) (*gethcommon.Hash, error) { err := s.EnsureClientSetup(ctx) if err != nil { diff --git a/integration/simulation/devnetwork/node.go b/integration/simulation/devnetwork/node.go index 7c3322367c..a3baf9a164 100644 --- a/integration/simulation/devnetwork/node.go +++ b/integration/simulation/devnetwork/node.go @@ -157,6 +157,8 @@ func (n *InMemNodeOperator) createEnclaveContainer() *enclavecontainer.EnclaveCo hostPort := n.config.PortStart + integration.DefaultHostP2pOffset + n.operatorIdx hostAddr := fmt.Sprintf("%s:%d", network.Localhost, hostPort) + defaultCfg := config.DefaultEnclaveConfig() + enclaveConfig := &config.EnclaveConfig{ HostID: n.l1Wallet.Address(), SequencerID: n.config.SequencerID, @@ -176,6 +178,9 @@ func (n *InMemNodeOperator) createEnclaveContainer() *enclavecontainer.EnclaveCo DebugNamespaceEnabled: true, MaxBatchSize: 1024 * 25, MaxRollupSize: 1024 * 64, + BaseFee: defaultCfg.BaseFee, // todo @siliev:: fix test transaction builders so this can be different + GasLimit: defaultCfg.GasLimit, + GasPaymentAddress: defaultCfg.GasPaymentAddress, } return enclavecontainer.NewEnclaveContainerWithLogger(enclaveConfig, enclaveLogger) } diff --git a/integration/simulation/network/network_utils.go b/integration/simulation/network/network_utils.go index f7e52ae780..b755e26d8c 100644 --- a/integration/simulation/network/network_utils.go +++ b/integration/simulation/network/network_utils.go @@ -93,6 +93,8 @@ func createInMemObscuroNode( ManagementContractAddress: *mgtContractAddress, MaxBatchSize: 1024 * 25, MaxRollupSize: 1024 * 64, + BaseFee: big.NewInt(1), // todo @siliev:: fix test transaction builders so this can be different + GasLimit: big.NewInt(1_000_000_000), } enclaveLogger := testlog.Logger().New(log.NodeIDKey, id, log.CmpKey, log.EnclaveCmp) diff --git a/integration/simulation/network/obscuro_node_utils.go b/integration/simulation/network/obscuro_node_utils.go index 322a1d6413..d28052f15f 100644 --- a/integration/simulation/network/obscuro_node_utils.go +++ b/integration/simulation/network/obscuro_node_utils.go @@ -82,16 +82,16 @@ func createAuthClientsPerWallet(clients []rpc.Client, wallets *params.SimWallets walletClients := make(map[string][]*obsclient.AuthObsClient) // loop through all the L2 wallets we're using and round-robin allocate them the rpc clients we have for each host for _, w := range append(wallets.SimObsWallets, wallets.L2FaucetWallet) { - walletClients[w.Address().String()] = createAuthClients(clients, w) + walletClients[w.Address().String()] = CreateAuthClients(clients, w) } for _, t := range wallets.Tokens { w := t.L2Owner - walletClients[w.Address().String()] = createAuthClients(clients, w) + walletClients[w.Address().String()] = CreateAuthClients(clients, w) } return walletClients } -func createAuthClients(clients []rpc.Client, wal wallet.Wallet) []*obsclient.AuthObsClient { +func CreateAuthClients(clients []rpc.Client, wal wallet.Wallet) []*obsclient.AuthObsClient { authClients := make([]*obsclient.AuthObsClient, len(clients)) for i, client := range clients { vk, err := viewingkey.GenerateViewingKeyForWallet(wal) diff --git a/integration/simulation/network/socket.go b/integration/simulation/network/socket.go index dda022033e..504ed52e90 100644 --- a/integration/simulation/network/socket.go +++ b/integration/simulation/network/socket.go @@ -94,6 +94,7 @@ func (n *networkOfSocketNodes) Create(simParams *params.SimParams, _ *stats.Stat node.WithManagementContractAddress(simParams.L1SetupData.MgmtContractAddress.String()), node.WithMessageBusContractAddress(simParams.L1SetupData.MessageBusAddr.String()), node.WithNodeType(nodeTypeStr), + node.WithCoinbase(simParams.Wallets.L2FeesWallet.Address().Hex()), node.WithL1WebsocketURL(fmt.Sprintf("ws://%s:%d", "127.0.0.1", simParams.StartPort+100)), node.WithInboundP2PDisabled(isInboundP2PDisabled), node.WithLogLevel(4), diff --git a/integration/simulation/output_stats.go b/integration/simulation/output_stats.go index 0fdaf81cfb..e97a54d106 100644 --- a/integration/simulation/output_stats.go +++ b/integration/simulation/output_stats.go @@ -133,7 +133,8 @@ func (o *OutputStats) String() string { "totalWithdrawnAmount: %d\n"+ "rollupWithMoreRecentProof: %d\n"+ "nrTransferTransactions: %d\n"+ - "nrBlockParsedERC20Deposits: %d\n", + "nrBlockParsedERC20Deposits: %d\n"+ + "gasBridgeCount: %d\n", o.simulation.Stats.NrMiners, o.l1Height, o.l2Height, @@ -151,5 +152,6 @@ func (o *OutputStats) String() string { o.simulation.Stats.RollupWithMoreRecentProofCount, o.simulation.Stats.NrTransferTransactions, o.canonicalERC20DepositCount, + len(o.simulation.TxInjector.TxTracker.GasBridgeTransactions), ) } diff --git a/integration/simulation/params/wallet_utils.go b/integration/simulation/params/wallet_utils.go index 550445b536..27e69aaad6 100644 --- a/integration/simulation/params/wallet_utils.go +++ b/integration/simulation/params/wallet_utils.go @@ -36,7 +36,10 @@ type SimWallets struct { SimEthWallets []wallet.Wallet // the wallets of the simulated users on the Ethereum side SimObsWallets []wallet.Wallet // and their equivalents on the obscuro side (with a different chainId) - L2FaucetWallet wallet.Wallet // the wallet of the L2 faucet + GasBridgeWallet wallet.Wallet + + L2FaucetWallet wallet.Wallet // the wallet of the L2 faucet + L2FeesWallet wallet.Wallet Tokens map[testcommon.ERC20]*SimToken // The supported tokens } @@ -66,6 +69,11 @@ func NewSimWallets(nrSimWallets int, nNodes int, ethereumChainID int64, obscuroC } l2FaucetWallet := wallet.NewInMemoryWalletFromPK(big.NewInt(obscuroChainID), l2FaucetPrivKey, testlog.Logger()) + gasWallet := wallet.NewInMemoryWalletFromPK(big.NewInt(ethereumChainID), genesis.GasBridgingKeys, testlog.Logger()) + + sequencerGasKeys, _ := crypto.GenerateKey() + sequencerFeeWallet := wallet.NewInMemoryWalletFromPK(big.NewInt(obscuroChainID), sequencerGasKeys, testlog.Logger()) + // create the L1 addresses of the two tokens, and connect them to the hardcoded addresses from the enclave hoc := SimToken{ Name: testcommon.HOC, @@ -81,11 +89,13 @@ func NewSimWallets(nrSimWallets int, nNodes int, ethereumChainID int64, obscuroC } return &SimWallets{ - MCOwnerWallet: mcOwnerWallet, - NodeWallets: nodeWallets, - SimEthWallets: simEthWallets, - SimObsWallets: simObsWallets, - L2FaucetWallet: l2FaucetWallet, + MCOwnerWallet: mcOwnerWallet, + NodeWallets: nodeWallets, + SimEthWallets: simEthWallets, + SimObsWallets: simObsWallets, + L2FaucetWallet: l2FaucetWallet, + L2FeesWallet: sequencerFeeWallet, + GasBridgeWallet: gasWallet, Tokens: map[testcommon.ERC20]*SimToken{ testcommon.HOC: &hoc, testcommon.POC: &poc, @@ -98,16 +108,10 @@ func (w *SimWallets) AllEthWallets() []wallet.Wallet { for _, token := range w.Tokens { ethWallets = append(ethWallets, token.L1Owner) } + ethWallets = append(ethWallets, w.GasBridgeWallet) return append(append(append(w.NodeWallets, w.SimEthWallets...), w.MCOwnerWallet), ethWallets...) } -func (w *SimWallets) AllEthAddresses() []*common.Address { - addresses := make([]*common.Address, 0) - addresses = append(addresses, w.Tokens[testcommon.HOC].L1ContractAddress) - addresses = append(addresses, w.Tokens[testcommon.POC].L1ContractAddress) - return addresses -} - func (w *SimWallets) AllObsWallets() []wallet.Wallet { obsWallets := make([]wallet.Wallet, 0) for _, token := range w.Tokens { diff --git a/integration/simulation/simulation.go b/integration/simulation/simulation.go index 44c0c05eb0..4c4a5c6b64 100644 --- a/integration/simulation/simulation.go +++ b/integration/simulation/simulation.go @@ -172,6 +172,7 @@ func (s *Simulation) deployObscuroERC20s() { GasFeeCap: gethcommon.Big1, // This field is used to derive the gas price for dynamic fee transactions. Data: contractBytes, } + signedTx, err := owner.SignTransaction(&deployContractTx) if err != nil { panic(err) diff --git a/integration/simulation/simulation_tester.go b/integration/simulation/simulation_tester.go index 6421ab8453..7179e24477 100644 --- a/integration/simulation/simulation_tester.go +++ b/integration/simulation/simulation_tester.go @@ -51,6 +51,7 @@ func testSimulation(t *testing.T, netw network.Network, params *params.SimParams params.MgmtContractLib, params.ERC20ContractLib, 0, + params, ) simulation := Simulation{ diff --git a/integration/simulation/transaction_injector.go b/integration/simulation/transaction_injector.go index 5a2d14f90e..cb9a074b7b 100644 --- a/integration/simulation/transaction_injector.go +++ b/integration/simulation/transaction_injector.go @@ -8,9 +8,12 @@ import ( "sync/atomic" "time" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/ecies" + "github.com/obscuronet/go-obscuro/contracts/generated/ManagementContract" + "github.com/obscuronet/go-obscuro/contracts/generated/MessageBus" "github.com/obscuronet/go-obscuro/go/common" "github.com/obscuronet/go-obscuro/go/common/log" "github.com/obscuronet/go-obscuro/go/ethadapter/erc20contractlib" @@ -18,6 +21,7 @@ import ( "github.com/obscuronet/go-obscuro/go/wallet" "github.com/obscuronet/go-obscuro/integration" "github.com/obscuronet/go-obscuro/integration/common/testlog" + "github.com/obscuronet/go-obscuro/integration/datagenerator" "github.com/obscuronet/go-obscuro/integration/simulation/network" "github.com/obscuronet/go-obscuro/integration/simulation/params" "golang.org/x/sync/errgroup" @@ -68,6 +72,8 @@ type TransactionInjector struct { // context for the transaction injector so in-flight requests can be cancelled gracefully ctx context.Context + params *params.SimParams + logger gethlog.Logger } @@ -81,6 +87,7 @@ func NewTransactionInjector( mgmtContractLib mgmtcontractlib.MgmtContractLib, erc20ContractLib erc20contractlib.ERC20ContractLib, txsToIssue int, + params *params.SimParams, ) *TransactionInjector { interrupt := int32(0) @@ -104,6 +111,7 @@ func NewTransactionInjector( TxTracker: newCounter(), enclavePublicKey: enclavePublicKeyEcies, txsToIssue: txsToIssue, + params: params, ctx: context.Background(), // for now we create a new context here, should allow it to be passed in logger: testlog.Logger().New(log.CmpKey, log.TxInjectCmp), } @@ -124,6 +132,15 @@ func (ti *TransactionInjector) Start() { return nil }) + // in mem sim does not support the contract libraries required + // to do complex bridge transactions + if !ti.params.IsInMem { + wg.Go(func() error { + ti.bridgeRandomGasTransfers() + return nil + }) + } + wg.Go(func() error { ti.issueRandomTransfers() return nil @@ -224,6 +241,48 @@ func (ti *TransactionInjector) issueRandomTransfers() { } } +func (ti *TransactionInjector) bridgeRandomGasTransfers() { + gasWallet := ti.wallets.GasBridgeWallet + + ethClient := ti.rpcHandles.RndEthClient() + + mgmtCtr, err := ManagementContract.NewManagementContract(*ti.mgmtContractAddr, ethClient.EthClient()) + if err != nil { + panic(err) + } + busAddr, err := mgmtCtr.MessageBus(&bind.CallOpts{}) + if err != nil { + panic(err) + } + + for txCounter := 0; ti.shouldKeepIssuing(txCounter); txCounter++ { + ethClient = ti.rpcHandles.RndEthClient() + + busCtr, err := MessageBus.NewMessageBus(busAddr, ethClient.EthClient()) + if err != nil { + panic(err) + } + + opts, err := bind.NewKeyedTransactorWithChainID(gasWallet.PrivateKey(), gasWallet.ChainID()) + if err != nil { + panic(err) + } + + receiverWallet := datagenerator.RandomWallet(ti.rndObsWallet().ChainID().Int64()) + amount := big.NewInt(0).SetUint64(testcommon.RndBtw(500, 100_000)) + opts.Value = big.NewInt(0).Set(amount) + + tx, err := busCtr.SendValueToL2(opts, receiverWallet.Address(), amount) + if err != nil { + panic(err) + } + + go ti.TxTracker.trackGasBridgingTx(tx, receiverWallet) + + sleepRndBtw(ti.avgBlockDuration/3, ti.avgBlockDuration) + } +} + // issueRandomDeposits creates and issues a number of transactions proportional to the simulation time, such that they can be processed func (ti *TransactionInjector) issueRandomDeposits() { // todo (@stefan) - this implementation transfers from the hoc and poc owner contracts diff --git a/integration/simulation/transaction_injector_tracker.go b/integration/simulation/transaction_injector_tracker.go index f5d1beba8c..70eafdcfc1 100644 --- a/integration/simulation/transaction_injector_tracker.go +++ b/integration/simulation/transaction_injector_tracker.go @@ -3,18 +3,27 @@ package simulation import ( "sync" + "github.com/ethereum/go-ethereum/core/types" "github.com/obscuronet/go-obscuro/go/ethadapter" + "github.com/obscuronet/go-obscuro/go/wallet" "github.com/obscuronet/go-obscuro/go/common" ) type txInjectorTracker struct { + gasTransactionsLock sync.RWMutex l1TransactionsLock sync.RWMutex L1Transactions []ethadapter.L1Transaction l2TransactionsLock sync.RWMutex TransferL2Transactions []*common.L2Tx NativeValueTransferL2Transactions []*common.L2Tx WithdrawalL2Transactions []*common.L2Tx + GasBridgeTransactions []GasBridgingRecord +} + +type GasBridgingRecord struct { + L1BridgeTx *types.Transaction + ReceiverWallet wallet.Wallet } func newCounter() *txInjectorTracker { @@ -24,9 +33,19 @@ func newCounter() *txInjectorTracker { l2TransactionsLock: sync.RWMutex{}, TransferL2Transactions: []*common.L2Tx{}, WithdrawalL2Transactions: []*common.L2Tx{}, + GasBridgeTransactions: []GasBridgingRecord{}, } } +func (m *txInjectorTracker) trackGasBridgingTx(tx *types.Transaction, receiverWallet wallet.Wallet) { + m.gasTransactionsLock.Lock() + defer m.gasTransactionsLock.Unlock() + m.GasBridgeTransactions = append(m.GasBridgeTransactions, GasBridgingRecord{ + L1BridgeTx: tx, + ReceiverWallet: receiverWallet, + }) +} + // trackL1Tx adds an L1Tx to the internal list func (m *txInjectorTracker) trackL1Tx(tx ethadapter.L1Transaction) { m.l1TransactionsLock.Lock() diff --git a/integration/simulation/utils.go b/integration/simulation/utils.go index b9a14bb119..f0047ce0d9 100644 --- a/integration/simulation/utils.go +++ b/integration/simulation/utils.go @@ -14,6 +14,7 @@ import ( testcommon "github.com/obscuronet/go-obscuro/integration/common" gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/obscuronet/go-obscuro/go/common" "github.com/obscuronet/go-obscuro/go/ethadapter/erc20contractlib" @@ -23,6 +24,8 @@ const ( testLogs = "../.build/simulations/" ) +var SequencerGasKeys, _ = crypto.GenerateKey() + func setupSimTestLog(simType string) { testlog.Setup(&testlog.Cfg{ LogDir: testLogs, diff --git a/integration/simulation/validate_chain.go b/integration/simulation/validate_chain.go index 47defcbbbd..8621b341c2 100644 --- a/integration/simulation/validate_chain.go +++ b/integration/simulation/validate_chain.go @@ -8,6 +8,9 @@ import ( "strings" "sync" "testing" + "time" + + "github.com/obscuronet/go-obscuro/contracts/generated/MessageBus" testcommon "github.com/obscuronet/go-obscuro/integration/common" "github.com/obscuronet/go-obscuro/integration/ethereummock" @@ -48,6 +51,7 @@ const ( // For example, all injected transactions were processed correctly, the height of the rollup chain is a function of the total // time of the simulation and the average block duration, that all Obscuro nodes are roughly in sync, etc func checkNetworkValidity(t *testing.T, s *Simulation) { + time.Sleep(2 * time.Second) checkTransactionsInjected(t, s) l1MaxHeight := checkEthereumBlockchainValidity(t, s) checkObscuroBlockchainValidity(t, s, l1MaxHeight) @@ -123,6 +127,34 @@ func checkObscuroBlockchainValidity(t *testing.T, s *Simulation, maxL1Height uin } } +func checkCollectedL1Fees(t *testing.T, node ethadapter.EthClient, s *Simulation, nodeIdx int, rollupReceipts types.Receipts) { + costOfRollups := big.NewInt(0) + + if !s.Params.IsInMem { + for _, receipt := range rollupReceipts { + block, err := node.EthClient().BlockByHash(context.Background(), receipt.BlockHash) + if err != nil { + panic(err) + } + + txCost := big.NewInt(0).Mul(block.BaseFee(), big.NewInt(0).SetUint64(receipt.GasUsed)) + costOfRollups.Add(costOfRollups, txCost) + } + + l2FeesWallet := s.Params.Wallets.L2FeesWallet + obsClients := network.CreateAuthClients(s.RPCHandles.RPCClients, l2FeesWallet) + feeBalance, err := obsClients[nodeIdx].BalanceAt(context.Background(), nil) + if err != nil { + panic(fmt.Errorf("failed getting balance for bridge transfer receiver. Cause: %w", err)) + } + + // if balance of collected fees is less than cost of published rollups fail + if feeBalance.Cmp(costOfRollups) == -1 { + t.Errorf("Node %d: Sequencer has collected insufficient fees. Has: %d, needs: %d", nodeIdx, feeBalance, costOfRollups) + } + } +} + func checkBlockchainOfEthereumNode(t *testing.T, node ethadapter.EthClient, minHeight uint64, s *Simulation, nodeIdx int) uint64 { head, err := node.FetchHeadBlock() if err != nil { @@ -134,9 +166,11 @@ func checkBlockchainOfEthereumNode(t *testing.T, node ethadapter.EthClient, minH t.Errorf("Node %d: There were only %d blocks mined. Expected at least: %d.", nodeIdx, height, minHeight) } - deposits, rollups, _, blockCount, _ := ExtractDataFromEthereumChain(ethereummock.MockGenesisBlock, head, node, s, nodeIdx) + deposits, rollups, _, blockCount, _, rollupReceipts := ExtractDataFromEthereumChain(ethereummock.MockGenesisBlock, head, node, s, nodeIdx) s.Stats.TotalL1Blocks = uint64(blockCount) + checkCollectedL1Fees(t, node, s, nodeIdx, rollupReceipts) + if len(findHashDups(deposits)) > 0 { dups := findHashDups(deposits) t.Errorf("Node %d: Found Deposit duplicates: %v", nodeIdx, dups) @@ -206,9 +240,10 @@ func ExtractDataFromEthereumChain( node ethadapter.EthClient, s *Simulation, nodeIdx int, -) ([]gethcommon.Hash, []*common.ExtRollup, *big.Int, int, uint64) { +) ([]gethcommon.Hash, []*common.ExtRollup, *big.Int, int, uint64, types.Receipts) { deposits := make([]gethcommon.Hash, 0) rollups := make([]*common.ExtRollup, 0) + rollupReceipts := make(types.Receipts, 0) totalDeposited := big.NewInt(0) blockchain := node.BlocksBetween(startBlock, endBlock) @@ -241,11 +276,40 @@ func ExtractDataFromEthereumChain( testlog.Logger().Crit("could not decode rollup. ", log.ErrKey, err) } rollups = append(rollups, r) + rollupReceipts = append(rollupReceipts, receipt) s.Stats.NewRollup(nodeIdx) } } } - return deposits, rollups, totalDeposited, len(blockchain), successfulDeposits + return deposits, rollups, totalDeposited, len(blockchain), successfulDeposits, rollupReceipts +} + +func verifyGasBridgeTransactions(t *testing.T, s *Simulation, nodeIdx int) { + time.Sleep(3 * time.Second) + mbusABI, _ := abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI)) + gasBridgeRecords := s.TxInjector.TxTracker.GasBridgeTransactions + for _, record := range gasBridgeRecords { + inputs, err := mbusABI.Methods["sendValueToL2"].Inputs.Unpack(record.L1BridgeTx.Data()[4:]) + if err != nil { + panic(err) + } + + receiver := inputs[0].(gethcommon.Address) + amount := inputs[1].(*big.Int) + + if receiver != record.ReceiverWallet.Address() { + panic("Test setup is broken. Receiver in tx should match recorded wallet.") + } + obsClients := network.CreateAuthClients(s.RPCHandles.RPCClients, record.ReceiverWallet) + balance, err := obsClients[nodeIdx].BalanceAt(context.Background(), nil) + if err != nil { + panic(fmt.Errorf("failed getting balance for bridge transfer receiver. Cause: %w", err)) + } + + if balance.Cmp(amount) != 0 { + t.Errorf("Node %d: Balance doesnt match the bridged amount. Have: %d, Want: %d", nodeIdx, balance, amount) + } + } } func checkBlockchainOfObscuroNode(t *testing.T, rpcHandles *network.RPCHandles, minObscuroHeight uint64, maxEthereumHeight uint64, s *Simulation, wg *sync.WaitGroup, heights []uint64, nodeIdx int) { @@ -291,6 +355,8 @@ func checkBlockchainOfObscuroNode(t *testing.T, rpcHandles *network.RPCHandles, t.Errorf("Node %d: Node's head batch had a height %d, but %s height was %d", nodeIdx, l2Height, rpc.BatchNumber, l2HeightFromBatchNumber) } + verifyGasBridgeTransactions(t, s, nodeIdx) + notFoundTransfers, notFoundWithdrawals, notFoundNativeTransfers := FindNotIncludedL2Txs(s.ctx, nodeIdx, rpcHandles, s.TxInjector) if notFoundTransfers > 0 { t.Errorf("Node %d: %d out of %d Transfer Txs not found in the enclave",