From 4d014f06c3033b5e2b3a5e00e49308863bd3957d Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 24 Feb 2021 15:31:53 -0800 Subject: [PATCH 01/41] Another stab at a good hardhat-deploy --- deploy/Lib_AddressManager.deploy.ts | 16 + deploy/OVM_BondManager.deploy.ts | 34 + .../OVM_CanonicalTransactionChain.deploy.ts | 36 + ...hainStorageContainer_ctc_batches.deploy.ts | 35 + ..._ChainStorageContainer_ctc_queue.deploy.ts | 35 + ...hainStorageContainer_scc_batches.deploy.ts | 35 + deploy/OVM_ExecutionManager.deploy.ts | 42 + deploy/OVM_FraudVerifier.deploy.ts | 33 + deploy/OVM_L1CrossDomainMessenger.deploy.ts | 28 + deploy/OVM_L1MultiMessageRelayer.deploy.ts | 33 + deploy/OVM_SafetyChecker.deploy.ts | 28 + deploy/OVM_StateCommitmentChain.deploy.ts | 35 + deploy/OVM_StateManagerFactory.deploy.ts | 28 + deploy/OVM_StateTransitionerFactory.deploy.ts | 33 + ...roxy__OVM_L1CrossDomainMessenger.deploy.ts | 33 + deployments/kovan/.chainId | 1 + deployments/kovan/Lib_AddressManager.json | 199 +++ deployments/kovan/OVM_BondManager.json | 529 +++++++ .../kovan/OVM_CanonicalTransactionChain.json | 800 +++++++++++ deployments/kovan/OVM_ExecutionManager.json | 1246 +++++++++++++++++ deployments/kovan/OVM_FraudVerifier.json | 552 ++++++++ .../kovan/OVM_StateCommitmentChain.json | 505 +++++++ .../kovan/OVM_StateManagerFactory.json | 74 + .../167e1592944606d9f946a16ee2ddffd3.json | 399 ++++++ hardhat.config.ts | 20 + package.json | 3 +- yarn.lock | 97 +- 27 files changed, 4894 insertions(+), 15 deletions(-) create mode 100644 deploy/Lib_AddressManager.deploy.ts create mode 100644 deploy/OVM_BondManager.deploy.ts create mode 100644 deploy/OVM_CanonicalTransactionChain.deploy.ts create mode 100644 deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts create mode 100644 deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts create mode 100644 deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts create mode 100644 deploy/OVM_ExecutionManager.deploy.ts create mode 100644 deploy/OVM_FraudVerifier.deploy.ts create mode 100644 deploy/OVM_L1CrossDomainMessenger.deploy.ts create mode 100644 deploy/OVM_L1MultiMessageRelayer.deploy.ts create mode 100644 deploy/OVM_SafetyChecker.deploy.ts create mode 100644 deploy/OVM_StateCommitmentChain.deploy.ts create mode 100644 deploy/OVM_StateManagerFactory.deploy.ts create mode 100644 deploy/OVM_StateTransitionerFactory.deploy.ts create mode 100644 deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts create mode 100644 deployments/kovan/.chainId create mode 100644 deployments/kovan/Lib_AddressManager.json create mode 100644 deployments/kovan/OVM_BondManager.json create mode 100644 deployments/kovan/OVM_CanonicalTransactionChain.json create mode 100644 deployments/kovan/OVM_ExecutionManager.json create mode 100644 deployments/kovan/OVM_FraudVerifier.json create mode 100644 deployments/kovan/OVM_StateCommitmentChain.json create mode 100644 deployments/kovan/OVM_StateManagerFactory.json create mode 100644 deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json diff --git a/deploy/Lib_AddressManager.deploy.ts b/deploy/Lib_AddressManager.deploy.ts new file mode 100644 index 000000000..c77791b80 --- /dev/null +++ b/deploy/Lib_AddressManager.deploy.ts @@ -0,0 +1,16 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + await deploy('Lib_AddressManager', { + from: deployer, + args: [], + log: true, + }) +} + +deployFn.tags = ['Lib_AddressManager', 'required'] + +export default deployFn diff --git a/deploy/OVM_BondManager.deploy.ts b/deploy/OVM_BondManager.deploy.ts new file mode 100644 index 000000000..fb003f6dd --- /dev/null +++ b/deploy/OVM_BondManager.deploy.ts @@ -0,0 +1,34 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_BondManager', { + from: deployer, + args: [ + '0x0000000000000000000000000000000000000000', + Lib_AddressManager.address, + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_BondManager', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_BondManager'] + +export default deployFn diff --git a/deploy/OVM_CanonicalTransactionChain.deploy.ts b/deploy/OVM_CanonicalTransactionChain.deploy.ts new file mode 100644 index 000000000..1cc7990d0 --- /dev/null +++ b/deploy/OVM_CanonicalTransactionChain.deploy.ts @@ -0,0 +1,36 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_CanonicalTransactionChain', { + from: deployer, + args: [ + Lib_AddressManager.address, + 600, // _forceInclusionPeriodSeconds + 10, // _forceInclusionPeriodBlocks + 9_000_000, // _maxTransactionGasLimit + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_CanonicalTransactionChain', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_CanonicalTransactionChain'] + +export default deployFn diff --git a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts new file mode 100644 index 000000000..eeb15cf81 --- /dev/null +++ b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -0,0 +1,35 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_ChainStorageContainer:CTC:batches', { + contract: 'OVM_ChainStorageContainer', + from: deployer, + args: [ + Lib_AddressManager.address, + 'OVM_CanonicalTransactionChain', + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_ChainStorageContainer:CTC:batches', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_ChainStorageContainer_ctc_batches'] + +export default deployFn diff --git a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts new file mode 100644 index 000000000..d45bec011 --- /dev/null +++ b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -0,0 +1,35 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_ChainStorageContainer:CTC:queue', { + contract: 'OVM_ChainStorageContainer', + from: deployer, + args: [ + Lib_AddressManager.address, + 'OVM_CanonicalTransactionChain', + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_ChainStorageContainer:CTC:queue', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_ChainStorageContainer_ctc_queue'] + +export default deployFn diff --git a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts new file mode 100644 index 000000000..065cb42d9 --- /dev/null +++ b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -0,0 +1,35 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_ChainStorageContainer:SCC:batches', { + contract: 'OVM_ChainStorageContainer', + from: deployer, + args: [ + Lib_AddressManager.address, + 'OVM_StateCommitmentChain' + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_ChainStorageContainer:SCC:queue', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_ChainStorageContainer_scc_batches'] + +export default deployFn diff --git a/deploy/OVM_ExecutionManager.deploy.ts b/deploy/OVM_ExecutionManager.deploy.ts new file mode 100644 index 000000000..8797bee99 --- /dev/null +++ b/deploy/OVM_ExecutionManager.deploy.ts @@ -0,0 +1,42 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_ExecutionManager', { + from: deployer, + args: [ + Lib_AddressManager.address, + { + minTransactionGasLimit: 20_000, + maxTransactionGasLimit: 9_000_000, + maxGasPerQueuePerEpoch: 9_000_000, + secondsPerEpoch: 0, + }, + { + ovmCHAINID: 10, + }, + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_ChainStorageContainer:ctc:batches', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_ExecutionManager'] + +export default deployFn diff --git a/deploy/OVM_FraudVerifier.deploy.ts b/deploy/OVM_FraudVerifier.deploy.ts new file mode 100644 index 000000000..e95755fa4 --- /dev/null +++ b/deploy/OVM_FraudVerifier.deploy.ts @@ -0,0 +1,33 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_FraudVerifier', { + from: deployer, + args: [ + Lib_AddressManager.address, + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_FraudVerifier', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_FraudVerifier'] + +export default deployFn diff --git a/deploy/OVM_L1CrossDomainMessenger.deploy.ts b/deploy/OVM_L1CrossDomainMessenger.deploy.ts new file mode 100644 index 000000000..6565ae4f1 --- /dev/null +++ b/deploy/OVM_L1CrossDomainMessenger.deploy.ts @@ -0,0 +1,28 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const contract = await deploy('OVM_L1CrossDomainMessenger', { + from: deployer, + args: [], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_L1CrossDomainMessenger', + contract.address, + ) + } +} + +deployFn.tags = ['OVM_L1CrossDomainMessenger'] + +export default deployFn diff --git a/deploy/OVM_L1MultiMessageRelayer.deploy.ts b/deploy/OVM_L1MultiMessageRelayer.deploy.ts new file mode 100644 index 000000000..16b87d853 --- /dev/null +++ b/deploy/OVM_L1MultiMessageRelayer.deploy.ts @@ -0,0 +1,33 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_L1MultiMessageRelayer', { + from: deployer, + args: [ + Lib_AddressManager.address, + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_L1MultiMessageRelayer', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_L1MultiMessageRelayer'] + +export default deployFn diff --git a/deploy/OVM_SafetyChecker.deploy.ts b/deploy/OVM_SafetyChecker.deploy.ts new file mode 100644 index 000000000..0372475a2 --- /dev/null +++ b/deploy/OVM_SafetyChecker.deploy.ts @@ -0,0 +1,28 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const contract = await deploy('OVM_SafetyChecker', { + from: deployer, + args: [], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_SafetyChecker', + contract.address, + ) + } +} + +deployFn.tags = ['OVM_SafetyChecker'] + +export default deployFn diff --git a/deploy/OVM_StateCommitmentChain.deploy.ts b/deploy/OVM_StateCommitmentChain.deploy.ts new file mode 100644 index 000000000..5221fa118 --- /dev/null +++ b/deploy/OVM_StateCommitmentChain.deploy.ts @@ -0,0 +1,35 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_StateCommitmentChain', { + from: deployer, + args: [ + Lib_AddressManager.address, + 60000, // _fraudProofWindow + 60000, // _sequencerPublishWindow + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_StateCommitmentChain', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_StateCommitmentChain'] + +export default deployFn diff --git a/deploy/OVM_StateManagerFactory.deploy.ts b/deploy/OVM_StateManagerFactory.deploy.ts new file mode 100644 index 000000000..fe68907cf --- /dev/null +++ b/deploy/OVM_StateManagerFactory.deploy.ts @@ -0,0 +1,28 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const contract = await deploy('OVM_StateManagerFactory', { + from: deployer, + args: [], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_StateManagerFactory', + contract.address, + ) + } +} + +deployFn.tags = ['OVM_StateManagerFactory'] + +export default deployFn diff --git a/deploy/OVM_StateTransitionerFactory.deploy.ts b/deploy/OVM_StateTransitionerFactory.deploy.ts new file mode 100644 index 000000000..a65444526 --- /dev/null +++ b/deploy/OVM_StateTransitionerFactory.deploy.ts @@ -0,0 +1,33 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('OVM_StateTransitionerFactory', { + from: deployer, + args: [ + Lib_AddressManager.address, + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'OVM_StateTransitionerFactory', + contract.address, + ) + } +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_StateTransitionerFactory'] + +export default deployFn diff --git a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts new file mode 100644 index 000000000..ab1ce1f05 --- /dev/null +++ b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts @@ -0,0 +1,33 @@ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +const deployFn: DeployFunction = async (hre) => { + const { deploy, execute } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + + const contract = await deploy('Lib_ResolvedDelegateProxy', { + from: deployer, + args: [ + Lib_AddressManager.address, + 'OVM_L1CrossDomainMessenger' + ], + log: true, + }) + + if (contract.newlyDeployed) { + await execute( + 'Lib_AddressManager', + { + from: deployer + }, + 'setAddress', + 'Proxy__OVM_L1CrossDomainMessenger', + contract.address, + ) + } +} + +deployFn.tags = ['Proxy__OVM_L1CrossDomainMessenger'] + +export default deployFn diff --git a/deployments/kovan/.chainId b/deployments/kovan/.chainId new file mode 100644 index 000000000..f70d7bba4 --- /dev/null +++ b/deployments/kovan/.chainId @@ -0,0 +1 @@ +42 \ No newline at end of file diff --git a/deployments/kovan/Lib_AddressManager.json b/deployments/kovan/Lib_AddressManager.json new file mode 100644 index 000000000..7cec2c6cc --- /dev/null +++ b/deployments/kovan/Lib_AddressManager.json @@ -0,0 +1,199 @@ +{ + "address": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "_newAddress", + "type": "address" + } + ], + "name": "AddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "setAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "transactionIndex": 3, + "gasUsed": "412650", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000021000000000000000000000000000000000000020000000000400000000800000000000000000000000000000400400000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x80415e44dde419392304c9f8036898532069aa96dec2e8c0311156e995f5e872", + "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 23635971, + "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", + "address": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000003a953298098cadcb621a40c1efcfb7dd73b727af" + ], + "data": "0x", + "logIndex": 5, + "blockHash": "0x80415e44dde419392304c9f8036898532069aa96dec2e8c0311156e995f5e872" + } + ], + "blockNumber": 23635971, + "cumulativeGasUsed": "628696", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newAddress\",\"type\":\"address\"}],\"name\":\"AddressSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"setAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Lib_AddressManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":\"Lib_AddressManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3610614806100696000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102b0565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102bf9050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061040c945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661043b565b6000546001600160a01b03163314610266576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031681565b6000546001600160a01b0316331461031e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b7f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a180600160006103d68561053a565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b60006001600061041b8461053a565b81526020810191909152604001600020546001600160a01b031692915050565b6000546001600160a01b0316331461049a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104df5760405162461bcd60e51b815260040180806020018281038252602d8152602001806105b2602d913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816040516020018082805190602001908083835b6020831061056f5780518252601f199092019160209182019101610550565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e65722063616e6e6f7420626520746865207a65726f2061646472657373a264697066735822122095c5f4afd9a031cfa8d1d10d7d5bf3946b88905c7069f918a94beb35351bd59d64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102b0565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102bf9050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061040c945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661043b565b6000546001600160a01b03163314610266576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031681565b6000546001600160a01b0316331461031e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b7f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a180600160006103d68561053a565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b60006001600061041b8461053a565b81526020810191909152604001600020546001600160a01b031692915050565b6000546001600160a01b0316331461049a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104df5760405162461bcd60e51b815260040180806020018281038252602d8152602001806105b2602d913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816040516020018082805190602001908083835b6020831061056f5780518252601f199092019160209182019101610550565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e65722063616e6e6f7420626520746865207a65726f2061646472657373a264697066735822122095c5f4afd9a031cfa8d1d10d7d5bf3946b88905c7069f918a94beb35351bd59d64736f6c63430007060033", + "devdoc": { + "kind": "dev", + "methods": {}, + "title": "Lib_AddressManager", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12369, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 12277, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", + "label": "addresses", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_address)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_address)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => address)", + "numberOfBytes": "32", + "value": "t_address" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_BondManager.json b/deployments/kovan/OVM_BondManager.json new file mode 100644 index 000000000..451f77a88 --- /dev/null +++ b/deployments/kovan/OVM_BondManager.json @@ -0,0 +1,529 @@ +{ + "address": "0x71869a507DC672f3D35352974b172403272256De", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "bonds", + "outputs": [ + { + "internalType": "enum iOVM_BondManager.State", + "name": "state", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "withdrawalTimestamp", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "firstDisputeAt", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "earliestDisputedStateRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "earliestTimestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disputePeriodSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "publisher", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "finalize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "preStateRoot", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "getGasSpent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "who", + "type": "address" + } + ], + "name": "isCollateralized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "multiFraudProofPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_txHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasSpent", + "type": "uint256" + } + ], + "name": "recordGasSpent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requiredCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "startWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "witnessProviders", + "outputs": [ + { + "internalType": "bool", + "name": "canClaim", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6bcc8754bc27dc40c113f2f20644b0e9f0f7f2d901d327dfa19fb4fdbc853f11", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x71869a507DC672f3D35352974b172403272256De", + "transactionIndex": 2, + "gasUsed": "1096239", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe99aed539905019ac91fbdeac018736d318ffc7992884100a1b7388dcf953ee3", + "transactionHash": "0x6bcc8754bc27dc40c113f2f20644b0e9f0f7f2d901d327dfa19fb4fdbc853f11", + "logs": [], + "blockNumber": 23635972, + "cumulativeGasUsed": "1264939", + "status": 1, + "byzantium": true + }, + "args": [ + "0x0000000000000000000000000000000000000000", + "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"enum iOVM_BondManager.State\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"withdrawalTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"firstDisputeAt\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"earliestDisputedStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"earliestTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisher\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"finalize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"multiFraudProofPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasSpent\",\"type\":\"uint256\"}],\"name\":\"recordGasSpent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"requiredCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"witnessProviders\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canClaim\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Bond Manager contract handles deposits in the form of an ERC20 token from bonded Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, and the Verifier's gas costs are refunded. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{},\"title\":\"OVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bonds(address)\":{\"notice\":\"The bonds posted by each proposer\"},\"claim(address)\":{\"notice\":\"Claims the user's reward for the witnesses they provided for the earliest disputed state root of the designated publisher\"},\"constructor\":{\"notice\":\"Initializes with a ERC20 token to be used for the fidelity bonds and with the Address Manager\"},\"deposit()\":{\"notice\":\"Sequencers call this function to post collateral which will be used for the `appendBatch` call\"},\"disputePeriodSeconds()\":{\"notice\":\"The dispute period\"},\"finalize(bytes32,address,uint256)\":{\"notice\":\"Slashes + distributes rewards or frees up the sequencer's bond, only called by `FraudVerifier.finalizeFraudVerification`\"},\"finalizeWithdrawal()\":{\"notice\":\"Finalizes a pending withdrawal from a publisher\"},\"getGasSpent(bytes32,address)\":{\"notice\":\"Gets how many witnesses the user has provided for the state root\"},\"isCollateralized(address)\":{\"notice\":\"Checks if the user is collateralized\"},\"multiFraudProofPeriod()\":{\"notice\":\"The period to find the earliest fraud proof for a publisher\"},\"recordGasSpent(bytes32,bytes32,address,uint256)\":{\"notice\":\"Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\"},\"requiredCollateral()\":{\"notice\":\"The minimum collateral a sequencer must post\"},\"startWithdrawal()\":{\"notice\":\"Starts the withdrawal for a publisher\"},\"token()\":{\"notice\":\"The bond token\"},\"witnessProviders(bytes32)\":{\"notice\":\"For each pre-state root, there's an array of witnessProviders that must be rewarded for posting witnesses\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":\"OVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_BondManager, Errors, ERC20 } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\n\\n/**\\n * @title OVM_BondManager\\n * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded \\n * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a\\n * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, \\n * and the Verifier's gas costs are refunded.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\\n\\n /****************************\\n * Constants and Parameters *\\n ****************************/\\n\\n /// The period to find the earliest fraud proof for a publisher\\n uint256 public constant multiFraudProofPeriod = 7 days;\\n\\n /// The dispute period\\n uint256 public constant disputePeriodSeconds = 7 days;\\n\\n /// The minimum collateral a sequencer must post\\n uint256 public constant requiredCollateral = 1 ether;\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n /// The bond token\\n ERC20 immutable public token;\\n\\n\\n /********************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n /// The bonds posted by each proposer\\n mapping(address => Bond) public bonds;\\n\\n /// For each pre-state root, there's an array of witnessProviders that must be rewarded\\n /// for posting witnesses\\n mapping(bytes32 => Rewards) public witnessProviders;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /// Initializes with a ERC20 token to be used for the fidelity bonds\\n /// and with the Address Manager\\n constructor(\\n ERC20 _token,\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n token = _token;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\\n function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public {\\n // The sender must be the transitioner that corresponds to the claimed pre-state root\\n address transitioner = address(iOVM_FraudVerifier(resolve(\\\"OVM_FraudVerifier\\\")).getStateTransitioner(_preStateRoot, _txHash));\\n require(transitioner == msg.sender, Errors.ONLY_TRANSITIONER);\\n\\n witnessProviders[_preStateRoot].total += gasSpent;\\n witnessProviders[_preStateRoot].gasSpent[who] += gasSpent;\\n }\\n\\n /// Slashes + distributes rewards or frees up the sequencer's bond, only called by\\n /// `FraudVerifier.finalizeFraudVerification`\\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {\\n require(msg.sender == resolve(\\\"OVM_FraudVerifier\\\"), Errors.ONLY_FRAUD_VERIFIER);\\n require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);\\n\\n // allow users to claim from that state root's\\n // pool of collateral (effectively slashing the sequencer)\\n witnessProviders[_preStateRoot].canClaim = true;\\n\\n Bond storage bond = bonds[publisher];\\n if (bond.firstDisputeAt == 0) {\\n bond.firstDisputeAt = block.timestamp;\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n } else if (\\n // only update the disputed state root for the publisher if it's within\\n // the dispute period _and_ if it's before the previous one\\n block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod &&\\n timestamp < bond.earliestTimestamp\\n ) {\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n }\\n\\n // if the fraud proof's dispute period does not intersect with the \\n // withdrawal's timestamp, then the user should not be slashed\\n // e.g if a user at day 10 submits a withdrawal, and a fraud proof\\n // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d)\\n // is before the user started their withdrawal. on the contrary, if the user\\n // had started their withdrawal at, say, day 6, they would be slashed\\n if (\\n bond.withdrawalTimestamp != 0 && \\n uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds &&\\n bond.state == State.WITHDRAWING\\n ) {\\n return;\\n }\\n\\n // slash!\\n bond.state = State.NOT_COLLATERALIZED;\\n }\\n\\n /// Sequencers call this function to post collateral which will be used for\\n /// the `appendBatch` call\\n function deposit() override public {\\n require(\\n token.transferFrom(msg.sender, address(this), requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n\\n // This cannot overflow\\n bonds[msg.sender].state = State.COLLATERALIZED;\\n }\\n\\n /// Starts the withdrawal for a publisher\\n function startWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n require(bond.withdrawalTimestamp == 0, Errors.WITHDRAWAL_PENDING);\\n require(bond.state == State.COLLATERALIZED, Errors.WRONG_STATE);\\n\\n bond.state = State.WITHDRAWING;\\n bond.withdrawalTimestamp = uint32(block.timestamp);\\n }\\n\\n /// Finalizes a pending withdrawal from a publisher\\n function finalizeWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n\\n require(\\n block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, \\n Errors.TOO_EARLY\\n );\\n require(bond.state == State.WITHDRAWING, Errors.SLASHED);\\n \\n // refunds!\\n bond.state = State.NOT_COLLATERALIZED;\\n bond.withdrawalTimestamp = 0;\\n \\n require(\\n token.transfer(msg.sender, requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n }\\n\\n /// Claims the user's reward for the witnesses they provided for the earliest\\n /// disputed state root of the designated publisher\\n function claim(address who) override public {\\n Bond storage bond = bonds[who];\\n require(\\n block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod,\\n Errors.WAIT_FOR_DISPUTES\\n );\\n\\n // reward the earliest state root for this publisher\\n bytes32 _preStateRoot = bond.earliestDisputedStateRoot;\\n Rewards storage rewards = witnessProviders[_preStateRoot];\\n\\n // only allow claiming if fraud was proven in `finalize`\\n require(rewards.canClaim, Errors.CANNOT_CLAIM);\\n\\n // proportional allocation - only reward 50% (rest gets locked in the\\n // contract forever\\n uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total);\\n\\n // reset the user's spent gas so they cannot double claim\\n rewards.gasSpent[msg.sender] = 0;\\n\\n // transfer\\n require(token.transfer(msg.sender, amount), Errors.ERC20_ERR);\\n }\\n\\n /// Checks if the user is collateralized\\n function isCollateralized(address who) override public view returns (bool) {\\n return bonds[who].state == State.COLLATERALIZED;\\n }\\n\\n /// Gets how many witnesses the user has provided for the state root\\n function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) {\\n return witnessProviders[preStateRoot].gasSpent[who];\\n }\\n}\\n\",\"keccak256\":\"0xad36f4e83cc43072164586ecb272fd444057a95026ab60cf04d51837a82b2020\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161130b38038061130b8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b0319166001600160a01b03928316178155606083901b6001600160601b031916608052911690611278906100939039806106f45280610d6d5280610ea15280610fe252506112786000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c8063abfbbe1311610097578063d0e30db011610066578063d0e30db0146102f2578063dc6453dc146102fa578063fc0c546a14610326578063fe10d7741461032e576100f5565b8063abfbbe13146102a8578063b53105a3146102da578063bc2f8dd8146102e2578063c5b6aa2f146102ea576100f5565b80631e16e92f116100d35780631e16e92f1461014e5780631e83409a14610188578063461a4478146101ae5780635b7c615f14610270576100f5565b806302ad4d2a146100fa5780630756183b146101345780631e0983bd14610134575b600080fd5b6101206004803603602081101561011057600080fd5b50356001600160a01b0316610397565b604080519115158252519081900360200190f35b61013c6103c9565b60408051918252519081900360200190f35b6101866004803603608081101561016457600080fd5b508035906020810135906001600160a01b0360408201351690606001356103d0565b005b6101866004803603602081101561019e57600080fd5b50356001600160a01b0316610569565b610254600480360360208110156101c457600080fd5b8101906020810181356401000000008111156101df57600080fd5b8201836020820111156101f157600080fd5b8035906020019184600183028401116401000000008311171561021357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107f6945050505050565b604080516001600160a01b039092168252519081900360200190f35b61028d6004803603602081101561028657600080fd5b50356108d2565b60408051921515835260208301919091528051918290030190f35b610186600480360360608110156102be57600080fd5b508035906001600160a01b0360208201351690604001356108f1565b61013c610afc565b610186610b08565b610186610c2e565b610186610e6d565b61013c6004803603604081101561031057600080fd5b50803590602001356001600160a01b0316610fb5565b610254610fe0565b6103546004803603602081101561034457600080fd5b50356001600160a01b0316611004565b6040518086600281111561036457fe5b81526020018563ffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390f35b600060016001600160a01b03831660009081526001602052604090205460ff1660028111156103c257fe5b1492915050565b62093a8081565b60006104046040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b031663b48ec82086866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051604080516080810190915260518082529192506001600160a01b03831633149161112d60208301399061052c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104f15781810151838201526020016104d9565b50505050905090810190601f16801561051e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50506000938452600260208181526040808720600181018054860190556001600160a01b0390951687529390910190529220805490920190915550565b600060016000836001600160a01b03166001600160a01b03168152602001908152602001600020905062093a808160010154014210156040518060600160405280602e81526020016111b0602e9139906106045760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50600280820154600081815260209283526040908190208054825160608101909352603e8084529394919360ff909116929161103c90830139906106895760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060018101543360009081526002808401602052604082205491920290670de0b6b3a764000002816106b757fe5b3360008181526002860160209081526040808320839055805163a9059cbb60e01b81526004810194909452949093046024830181905293519394507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169363a9059cbb936044808501949193918390030190829087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b505050506040513d602081101561076c57600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e6490820152906107ee5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561085657818101518382015260200161083e565b50505050905090810190601f1680156108835780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156108a057600080fd5b505afa1580156108b4573d6000803e3d6000fd5b505050506040513d60208110156108ca57600080fd5b505192915050565b6002602052600090815260409020805460019091015460ff9091169082565b6109236040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b0316336001600160a01b0316146040518060600160405280603b8152602001611208603b91399061099c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060008381526002602090815260409182902054825160808101909352604b80845260ff9091161592916110bb9083013990610a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506000838152600260209081526040808320805460ff191660019081179091556001600160a01b03861684529182905290912090810154610a6d574260018201556002810184905560038101829055610a9c565b62093a8081600101540142108015610a885750806003015482105b15610a9c5760028101849055600381018290555b8054610100900463ffffffff1615801590610ac85750805462093a80830161010090910463ffffffff16115b8015610ae357506002815460ff166002811115610ae157fe5b145b15610aee5750610af7565b805460ff191690555b505050565b670de0b6b3a764000081565b3360009081526001602090815260409182902080548351606081019094526027808552919361010090910463ffffffff1615929091906111069083013990610b915760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506001815460ff166002811115610ba457fe5b146040518060600160405280602a81526020016111de602a913990610c0a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b508054600260ff199091161764ffffffff0019166101004263ffffffff1602179055565b3360009081526001602090815260409182902080548351606081019094526032808552919363ffffffff6101009092049190911662093a80014210159290919061117e9083013990610cc15760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506002815460ff166002811115610cd457fe5b1460405180608001604052806041815260200161107a6041913990610d3a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50805464ffffffffff191681556040805163a9059cbb60e01b8152336004820152670de0b6b3a7640000602482015290517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163a9059cbb9160448083019260209291908290030181600087803b158015610dbd57600080fd5b505af1158015610dd1573d6000803e3d6000fd5b505050506040513d6020811015610de757600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610e695760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5050565b604080516323b872dd60e01b8152336004820152306024820152670de0b6b3a7640000604482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916323b872dd9160648083019260209291908290030181600087803b158015610ee957600080fd5b505af1158015610efd573d6000803e3d6000fd5b505050506040513d6020811015610f1357600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610f955760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50336000908152600160208190526040909120805460ff19169091179055565b60008281526002602081815260408084206001600160a01b0386168552909201905290205492915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602081905260009182526040909120805491810154600282015460039092015460ff841693610100900463ffffffff1692908556fe426f6e644d616e616765723a2043616e6e6f7420636c61696d207965742e2044697370757465206d7573742062652066696e616c697a6564206669727374426f6e644d616e616765723a2043616e6e6f742066696e616c697a65207769746864726177616c2c20796f752070726f6261626c7920676f7420736c6173686564426f6e644d616e616765723a2046726175642070726f6f6620666f722074686973207072652d737461746520726f6f742068617320616c7265616479206265656e2066696e616c697a6564426f6e644d616e616765723a205769746864726177616c20616c72656164792070656e64696e67426f6e644d616e616765723a204f6e6c7920746865207472616e736974696f6e657220666f722074686973207072652d737461746520726f6f74206d61792063616c6c20746869732066756e6374696f6e426f6e644d616e616765723a20546f6f206561726c7920746f2066696e616c697a6520796f7572207769746864726177616c426f6e644d616e616765723a205761697420666f72206f7468657220706f74656e7469616c206469737075746573426f6e644d616e616765723a2057726f6e6720626f6e6420737461746520666f722070726f706f736572426f6e644d616e616765723a204f6e6c7920746865206672617564207665726966696572206d61792063616c6c20746869732066756e6374696f6ea2646970667358221220812f7206bb4779720cf03f1e4ab5e1deb0c906eb92fc96852dc855750584dcdb64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063abfbbe1311610097578063d0e30db011610066578063d0e30db0146102f2578063dc6453dc146102fa578063fc0c546a14610326578063fe10d7741461032e576100f5565b8063abfbbe13146102a8578063b53105a3146102da578063bc2f8dd8146102e2578063c5b6aa2f146102ea576100f5565b80631e16e92f116100d35780631e16e92f1461014e5780631e83409a14610188578063461a4478146101ae5780635b7c615f14610270576100f5565b806302ad4d2a146100fa5780630756183b146101345780631e0983bd14610134575b600080fd5b6101206004803603602081101561011057600080fd5b50356001600160a01b0316610397565b604080519115158252519081900360200190f35b61013c6103c9565b60408051918252519081900360200190f35b6101866004803603608081101561016457600080fd5b508035906020810135906001600160a01b0360408201351690606001356103d0565b005b6101866004803603602081101561019e57600080fd5b50356001600160a01b0316610569565b610254600480360360208110156101c457600080fd5b8101906020810181356401000000008111156101df57600080fd5b8201836020820111156101f157600080fd5b8035906020019184600183028401116401000000008311171561021357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107f6945050505050565b604080516001600160a01b039092168252519081900360200190f35b61028d6004803603602081101561028657600080fd5b50356108d2565b60408051921515835260208301919091528051918290030190f35b610186600480360360608110156102be57600080fd5b508035906001600160a01b0360208201351690604001356108f1565b61013c610afc565b610186610b08565b610186610c2e565b610186610e6d565b61013c6004803603604081101561031057600080fd5b50803590602001356001600160a01b0316610fb5565b610254610fe0565b6103546004803603602081101561034457600080fd5b50356001600160a01b0316611004565b6040518086600281111561036457fe5b81526020018563ffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390f35b600060016001600160a01b03831660009081526001602052604090205460ff1660028111156103c257fe5b1492915050565b62093a8081565b60006104046040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b031663b48ec82086866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051604080516080810190915260518082529192506001600160a01b03831633149161112d60208301399061052c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104f15781810151838201526020016104d9565b50505050905090810190601f16801561051e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50506000938452600260208181526040808720600181018054860190556001600160a01b0390951687529390910190529220805490920190915550565b600060016000836001600160a01b03166001600160a01b03168152602001908152602001600020905062093a808160010154014210156040518060600160405280602e81526020016111b0602e9139906106045760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50600280820154600081815260209283526040908190208054825160608101909352603e8084529394919360ff909116929161103c90830139906106895760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060018101543360009081526002808401602052604082205491920290670de0b6b3a764000002816106b757fe5b3360008181526002860160209081526040808320839055805163a9059cbb60e01b81526004810194909452949093046024830181905293519394507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169363a9059cbb936044808501949193918390030190829087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b505050506040513d602081101561076c57600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e6490820152906107ee5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561085657818101518382015260200161083e565b50505050905090810190601f1680156108835780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156108a057600080fd5b505afa1580156108b4573d6000803e3d6000fd5b505050506040513d60208110156108ca57600080fd5b505192915050565b6002602052600090815260409020805460019091015460ff9091169082565b6109236040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b0316336001600160a01b0316146040518060600160405280603b8152602001611208603b91399061099c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060008381526002602090815260409182902054825160808101909352604b80845260ff9091161592916110bb9083013990610a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506000838152600260209081526040808320805460ff191660019081179091556001600160a01b03861684529182905290912090810154610a6d574260018201556002810184905560038101829055610a9c565b62093a8081600101540142108015610a885750806003015482105b15610a9c5760028101849055600381018290555b8054610100900463ffffffff1615801590610ac85750805462093a80830161010090910463ffffffff16115b8015610ae357506002815460ff166002811115610ae157fe5b145b15610aee5750610af7565b805460ff191690555b505050565b670de0b6b3a764000081565b3360009081526001602090815260409182902080548351606081019094526027808552919361010090910463ffffffff1615929091906111069083013990610b915760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506001815460ff166002811115610ba457fe5b146040518060600160405280602a81526020016111de602a913990610c0a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b508054600260ff199091161764ffffffff0019166101004263ffffffff1602179055565b3360009081526001602090815260409182902080548351606081019094526032808552919363ffffffff6101009092049190911662093a80014210159290919061117e9083013990610cc15760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506002815460ff166002811115610cd457fe5b1460405180608001604052806041815260200161107a6041913990610d3a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50805464ffffffffff191681556040805163a9059cbb60e01b8152336004820152670de0b6b3a7640000602482015290517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163a9059cbb9160448083019260209291908290030181600087803b158015610dbd57600080fd5b505af1158015610dd1573d6000803e3d6000fd5b505050506040513d6020811015610de757600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610e695760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5050565b604080516323b872dd60e01b8152336004820152306024820152670de0b6b3a7640000604482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916323b872dd9160648083019260209291908290030181600087803b158015610ee957600080fd5b505af1158015610efd573d6000803e3d6000fd5b505050506040513d6020811015610f1357600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610f955760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50336000908152600160208190526040909120805460ff19169091179055565b60008281526002602081815260408084206001600160a01b0386168552909201905290205492915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602081905260009182526040909120805491810154600282015460039092015460ff841693610100900463ffffffff1692908556fe426f6e644d616e616765723a2043616e6e6f7420636c61696d207965742e2044697370757465206d7573742062652066696e616c697a6564206669727374426f6e644d616e616765723a2043616e6e6f742066696e616c697a65207769746864726177616c2c20796f752070726f6261626c7920676f7420736c6173686564426f6e644d616e616765723a2046726175642070726f6f6620666f722074686973207072652d737461746520726f6f742068617320616c7265616479206265656e2066696e616c697a6564426f6e644d616e616765723a205769746864726177616c20616c72656164792070656e64696e67426f6e644d616e616765723a204f6e6c7920746865207472616e736974696f6e657220666f722074686973207072652d737461746520726f6f74206d61792063616c6c20746869732066756e6374696f6e426f6e644d616e616765723a20546f6f206561726c7920746f2066696e616c697a6520796f7572207769746864726177616c426f6e644d616e616765723a205761697420666f72206f7468657220706f74656e7469616c206469737075746573426f6e644d616e616765723a2057726f6e6720626f6e6420737461746520666f722070726f706f736572426f6e644d616e616765723a204f6e6c7920746865206672617564207665726966696572206d61792063616c6c20746869732066756e6374696f6ea2646970667358221220812f7206bb4779720cf03f1e4ab5e1deb0c906eb92fc96852dc855750584dcdb64736f6c63430007060033", + "devdoc": { + "details": "The Bond Manager contract handles deposits in the form of an ERC20 token from bonded Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, and the Verifier's gas costs are refunded. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": {}, + "title": "OVM_BondManager", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "bonds(address)": { + "notice": "The bonds posted by each proposer" + }, + "claim(address)": { + "notice": "Claims the user's reward for the witnesses they provided for the earliest disputed state root of the designated publisher" + }, + "constructor": { + "notice": "Initializes with a ERC20 token to be used for the fidelity bonds and with the Address Manager" + }, + "deposit()": { + "notice": "Sequencers call this function to post collateral which will be used for the `appendBatch` call" + }, + "disputePeriodSeconds()": { + "notice": "The dispute period" + }, + "finalize(bytes32,address,uint256)": { + "notice": "Slashes + distributes rewards or frees up the sequencer's bond, only called by `FraudVerifier.finalizeFraudVerification`" + }, + "finalizeWithdrawal()": { + "notice": "Finalizes a pending withdrawal from a publisher" + }, + "getGasSpent(bytes32,address)": { + "notice": "Gets how many witnesses the user has provided for the state root" + }, + "isCollateralized(address)": { + "notice": "Checks if the user is collateralized" + }, + "multiFraudProofPeriod()": { + "notice": "The period to find the earliest fraud proof for a publisher" + }, + "recordGasSpent(bytes32,bytes32,address,uint256)": { + "notice": "Adds `who` to the list of witnessProviders for the provided `preStateRoot`." + }, + "requiredCollateral()": { + "notice": "The minimum collateral a sequencer must post" + }, + "startWithdrawal()": { + "notice": "Starts the withdrawal for a publisher" + }, + "token()": { + "notice": "The bond token" + }, + "witnessProviders(bytes32)": { + "notice": "For each pre-state root, there's an array of witnessProviders that must be rewarded for posting witnesses" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 8405, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "bonds", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_struct(Bond)11292_storage)" + }, + { + "astId": 8410, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "witnessProviders", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_struct(Rewards)11301_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_enum(State)11281": { + "encoding": "inplace", + "label": "enum iOVM_BondManager.State", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_struct(Bond)11292_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct iOVM_BondManager.Bond)", + "numberOfBytes": "32", + "value": "t_struct(Bond)11292_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_struct(Rewards)11301_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct iOVM_BondManager.Rewards)", + "numberOfBytes": "32", + "value": "t_struct(Rewards)11301_storage" + }, + "t_struct(Bond)11292_storage": { + "encoding": "inplace", + "label": "struct iOVM_BondManager.Bond", + "members": [ + { + "astId": 11283, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "state", + "offset": 0, + "slot": "0", + "type": "t_enum(State)11281" + }, + { + "astId": 11285, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "withdrawalTimestamp", + "offset": 1, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 11287, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "firstDisputeAt", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11289, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "earliestDisputedStateRoot", + "offset": 0, + "slot": "2", + "type": "t_bytes32" + }, + { + "astId": 11291, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "earliestTimestamp", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Rewards)11301_storage": { + "encoding": "inplace", + "label": "struct iOVM_BondManager.Rewards", + "members": [ + { + "astId": 11294, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "canClaim", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 11296, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "total", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11300, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", + "label": "gasSpent", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "numberOfBytes": "96" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_CanonicalTransactionChain.json b/deployments/kovan/OVM_CanonicalTransactionChain.json new file mode 100644 index 000000000..dfb6836e3 --- /dev/null +++ b/deployments/kovan/OVM_CanonicalTransactionChain.json @@ -0,0 +1,800 @@ +{ + "address": "0xBb6D8540E168061fe9dbB061d234a00A780d10D5", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_forceInclusionPeriodSeconds", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_forceInclusionPeriodBlocks", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxTransactionGasLimit", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_startingQueueIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_numQueueElements", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_totalElements", + "type": "uint256" + } + ], + "name": "QueueBatchAppended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_startingQueueIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_numQueueElements", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_totalElements", + "type": "uint256" + } + ], + "name": "SequencerBatchAppended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_batchIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_batchRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_prevTotalElements", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "TransactionBatchAppended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_l1TxOrigin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_data", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_queueIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_timestamp", + "type": "uint256" + } + ], + "name": "TransactionEnqueued", + "type": "event" + }, + { + "inputs": [], + "name": "L2_GAS_DISCOUNT_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_ROLLUP_TX_SIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_ROLLUP_TX_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_numQueuedTransactions", + "type": "uint256" + } + ], + "name": "appendQueueBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "appendSequencerBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "batches", + "outputs": [ + { + "internalType": "contract iOVM_ChainStorageContainer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "enqueue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "forceInclusionPeriodBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "forceInclusionPeriodSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLastBlockNumber", + "outputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLastTimestamp", + "outputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextQueueIndex", + "outputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNumPendingQueueElements", + "outputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getQueueElement", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "queueRoot", + "type": "bytes32" + }, + { + "internalType": "uint40", + "name": "timestamp", + "type": "uint40" + }, + { + "internalType": "uint40", + "name": "blockNumber", + "type": "uint40" + } + ], + "internalType": "struct Lib_OVMCodec.QueueElement", + "name": "_element", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getQueueLength", + "outputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBatches", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalBatches", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalElements", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalElements", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxTransactionGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "queue", + "outputs": [ + { + "internalType": "contract iOVM_ChainStorageContainer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "enum Lib_OVMCodec.QueueOrigin", + "name": "l1QueueOrigin", + "type": "uint8" + }, + { + "internalType": "address", + "name": "l1TxOrigin", + "type": "address" + }, + { + "internalType": "address", + "name": "entrypoint", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.Transaction", + "name": "_transaction", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isSequenced", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "queueIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "txData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.TransactionChainElement", + "name": "_txChainElement", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_batchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_inclusionProof", + "type": "tuple" + } + ], + "name": "verifyTransaction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd195e634a334664c61e6d7bb9281209e14c7a55531c55a78ca40b144c6d20a16", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0xBb6D8540E168061fe9dbB061d234a00A780d10D5", + "transactionIndex": 2, + "gasUsed": "2859140", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3089f59aa3e8d7312a47129073d12786b52febc00d34a394ae9031411263d7a8", + "transactionHash": "0xd195e634a334664c61e6d7bb9281209e14c7a55531c55a78ca40b144c6d20a16", + "logs": [], + "blockNumber": 23635974, + "cumulativeGasUsed": "2929664", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + 600, + 10, + 9000000 + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_forceInclusionPeriodSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_forceInclusionPeriodBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_startingQueueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numQueueElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"name\":\"QueueBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_startingQueueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numQueueElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"name\":\"SequencerBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_prevTotalElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"TransactionBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_l1TxOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timestamp\",\"type\":\"uint256\"}],\"name\":\"TransactionEnqueued\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"L2_GAS_DISCOUNT_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_ROLLUP_TX_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_ROLLUP_TX_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numQueuedTransactions\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"appendSequencerBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batches\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"enqueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forceInclusionPeriodBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forceInclusionPeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastBlockNumber\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastTimestamp\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNextQueueIndex\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNumPendingQueueElements\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getQueueElement\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"queueRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint40\",\"name\":\"timestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"blockNumber\",\"type\":\"uint40\"}],\"internalType\":\"struct Lib_OVMCodec.QueueElement\",\"name\":\"_element\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getQueueLength\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalBatches\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBatches\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalElements\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"queue\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"isSequenced\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"txData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.TransactionChainElement\",\"name\":\"_txChainElement\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_inclusionProof\",\"type\":\"tuple\"}],\"name\":\"verifyTransaction\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Canonical Transaction Chain (CTC) contract is an append-only log of transactions which must be applied to the rollup state. It defines the ordering of rollup transactions by writing them to the 'CTC:batches' instance of the Chain Storage Container. The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer will eventually append it to the rollup state. If the Sequencer does not include an enqueued transaction within the 'force inclusion period', then any account may force it to be included by calling appendQueueBatch(). Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"appendQueueBatch(uint256)\":{\"params\":{\"_numQueuedTransactions\":\"Number of transactions to append.\"}},\"appendSequencerBatch()\":{\"details\":\"This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch contexts. .param _transactionDataFields Array of raw transaction data.\"},\"batches()\":{\"returns\":{\"_0\":\"Reference to the batch storage container.\"}},\"enqueue(address,uint256,bytes)\":{\"params\":{\"_data\":\"Transaction data.\",\"_gasLimit\":\"Gas limit for the enqueued L2 transaction.\",\"_target\":\"Target L2 contract to send the transaction to.\"}},\"getLastBlockNumber()\":{\"returns\":{\"_0\":\"Blocknumber for the last transaction.\"}},\"getLastTimestamp()\":{\"returns\":{\"_0\":\"Timestamp for the last transaction.\"}},\"getNextQueueIndex()\":{\"returns\":{\"_0\":\"Index for the next queue element.\"}},\"getNumPendingQueueElements()\":{\"returns\":{\"_0\":\"Number of pending queue elements.\"}},\"getQueueElement(uint256)\":{\"params\":{\"_index\":\"Index of the queue element to access.\"},\"returns\":{\"_element\":\"Queue element at the given index.\"}},\"getQueueLength()\":{\"returns\":{\"_0\":\"Length of the queue.\"}},\"getTotalBatches()\":{\"returns\":{\"_totalBatches\":\"Total submitted batches.\"}},\"getTotalElements()\":{\"returns\":{\"_totalElements\":\"Total submitted elements.\"}},\"queue()\":{\"returns\":{\"_0\":\"Reference to the queue storage container.\"}},\"verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_batchHeader\":\"Header of the batch the transaction was included in.\",\"_inclusionProof\":\"Inclusion proof for the provided transaction chain element.\",\"_transaction\":\"Transaction to verify.\",\"_txChainElement\":\"Transaction chain element corresponding to the transaction.\"},\"returns\":{\"_0\":\"True if the transaction exists in the CTC, false if not.\"}}},\"title\":\"OVM_CanonicalTransactionChain\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"appendQueueBatch(uint256)\":{\"notice\":\"Appends a given number of queued transactions as a single batch.\"},\"appendSequencerBatch()\":{\"notice\":\"Allows the sequencer to append a batch of transactions.\"},\"batches()\":{\"notice\":\"Accesses the batch storage container.\"},\"enqueue(address,uint256,bytes)\":{\"notice\":\"Adds a transaction to the queue.\"},\"getLastBlockNumber()\":{\"notice\":\"Returns the blocknumber of the last transaction.\"},\"getLastTimestamp()\":{\"notice\":\"Returns the timestamp of the last transaction.\"},\"getNextQueueIndex()\":{\"notice\":\"Returns the index of the next element to be enqueued.\"},\"getNumPendingQueueElements()\":{\"notice\":\"Get the number of queue elements which have not yet been included.\"},\"getQueueElement(uint256)\":{\"notice\":\"Gets the queue element at a particular index.\"},\"getQueueLength()\":{\"notice\":\"Retrieves the length of the queue, including both pending and canonical transactions.\"},\"getTotalBatches()\":{\"notice\":\"Retrieves the total number of batches submitted.\"},\"getTotalElements()\":{\"notice\":\"Retrieves the total number of elements submitted.\"},\"queue()\":{\"notice\":\"Accesses the queue storage container.\"},\"verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Verifies whether a transaction is included in the chain.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol\":\"OVM_CanonicalTransactionChain\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_ECDSAContractAccount } from \\\"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\nimport { Lib_SafeMathWrapper } from \\\"../../libraries/wrappers/Lib_SafeMathWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ECDSAContractAccount\\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \\n * providing eth_sign and EIP155 formatted transaction encodings.\\n *\\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\\n\\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Executes a signed transaction.\\n * @param _transaction Signed EOA transaction.\\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\\n\\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\\n // recovered address of the user who signed this message. This is how we manage to shim\\n // account abstraction even though the user isn't a contract.\\n // Need to make sure that the transaction nonce is right and bump it if so.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_ECDSAUtils.recover(\\n _transaction,\\n isEthSign,\\n _v,\\n _r,\\n _s\\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\\n \\\"Signature provided for EOA transaction execution is invalid.\\\"\\n );\\n\\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\\n\\n // Need to make sure that the transaction chainId is correct.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n \\\"Transaction chainId does not match expected OVM chainId.\\\"\\n );\\n\\n // Need to make sure that the transaction nonce is right.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\\n \\\"Transaction nonce does not match the expected nonce.\\\"\\n );\\n\\n // TEMPORARY: Disable gas checks for minnet.\\n // // Need to make sure that the gas is sufficient to execute the transaction.\\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\\n // \\\"Gas is not sufficient to execute the transaction.\\\"\\n // );\\n\\n // Transfer fee to relayer.\\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\\n gasleft(),\\n ETH_ERC20_ADDRESS,\\n abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", relayer, fee)\\n );\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n success == true,\\n \\\"Fee was not transferred to relayer.\\\"\\n );\\n\\n // Contract creations are signalled by sending a transaction to the zero address.\\n if (decodedTx.to == address(0)) {\\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\\n decodedTx.gasLimit,\\n decodedTx.data\\n );\\n\\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\\n // initialization. Always return `true` for our success value here.\\n return (true, abi.encode(created));\\n } else {\\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\\n // cases, but since this is a contract we'd end up bumping the nonce twice.\\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\\n\\n return Lib_SafeExecutionManagerWrapper.safeCALL(\\n decodedTx.gasLimit,\\n decodedTx.to,\\n decodedTx.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9eaaad64d70fb465dd323504f34ba44861dfe738621fce48e8a1e697405e592e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ProxyEOA\\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \\n * 'account abstraction' on layer 2. \\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ProxyEOA {\\n\\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _implementation\\n )\\n public\\n {\\n _setImplementation(_implementation);\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\\n gasleft(),\\n getImplementation(),\\n msg.data\\n );\\n\\n if (success) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n Lib_SafeExecutionManagerWrapper.safeREVERT(\\n string(returndata)\\n );\\n }\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function upgrade(\\n address _implementation\\n )\\n external\\n {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\\n \\\"EOAs can only upgrade their own EOA implementation\\\"\\n );\\n\\n _setImplementation(_implementation);\\n }\\n\\n function getImplementation()\\n public\\n returns (\\n address _implementation\\n )\\n {\\n return address(uint160(uint256(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n IMPLEMENTATION_KEY\\n )\\n )));\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n IMPLEMENTATION_KEY,\\n bytes32(uint256(uint160(_implementation)))\\n );\\n }\\n}\",\"keccak256\":\"0xfbc7e9737d04824f9c1b63fc2151a591c768e3b643d9b3c44405559c3ef19e5e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_MerkleTree } from \\\"../../libraries/utils/Lib_MerkleTree.sol\\\";\\nimport { Lib_Math } from \\\"../../libraries/utils/Lib_Math.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ExecutionManager } from \\\"../execution/OVM_ExecutionManager.sol\\\";\\n\\n\\n/**\\n * @title OVM_CanonicalTransactionChain\\n * @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions\\n * which must be applied to the rollup state. It defines the ordering of rollup transactions by\\n * writing them to the 'CTC:batches' instance of the Chain Storage Container.\\n * The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer\\n * will eventually append it to the rollup state.\\n * If the Sequencer does not include an enqueued transaction within the 'force inclusion period',\\n * then any account may force it to be included by calling appendQueueBatch().\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_AddressResolver {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // L2 tx gas-related\\n uint256 constant public MIN_ROLLUP_TX_GAS = 100000;\\n uint256 constant public MAX_ROLLUP_TX_SIZE = 10000;\\n uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 32;\\n\\n // Encoding-related (all in bytes)\\n uint256 constant internal BATCH_CONTEXT_SIZE = 16;\\n uint256 constant internal BATCH_CONTEXT_LENGTH_POS = 12;\\n uint256 constant internal BATCH_CONTEXT_START_POS = 15;\\n uint256 constant internal TX_DATA_HEADER_SIZE = 3;\\n uint256 constant internal BYTES_TILL_TX_DATA = 65;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n uint256 public forceInclusionPeriodSeconds;\\n uint256 public forceInclusionPeriodBlocks;\\n uint256 public maxTransactionGasLimit;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager,\\n uint256 _forceInclusionPeriodSeconds,\\n uint256 _forceInclusionPeriodBlocks,\\n uint256 _maxTransactionGasLimit\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds;\\n forceInclusionPeriodBlocks = _forceInclusionPeriodBlocks;\\n maxTransactionGasLimit = _maxTransactionGasLimit;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n override\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:CTC:batches\\\")\\n );\\n }\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n override\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:CTC:queue\\\")\\n );\\n }\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n override\\n public\\n view\\n returns (\\n uint256 _totalElements\\n )\\n {\\n (uint40 totalElements,,,) = _getBatchExtraData();\\n return uint256(totalElements);\\n }\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n override\\n public\\n view\\n returns (\\n uint256 _totalBatches\\n )\\n {\\n return batches().length();\\n }\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,uint40 nextQueueIndex,,) = _getBatchExtraData();\\n return nextQueueIndex;\\n }\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,,uint40 lastTimestamp,) = _getBatchExtraData();\\n return lastTimestamp;\\n }\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,,,uint40 lastBlockNumber) = _getBatchExtraData();\\n return lastBlockNumber;\\n }\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n iOVM_ChainStorageContainer queue = queue();\\n\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 queueRoot = queue.get(trueIndex);\\n bytes32 timestampAndBlockNumber = queue.get(trueIndex + 1);\\n\\n uint40 elementTimestamp;\\n uint40 elementBlockNumber;\\n assembly {\\n elementTimestamp := and(timestampAndBlockNumber, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n elementBlockNumber := shr(40, and(timestampAndBlockNumber, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\\n }\\n\\n return Lib_OVMCodec.QueueElement({\\n queueRoot: queueRoot,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n return getQueueLength() - getNextQueueIndex();\\n }\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the real queue length we need\\n // to divide by 2. See the usage of `push2(..)`.\\n return uint40(queue().length() / 2);\\n }\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target L2 contract to send the transaction to.\\n * @param _gasLimit Gas limit for the enqueued L2 transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n override\\n public\\n {\\n require(\\n _data.length <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n require(\\n _gasLimit <= maxTransactionGasLimit,\\n \\\"Transaction gas limit exceeds maximum for rollup transaction.\\\"\\n );\\n\\n require(\\n _gasLimit >= MIN_ROLLUP_TX_GAS,\\n \\\"Transaction gas limit too low to enqueue.\\\"\\n );\\n\\n // We need to consume some amount of L1 gas in order to rate limit transactions going into\\n // L2. However, L2 is cheaper than L1 so we only need to burn some small proportion of the\\n // provided L1 gas.\\n uint256 gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;\\n uint256 startingGas = gasleft();\\n\\n // Although this check is not necessary (burn below will run out of gas if not true), it\\n // gives the user an explicit reason as to why the enqueue attempt failed.\\n require(\\n startingGas > gasToConsume,\\n \\\"Insufficient gas for L2 rate limiting burn.\\\"\\n );\\n\\n // Here we do some \\\"dumb\\\" work in order to burn gas, although we should probably replace\\n // this with something like minting gas token later on.\\n uint256 i;\\n while(startingGas - gasleft() < gasToConsume) {\\n i++;\\n }\\n\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data\\n )\\n );\\n\\n bytes32 timestampAndBlockNumber;\\n assembly {\\n timestampAndBlockNumber := timestamp()\\n timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))\\n }\\n\\n iOVM_ChainStorageContainer queue = queue();\\n\\n queue.push2(\\n transactionHash,\\n timestampAndBlockNumber\\n );\\n\\n uint256 queueIndex = queue.length() / 2;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex - 1,\\n block.timestamp\\n );\\n }\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n override\\n public\\n {\\n // Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n _numQueuedTransactions = Lib_Math.min(_numQueuedTransactions, getNumPendingQueueElements());\\n require(\\n _numQueuedTransactions > 0,\\n \\\"Must append more than zero transactions.\\\"\\n );\\n\\n bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);\\n uint40 nextQueueIndex = getNextQueueIndex();\\n\\n for (uint256 i = 0; i < _numQueuedTransactions; i++) {\\n if (msg.sender != resolve(\\\"OVM_Sequencer\\\")) {\\n Lib_OVMCodec.QueueElement memory el = getQueueElement(nextQueueIndex);\\n require(\\n el.timestamp + forceInclusionPeriodSeconds < block.timestamp,\\n \\\"Queue transactions cannot be submitted during the sequencer inclusion period.\\\"\\n );\\n }\\n leaves[i] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n }\\n\\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\\n\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n _numQueuedTransactions,\\n _numQueuedTransactions,\\n lastElement.timestamp,\\n lastElement.blockNumber\\n );\\n\\n emit QueueBatchAppended(\\n nextQueueIndex - _numQueuedTransactions,\\n _numQueuedTransactions,\\n getTotalElements()\\n );\\n }\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch()\\n override\\n public\\n {\\n uint40 shouldStartAtElement;\\n uint24 totalElementsToAppend;\\n uint24 numContexts;\\n assembly {\\n shouldStartAtElement := shr(216, calldataload(4))\\n totalElementsToAppend := shr(232, calldataload(9))\\n numContexts := shr(232, calldataload(12))\\n }\\n\\n require(\\n shouldStartAtElement == getTotalElements(),\\n \\\"Actual batch start index does not match expected start index.\\\"\\n );\\n\\n require(\\n msg.sender == resolve(\\\"OVM_Sequencer\\\"),\\n \\\"Function can only be called by the Sequencer.\\\"\\n );\\n\\n require(\\n numContexts > 0,\\n \\\"Must provide at least one batch context.\\\"\\n );\\n\\n require(\\n totalElementsToAppend > 0,\\n \\\"Must append at least one element.\\\"\\n );\\n\\n uint40 nextTransactionPtr = uint40(BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts);\\n uint256 calldataSize;\\n assembly {\\n calldataSize := calldatasize()\\n }\\n\\n require(\\n calldataSize >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Get queue length for future comparison/\\n uint40 queueLength = getQueueLength();\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n // We will sequentially append leaves which are pointers to the queue.\\n // The initial queue index is what is currently in storage.\\n uint40 nextQueueIndex = getNextQueueIndex();\\n\\n BatchContext memory curContext;\\n\\n for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n if (i == 0) {\\n _validateFirstBatchContext(nextContext);\\n }\\n _validateNextBatchContext(curContext, nextContext, nextQueueIndex);\\n\\n curContext = nextContext;\\n\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n\\n leaves[leafIndex] = _getSequencerLeafHash(curContext, nextTransactionPtr, txDataLength);\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(nextQueueIndex < queueLength, \\\"Not enough queued transactions to append.\\\");\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(curContext);\\n\\n require(\\n calldataSize == nextTransactionPtr,\\n \\\"Not all sequencer transactions were processed.\\\"\\n );\\n\\n require(\\n leafIndex == totalElementsToAppend,\\n \\\"Actual transaction index does not match expected total elements to append.\\\"\\n );\\n\\n // Generate the required metadata that we need to append this batch\\n uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions;\\n uint40 timestamp;\\n uint40 blockNumber;\\n if (curContext.numSubsequentQueueTransactions == 0) {\\n // The last element is a sequencer tx, therefore pull timestamp and block number from the last context.\\n timestamp = uint40(curContext.timestamp);\\n blockNumber = uint40(curContext.blockNumber);\\n } else {\\n // The last element is a queue tx, therefore pull timestamp and block number from the queue element.\\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\\n timestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n timestamp,\\n blockNumber\\n );\\n\\n emit SequencerBatchAppended(\\n nextQueueIndex - numQueuedTransactions,\\n numQueuedTransactions,\\n getTotalElements()\\n );\\n }\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n if (_txChainElement.isSequenced == true) {\\n return _verifySequencerTransaction(\\n _transaction,\\n _txChainElement,\\n _batchHeader,\\n _inclusionProof\\n );\\n } else {\\n return _verifyQueueTransaction(\\n _transaction,\\n _txChainElement.queueIndex,\\n _batchHeader,\\n _inclusionProof\\n );\\n }\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Returns the BatchContext located at a particular index.\\n * @param _index The index of the BatchContext\\n * @return The BatchContext at the specified index.\\n */\\n function _getBatchContext(\\n uint256 _index\\n )\\n internal\\n pure\\n returns (\\n BatchContext memory\\n )\\n {\\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 ctxTimestamp;\\n uint256 ctxBlockNumber;\\n\\n assembly {\\n numSequencedTransactions := shr(232, calldataload(contextPtr))\\n numSubsequentQueueTransactions := shr(232, calldataload(add(contextPtr, 3)))\\n ctxTimestamp := shr(216, calldataload(add(contextPtr, 6)))\\n ctxBlockNumber := shr(216, calldataload(add(contextPtr, 11)))\\n }\\n\\n return BatchContext({\\n numSequencedTransactions: numSequencedTransactions,\\n numSubsequentQueueTransactions: numSubsequentQueueTransactions,\\n timestamp: ctxTimestamp,\\n blockNumber: ctxBlockNumber\\n });\\n }\\n\\n /**\\n * Parses the batch context from the extra data.\\n * @return Total number of elements submitted.\\n * @return Index of the next queue element.\\n */\\n function _getBatchExtraData()\\n internal\\n view\\n returns (\\n uint40,\\n uint40,\\n uint40,\\n uint40\\n )\\n {\\n bytes27 extraData = batches().getGlobalMetadata();\\n\\n uint40 totalElements;\\n uint40 nextQueueIndex;\\n uint40 lastTimestamp;\\n uint40 lastBlockNumber;\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n nextQueueIndex := shr(40, and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000))\\n lastTimestamp := shr(80, and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000))\\n lastBlockNumber := shr(120, and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000))\\n }\\n\\n return (\\n totalElements,\\n nextQueueIndex,\\n lastTimestamp,\\n lastBlockNumber\\n );\\n }\\n\\n /**\\n * Encodes the batch context for the extra data.\\n * @param _totalElements Total number of elements submitted.\\n * @param _nextQueueIndex Index of the next queue element.\\n * @param _timestamp Timestamp for the last batch.\\n * @param _blockNumber Block number of the last batch.\\n * @return Encoded batch context.\\n */\\n function _makeBatchExtraData(\\n uint40 _totalElements,\\n uint40 _nextQueueIndex,\\n uint40 _timestamp,\\n uint40 _blockNumber\\n )\\n internal\\n pure\\n returns (\\n bytes27\\n )\\n {\\n bytes27 extraData;\\n assembly {\\n extraData := _totalElements\\n extraData := or(extraData, shl(40, _nextQueueIndex))\\n extraData := or(extraData, shl(80, _timestamp))\\n extraData := or(extraData, shl(120, _blockNumber))\\n extraData := shl(40, extraData)\\n }\\n\\n return extraData;\\n }\\n\\n /**\\n * Retrieves the hash of a queue element.\\n * @param _index Index of the queue element to retrieve a hash for.\\n * @return Hash of the queue element.\\n */\\n function _getQueueLeafHash(\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n return _hashTransactionChainElement(\\n Lib_OVMCodec.TransactionChainElement({\\n isSequenced: false,\\n queueIndex: _index,\\n timestamp: 0,\\n blockNumber: 0,\\n txData: hex\\\"\\\"\\n })\\n );\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength()\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the real queue length we need\\n // to divide by 2. See the usage of `push2(..)`.\\n return uint40(queue().length() / 2);\\n }\\n\\n /**\\n * Retrieves the hash of a sequencer element.\\n * @param _context Batch context for the given element.\\n * @param _nextTransactionPtr Pointer to the next transaction in the calldata.\\n * @param _txDataLength Length of the transaction item.\\n * @return Hash of the sequencer element.\\n */\\n function _getSequencerLeafHash(\\n BatchContext memory _context,\\n uint256 _nextTransactionPtr,\\n uint256 _txDataLength\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n\\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(chainElement, 0x20)\\n\\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\\n // This distinguishes sequencer ChainElements from queue ChainElements because\\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\\n // elements is always zero\\n mstore8(chainElementStart, 1)\\n\\n mstore(add(chainElementStart, 1), ctxTimestamp)\\n mstore(add(chainElementStart, 33), ctxBlockNumber)\\n\\n calldatacopy(add(chainElementStart, BYTES_TILL_TX_DATA), add(_nextTransactionPtr, 3), _txDataLength)\\n\\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, _txDataLength))\\n }\\n\\n return leafHash;\\n }\\n\\n /**\\n * Retrieves the hash of a sequencer element.\\n * @param _txChainElement The chain element which is hashed to calculate the leaf.\\n * @return Hash of the sequencer element.\\n */\\n function _getSequencerLeafHash(\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement\\n )\\n internal\\n view\\n returns(\\n bytes32\\n )\\n {\\n bytes memory txData = _txChainElement.txData;\\n uint256 txDataLength = _txChainElement.txData.length;\\n\\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + txDataLength);\\n uint256 ctxTimestamp = _txChainElement.timestamp;\\n uint256 ctxBlockNumber = _txChainElement.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(chainElement, 0x20)\\n\\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\\n // This distinguishes sequencer ChainElements from queue ChainElements because\\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\\n // elements is always zero\\n mstore8(chainElementStart, 1)\\n\\n mstore(add(chainElementStart, 1), ctxTimestamp)\\n mstore(add(chainElementStart, 33), ctxBlockNumber)\\n\\n pop(staticcall(gas(), 0x04, add(txData, 0x20), txDataLength, add(chainElementStart, BYTES_TILL_TX_DATA), txDataLength))\\n\\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, txDataLength))\\n }\\n\\n return leafHash;\\n }\\n\\n /**\\n * Inserts a batch into the chain of batches.\\n * @param _transactionRoot Root of the transaction tree for this batch.\\n * @param _batchSize Number of elements in the batch.\\n * @param _numQueuedTransactions Number of queue transactions in the batch.\\n * @param _timestamp The latest batch timestamp.\\n * @param _blockNumber The latest batch blockNumber.\\n */\\n function _appendBatch(\\n bytes32 _transactionRoot,\\n uint256 _batchSize,\\n uint256 _numQueuedTransactions,\\n uint40 _timestamp,\\n uint40 _blockNumber\\n )\\n internal\\n {\\n (uint40 totalElements, uint40 nextQueueIndex, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batches().length(),\\n batchRoot: _transactionRoot,\\n batchSize: _batchSize,\\n prevTotalElements: totalElements,\\n extraData: hex\\\"\\\"\\n });\\n\\n emit TransactionBatchAppended(\\n header.batchIndex,\\n header.batchRoot,\\n header.batchSize,\\n header.prevTotalElements,\\n header.extraData\\n );\\n\\n bytes32 batchHeaderHash = Lib_OVMCodec.hashBatchHeader(header);\\n bytes27 latestBatchContext = _makeBatchExtraData(\\n totalElements + uint40(header.batchSize),\\n nextQueueIndex + uint40(_numQueuedTransactions),\\n _timestamp,\\n _blockNumber\\n );\\n\\n batches().push(batchHeaderHash, latestBatchContext);\\n }\\n\\n /**\\n * Checks that the first batch context in a sequencer submission is valid\\n * @param _firstContext The batch context to validate.\\n */\\n function _validateFirstBatchContext(\\n BatchContext memory _firstContext\\n )\\n internal\\n view\\n {\\n // If there are existing elements, this batch must come later.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n require(_firstContext.blockNumber >= lastBlockNumber, \\\"Context block number is lower than last submitted.\\\");\\n require(_firstContext.timestamp >= lastTimestamp, \\\"Context timestamp is lower than last submitted.\\\");\\n }\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(_firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp, \\\"Context timestamp too far in the past.\\\");\\n require(_firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number, \\\"Context block number too far in the past.\\\");\\n }\\n\\n /**\\n * Checks that a given batch context is valid based on its previous context, and the next queue elemtent.\\n * @param _prevContext The previously validated batch context.\\n * @param _nextContext The batch context to validate with this call.\\n * @param _nextQueueIndex Index of the next queue element to process for the _nextContext's subsequentQueueElements.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must increase from the previous ones.\\n require(\\n _nextContext.timestamp >= _prevContext.timestamp,\\n \\\"Context timestamp values must monotonically increase.\\\"\\n );\\n\\n require(\\n _nextContext.blockNumber >= _prevContext.blockNumber,\\n \\\"Context blockNumber values must monotonically increase.\\\"\\n );\\n\\n // If there are some queue elements pending:\\n if (getQueueLength() - _nextQueueIndex > 0) {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = getQueueElement(_nextQueueIndex);\\n\\n // If the force inclusion period has passed for an enqueued transaction, it MUST be the next chain element.\\n require(\\n block.timestamp < nextQueueElement.timestamp + forceInclusionPeriodSeconds,\\n \\\"Previously enqueued batches have expired and must be appended before a new sequencer batch.\\\"\\n );\\n\\n // Just like sequencer transaction times must be increasing relative to each other,\\n // We also require that they be increasing relative to any interspersed queue elements.\\n require(\\n _nextContext.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _nextContext.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\n }\\n }\\n\\n /**\\n * Checks that the final batch context in a sequencer submission is valid.\\n * @param _finalContext The batch context to validate.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext\\n )\\n internal\\n view\\n {\\n // Batches cannot be added from the future, or subsequent enqueue() contexts would violate monotonicity.\\n require(_finalContext.timestamp <= block.timestamp, \\\"Context timestamp is from the future.\\\");\\n require(_finalContext.blockNumber <= block.number, \\\"Context block number is from the future.\\\");\\n }\\n\\n /**\\n * Hashes a transaction chain element.\\n * @param _element Chain element to hash.\\n * @return Hash of the chain element.\\n */\\n function _hashTransactionChainElement(\\n Lib_OVMCodec.TransactionChainElement memory _element\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _element.isSequenced,\\n _element.queueIndex,\\n _element.timestamp,\\n _element.blockNumber,\\n _element.txData\\n )\\n );\\n }\\n\\n /**\\n * Verifies a sequencer transaction, returning true if it was indeed included in the CTC\\n * @param _transaction The transaction we are verifying inclusion of.\\n * @param _txChainElement The chain element that the transaction is claimed to be a part of.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof An inclusion proof into the CTC at a particular index.\\n * @return True if the transaction was included in the specified location, else false.\\n */\\n function _verifySequencerTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n OVM_ExecutionManager ovmExecutionManager = OVM_ExecutionManager(resolve(\\\"OVM_ExecutionManager\\\"));\\n uint256 gasLimit = ovmExecutionManager.getMaxTransactionGasLimit();\\n bytes32 leafHash = _getSequencerLeafHash(_txChainElement);\\n\\n require(\\n _verifyElement(\\n leafHash,\\n _batchHeader,\\n _inclusionProof\\n ),\\n \\\"Invalid Sequencer transaction inclusion proof.\\\"\\n );\\n\\n require(\\n _transaction.blockNumber == _txChainElement.blockNumber\\n && _transaction.timestamp == _txChainElement.timestamp\\n && _transaction.entrypoint == resolve(\\\"OVM_DecompressionPrecompileAddress\\\")\\n && _transaction.gasLimit == gasLimit\\n && _transaction.l1TxOrigin == address(0)\\n && _transaction.l1QueueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE\\n && keccak256(_transaction.data) == keccak256(_txChainElement.txData),\\n \\\"Invalid Sequencer transaction.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * Verifies a queue transaction, returning true if it was indeed included in the CTC\\n * @param _transaction The transaction we are verifying inclusion of.\\n * @param _queueIndex The queueIndex of the queued transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof An inclusion proof into the CTC at a particular index (should point to queue tx).\\n * @return True if the transaction was included in the specified location, else false.\\n */\\n function _verifyQueueTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n uint256 _queueIndex,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 leafHash = _getQueueLeafHash(_queueIndex);\\n\\n require(\\n _verifyElement(\\n leafHash,\\n _batchHeader,\\n _inclusionProof\\n ),\\n \\\"Invalid Queue transaction inclusion proof.\\\"\\n );\\n\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n )\\n );\\n\\n Lib_OVMCodec.QueueElement memory el = getQueueElement(_queueIndex);\\n require(\\n el.queueRoot == transactionHash\\n && el.timestamp == _transaction.timestamp\\n && el.blockNumber == _transaction.blockNumber,\\n \\\"Invalid Queue transaction.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function _verifyElement(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n require(\\n Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(uint32(_batchHeader.batchIndex)),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n Lib_MerkleTree.verify(\\n _batchHeader.batchRoot,\\n _element,\\n _proof.index,\\n _proof.siblings,\\n _batchHeader.batchSize\\n ),\\n \\\"Invalid inclusion proof.\\\"\\n );\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0xdc14bda01b44a00fa571cac5f2b5b2d8add7f05f5bc0b44abc129d1cec6c59c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ECDSAContractAccount } from \\\"../accounts/OVM_ECDSAContractAccount.sol\\\";\\nimport { OVM_ProxyEOA } from \\\"../accounts/OVM_ProxyEOA.sol\\\";\\nimport { OVM_DeployerWhitelist } from \\\"../precompiles/OVM_DeployerWhitelist.sol\\\";\\n\\n/**\\n * @title OVM_ExecutionManager\\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\\n * Layer 2.\\n * The EM's run() function is the first function called during the execution of any\\n * transaction on L2.\\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\\n * OVM operation, which will read state from the State Manager contract.\\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\\n * context-dependent operations.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n iOVM_SafetyChecker internal ovmSafetyChecker;\\n iOVM_StateManager internal ovmStateManager;\\n\\n\\n /*******************************\\n * Execution Context Variables *\\n *******************************/\\n\\n GasMeterConfig internal gasMeterConfig;\\n GlobalContext internal globalContext;\\n TransactionContext internal transactionContext;\\n MessageContext internal messageContext;\\n TransactionRecord internal transactionRecord;\\n MessageRecord internal messageRecord;\\n\\n\\n /**************************\\n * Gas Metering Constants *\\n **************************/\\n\\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n GasMeterConfig memory _gasMeterConfig,\\n GlobalContext memory _globalContext\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\\n * @param _cost Desired gas cost for the function after the refund.\\n */\\n modifier netGasCost(\\n uint256 _cost\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund everything *except* the specified cost.\\n if (_cost < gasUsed) {\\n transactionRecord.ovmGasRefund += gasUsed - _cost;\\n }\\n }\\n\\n /**\\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\\n */\\n modifier fixedGasDiscount(\\n uint256 _discount\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund the specified _discount, unless this risks underflow.\\n if (_discount < gasUsed) {\\n transactionRecord.ovmGasRefund += _discount;\\n } else {\\n // refund all we can without risking underflow.\\n transactionRecord.ovmGasRefund += gasUsed;\\n }\\n }\\n\\n /**\\n * Makes sure we're not inside a static context.\\n */\\n modifier notStatic() {\\n if (messageContext.isStatic == true) {\\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\\n }\\n _;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n /**\\n * Starts the execution of a transaction via the OVM_ExecutionManager.\\n * @param _transaction Transaction data to be executed.\\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\\n */\\n function run(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _ovmStateManager\\n )\\n override\\n public\\n {\\n require(transactionContext.ovmNUMBER == 0, \\\"Only be callable at the start of a transaction\\\");\\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\\n // address around in calldata).\\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\\n\\n // Make sure this function can't be called by anyone except the owner of the\\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\\n // this would make the `run` itself invalid.\\n require(\\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\\n ovmStateManager.isAuthenticated(msg.sender),\\n \\\"Only authenticated addresses in ovmStateManager can call this function\\\"\\n );\\n\\n // Initialize the execution context, must be initialized before we perform any gas metering\\n // or we'll throw a nuisance gas error.\\n _initContext(_transaction);\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Check whether we need to start a new epoch, do so if necessary.\\n // _checkNeedsNewEpoch(_transaction.timestamp);\\n\\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\\n // reverts for INVALID_STATE_ACCESS.\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return;\\n }\\n\\n // Check gas right before the call to get total gas consumed by OVM transaction.\\n uint256 gasProvided = gasleft();\\n\\n // Run the transaction, make sure to meter the gas usage.\\n ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************\\n * Opcodes: Execution Context *\\n ******************************/\\n\\n /**\\n * @notice Overrides CALLER.\\n * @return _CALLER Address of the CALLER within the current message context.\\n */\\n function ovmCALLER()\\n override\\n public\\n view\\n returns (\\n address _CALLER\\n )\\n {\\n return messageContext.ovmCALLER;\\n }\\n\\n /**\\n * @notice Overrides ADDRESS.\\n * @return _ADDRESS Active ADDRESS within the current message context.\\n */\\n function ovmADDRESS()\\n override\\n public\\n view\\n returns (\\n address _ADDRESS\\n )\\n {\\n return messageContext.ovmADDRESS;\\n }\\n\\n /**\\n * @notice Overrides TIMESTAMP.\\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\\n */\\n function ovmTIMESTAMP()\\n override\\n public\\n view\\n returns (\\n uint256 _TIMESTAMP\\n )\\n {\\n return transactionContext.ovmTIMESTAMP;\\n }\\n\\n /**\\n * @notice Overrides NUMBER.\\n * @return _NUMBER Value of the NUMBER within the transaction context.\\n */\\n function ovmNUMBER()\\n override\\n public\\n view\\n returns (\\n uint256 _NUMBER\\n )\\n {\\n return transactionContext.ovmNUMBER;\\n }\\n\\n /**\\n * @notice Overrides GASLIMIT.\\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\\n */\\n function ovmGASLIMIT()\\n override\\n public\\n view\\n returns (\\n uint256 _GASLIMIT\\n )\\n {\\n return transactionContext.ovmGASLIMIT;\\n }\\n\\n /**\\n * @notice Overrides CHAINID.\\n * @return _CHAINID Value of the chain's CHAINID within the global context.\\n */\\n function ovmCHAINID()\\n override\\n public\\n view\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n return globalContext.ovmCHAINID;\\n }\\n\\n /*********************************\\n * Opcodes: L2 Execution Context *\\n *********************************/\\n\\n /**\\n * @notice Specifies from which L1 rollup queue this transaction originated from.\\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n {\\n return transactionContext.ovmL1QUEUEORIGIN;\\n }\\n\\n /**\\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\\n */\\n function ovmL1TXORIGIN()\\n override\\n public\\n view\\n returns (\\n address _l1TxOrigin\\n )\\n {\\n return transactionContext.ovmL1TXORIGIN;\\n }\\n\\n /********************\\n * Opcodes: Halting *\\n ********************/\\n\\n /**\\n * @notice Overrides REVERT.\\n * @param _data Bytes data to pass along with the REVERT.\\n */\\n function ovmREVERT(\\n bytes memory _data\\n )\\n override\\n public\\n {\\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\\n }\\n\\n\\n /******************************\\n * Opcodes: Contract Creation *\\n ******************************/\\n\\n /**\\n * @notice Overrides CREATE.\\n * @param _bytecode Code to be used to CREATE a new contract.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\\n creator,\\n _getAccountNonce(creator)\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n /**\\n * @notice Overrides CREATE2.\\n * @param _bytecode Code to be used to CREATE2 a new contract.\\n * @param _salt Value used to determine the contract's address.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE2 address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\\n creator,\\n _bytecode,\\n _salt\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n /**\\n * Retrieves the nonce of the current ovmADDRESS.\\n * @return _nonce Nonce of the current contract.\\n */\\n function ovmGETNONCE()\\n override\\n public\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Sets the nonce of the current ovmADDRESS.\\n * @param _nonce New nonce for the current contract.\\n */\\n function ovmSETNONCE(\\n uint256 _nonce\\n )\\n override\\n public\\n notStatic\\n {\\n _setAccountNonce(ovmADDRESS(), _nonce);\\n }\\n\\n /**\\n * Creates a new EOA contract account, for account abstraction.\\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\\n * because the contract we're creating is trusted (no need to do safety checking or to\\n * handle unexpected reverts). Doesn't need to return an address because the address is\\n * assumed to be the user's actual address.\\n * @param _messageHash Hash of a message signed by some user, for verification.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n */\\n function ovmCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n notStatic\\n {\\n // Recover the EOA address from the message hash and signature parameters. Since we do the\\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\\n // function were to return the wrong address (rather than explicitly returning the zero\\n // address), the rest of the transaction would simply fail (since there's no EOA account to\\n // actually execute the transaction).\\n address eoa = ecrecover(\\n _messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n\\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\\n // have this function return a `success` boolean, but this is just easier.\\n if (eoa == address(0)) {\\n ovmREVERT(bytes(\\\"Signature provided for EOA contract creation is invalid.\\\"));\\n }\\n\\n // If the user already has an EOA account, then there's no need to perform this operation.\\n if (_hasEmptyAccount(eoa) == false) {\\n return;\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(eoa);\\n\\n // Temporarily set the current address so it's easier to access on L2.\\n address prevADDRESS = messageContext.ovmADDRESS;\\n messageContext.ovmADDRESS = eoa;\\n\\n // Now actually create the account and get its bytecode. We're not worried about reverts\\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\\n\\n // Reset the address now that we're done deploying.\\n messageContext.ovmADDRESS = prevADDRESS;\\n\\n // Commit the account with its final values.\\n _commitPendingAccount(\\n eoa,\\n address(proxyEOA),\\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\\n );\\n\\n _setAccountNonce(eoa, 0);\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Interaction *\\n *********************************/\\n\\n /**\\n * @notice Overrides CALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(100000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // CALL updates the CALLER and ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides STATICCALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmSTATICCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(80000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides DELEGATECALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmDELEGATECALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(40000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // DELEGATECALL does not change anything about the message context.\\n MessageContext memory nextMessageContext = messageContext;\\n bool isStaticEntrypoint = false;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n\\n /************************************\\n * Opcodes: Contract Storage Access *\\n ************************************/\\n\\n /**\\n * @notice Overrides SLOAD.\\n * @param _key 32 byte key of the storage slot to load.\\n * @return _value 32 byte value of the requested storage slot.\\n */\\n function ovmSLOAD(\\n bytes32 _key\\n )\\n override\\n public\\n netGasCost(40000)\\n returns (\\n bytes32 _value\\n )\\n {\\n // We always SLOAD from the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n return _getContractStorage(\\n contractAddress,\\n _key\\n );\\n }\\n\\n /**\\n * @notice Overrides SSTORE.\\n * @param _key 32 byte key of the storage slot to set.\\n * @param _value 32 byte value for the storage slot.\\n */\\n function ovmSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n notStatic\\n netGasCost(60000)\\n {\\n // We always SSTORE to the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n _putContractStorage(\\n contractAddress,\\n _key,\\n _value\\n );\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Code Access *\\n *********************************/\\n\\n /**\\n * @notice Overrides EXTCODECOPY.\\n * @param _contract Address of the contract to copy code from.\\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\\n * @param _length Total number of bytes to copy from the contract's code.\\n * @return _code Bytes of code copied from the requested contract.\\n */\\n function ovmEXTCODECOPY(\\n address _contract,\\n uint256 _offset,\\n uint256 _length\\n )\\n override\\n public\\n returns (\\n bytes memory _code\\n )\\n {\\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\\n // return data. By blocking reads of one byte, we're able to use the condition that an\\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\\n // an error without an explicit revert. If users were able to read a single byte, they\\n // could forcibly trigger behavior that should only be available to this contract.\\n uint256 length = _length == 1 ? 2 : _length;\\n\\n return Lib_EthUtils.getCode(\\n _getAccountEthAddress(_contract),\\n _offset,\\n length\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODESIZE.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function ovmEXTCODESIZE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n return Lib_EthUtils.getCodeSize(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODEHASH.\\n * @param _contract Address of the contract to query the hash of.\\n * @return _EXTCODEHASH Hash of the requested contract.\\n */\\n function ovmEXTCODEHASH(\\n address _contract\\n )\\n override\\n public\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n /**\\n * Performs the logic to create a contract and revert under various potential conditions.\\n * @dev This function is implemented as `public` because we need to be able to revert a\\n * contract creation without losing information about exactly *why* the contract reverted.\\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\\n * flag and then revert to reset the flag. We're able to do this by making an external\\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\\n * information before reverting.\\n * @param _address Address of the contract to associate with the one being created.\\n * @param _bytecode Code to be used to create the new contract.\\n */\\n function safeCREATE(\\n address _address,\\n bytes memory _bytecode\\n )\\n override\\n public\\n {\\n // Since this function is public, anyone can attempt to directly call it. We need to make\\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\\n // call this function.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n\\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\\n // some existing contract. On L1, users will prove that no contract exists at the address\\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\\n // value that represents \\\"known to be an empty account.\\\"\\n if (_hasEmptyAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\\n // complexity because we need to ensure that contract creation *never* reverts by itself.\\n // We cover this partially by storing a revert flag and returning (instead of reverting)\\n // when we know that we're inside a contract's creation code.\\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\\n\\n // Contract creation returns the zero address when it fails, which should only be possible\\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\\n // explicitly handle this case here.\\n if (ethAddress == address(0)) {\\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\\n }\\n\\n // Here we pull out the revert flag that would've been set during creation code. Now that\\n // we're out of creation code again, we can just revert normally while passing the flag\\n // through the revert data.\\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\\n _revertWithFlag(messageRecord.revertFlag);\\n }\\n\\n // Again simply checking that the deployed code is safe too. Contracts can generate\\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\\n // associating the desired address with the newly created contract's code hash and address.\\n _commitPendingAccount(\\n _address,\\n ethAddress,\\n Lib_EthUtils.getCodeHash(ethAddress)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit()\\n external\\n view\\n override\\n returns (\\n uint256 _maxTransactionGasLimit\\n )\\n {\\n return gasMeterConfig.maxTransactionGasLimit;\\n }\\n\\n /********************************************\\n * Public Functions: Deployment Witelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\\n * @param _deployerAddress Address attempting to deploy a contract.\\n */\\n function _checkDeployerAllowed(\\n address _deployerAddress\\n )\\n internal\\n {\\n // From an OVM semanitcs perspectibe, this will appear the identical to\\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\\n (bool success, bytes memory data) = ovmCALL(\\n gasleft(),\\n 0x4200000000000000000000000000000000000002,\\n abi.encodeWithSignature(\\\"isDeployerAllowed(address)\\\", _deployerAddress)\\n );\\n bool isAllowed = abi.decode(data, (bool));\\n\\n if (!isAllowed || !success) {\\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\\n }\\n }\\n\\n /********************************************\\n * Internal Functions: Contract Interaction *\\n ********************************************/\\n\\n /**\\n * Creates a new contract and associates it with some contract address.\\n * @param _contractAddress Address to associate the created contract with.\\n * @param _bytecode Bytecode to be used to create the contract.\\n * @return _created Final OVM contract address.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n // We always update the nonce of the creating account, even if the creation fails.\\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\\n\\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _contractAddress;\\n\\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\\n // `safeCREATE` reverts.\\n (bool _success, ) = _handleExternalInteraction(\\n nextMessageContext,\\n gasleft(),\\n address(this),\\n abi.encodeWithSignature(\\n \\\"safeCREATE(address,bytes)\\\",\\n _contractAddress,\\n _bytecode\\n )\\n );\\n\\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\\n // some parent EVM message.\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return _success ? _contractAddress : address(0);\\n }\\n\\n /**\\n * Calls the deployed contract associated with a given address.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _contract OVM address to be called.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _callContract(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\\n if (\\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\\n ) {\\n return (true, hex'');\\n }\\n\\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalInteraction(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata\\n );\\n }\\n\\n /**\\n * Handles the logic of making an external call and parsing revert information.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _target Address of the contract to call.\\n * @param _data Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _handleExternalInteraction(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _data\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We need to switch over to our next message context for the duration of this call.\\n MessageContext memory prevMessageContext = messageContext;\\n _switchMessageContext(prevMessageContext, _nextMessageContext);\\n\\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\\n // factor.\\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\\n\\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\\n // behavior can be controlled. In particular, we enforce that flags are passed through\\n // revert data as to retrieve execution metadata that would normally be reverted out of\\n // existence.\\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\\n\\n // Switch back to the original message context now that we're out of the call.\\n _switchMessageContext(_nextMessageContext, prevMessageContext);\\n\\n // Assuming there were no reverts, the message record should be accurate here. We'll update\\n // this value in the case of a revert.\\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n\\n // Reverts at this point are completely OK, but we need to make a few updates based on the\\n // information passed through the revert.\\n if (success == false) {\\n (\\n RevertFlag flag,\\n uint256 nuisanceGasLeftPostRevert,\\n uint256 ovmGasRefund,\\n bytes memory returndataFromFlag\\n ) = _decodeRevertData(returndata);\\n\\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\\n // halt any further transaction execution that could impact the execution result.\\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\\n _revertWithFlag(flag);\\n }\\n\\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\\n // is to record the gas refund reported by the call (enforced by safety checking).\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n || flag == RevertFlag.STATIC_VIOLATION\\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\\n ) {\\n transactionRecord.ovmGasRefund = ovmGasRefund;\\n }\\n\\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\\n // flag, *not* the full encoded flag. All other revert types return no data.\\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\\n returndata = returndataFromFlag;\\n } else {\\n returndata = hex'';\\n }\\n\\n // Reverts mean we need to use up whatever \\\"nuisance gas\\\" was used by the call.\\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\\n // to zero. OUT_OF_GAS is a \\\"pseudo\\\" flag given that messages return no data when they\\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\\n // will simply pass up the remaining nuisance gas.\\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\\n }\\n\\n // We need to reset the nuisance gas back to its original value minus the amount used here.\\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\\n\\n return (\\n success,\\n returndata\\n );\\n }\\n\\n\\n /******************************************\\n * Internal Functions: State Manipulation *\\n ******************************************/\\n\\n /**\\n * Checks whether an account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account exists.\\n */\\n function _hasAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasAccount(_address);\\n }\\n\\n /**\\n * Checks whether a known empty account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account empty exists.\\n */\\n function _hasEmptyAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasEmptyAccount(_address);\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function _setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.setAccountNonce(_address, _nonce);\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function _getAccountNonce(\\n address _address\\n )\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountNonce(_address);\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function _getAccountEthAddress(\\n address _address\\n )\\n internal\\n returns (\\n address _ethAddress\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountEthAddress(_address);\\n }\\n\\n /**\\n * Creates the default account object for the given address.\\n * @param _address Address of the account create.\\n */\\n function _initPendingAccount(\\n address _address\\n )\\n internal\\n {\\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\\n // actually consider an account \\\"changed\\\" until it's inserted into the state (in this case\\n // by `_commitPendingAccount`).\\n _checkAccountLoad(_address);\\n ovmStateManager.initPendingAccount(_address);\\n }\\n\\n /**\\n * Stores additional relevant data for a new account, thereby \\\"committing\\\" it to the state.\\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\\n * creation.\\n * @param _address Address of the account to commit.\\n * @param _ethAddress Address of the associated deployed contract.\\n * @param _codeHash Hash of the code stored at the address.\\n */\\n function _commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.commitPendingAccount(\\n _address,\\n _ethAddress,\\n _codeHash\\n );\\n }\\n\\n /**\\n * Retrieves the value of a storage slot.\\n * @param _contract Address of the contract to query.\\n * @param _key 32 byte key of the storage slot.\\n * @return _value 32 byte storage slot value.\\n */\\n function _getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32 _value\\n )\\n {\\n _checkContractStorageLoad(_contract, _key);\\n return ovmStateManager.getContractStorage(_contract, _key);\\n }\\n\\n /**\\n * Sets the value of a storage slot.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte key of the storage slot.\\n * @param _value 32 byte storage slot value.\\n */\\n function _putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n // We don't set storage if the value didn't change. Although this acts as a convenient\\n // optimization, it's also necessary to avoid the case in which a contract with no storage\\n // attempts to store the value \\\"0\\\" at any key. Putting this value (and therefore requiring\\n // that the value be committed into the storage trie after execution) would incorrectly\\n // modify the storage root.\\n if (_getContractStorage(_contract, _key) == _value) {\\n return;\\n }\\n\\n _checkContractStorageChange(_contract, _key);\\n ovmStateManager.putContractStorage(_contract, _key, _value);\\n }\\n\\n /**\\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been loaded before.\\n * @param _address Address of the account to load.\\n */\\n function _checkAccountLoad(\\n address _address\\n )\\n internal\\n {\\n // See `_checkContractStorageLoad` for more information.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // See `_checkContractStorageLoad` for more information.\\n if (ovmStateManager.hasAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the account has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is loaded.\\n (\\n bool _wasAccountAlreadyLoaded\\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyLoaded == false) {\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been changed before.\\n * @param _address Address of the account to change.\\n */\\n function _checkAccountChange(\\n address _address\\n )\\n internal\\n {\\n // Start by checking for a load as we only want to charge nuisance gas proportional to\\n // contract size once.\\n _checkAccountLoad(_address);\\n\\n // Check whether the account has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is changed.\\n (\\n bool _wasAccountAlreadyChanged\\n ) = ovmStateManager.testAndSetAccountChanged(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyChanged == false) {\\n ovmStateManager.incrementTotalUncommittedAccounts();\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been loaded before.\\n * @param _contract Address of the account to load from.\\n * @param _key 32 byte key to load.\\n */\\n function _checkContractStorageLoad(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\\n // on L1 but not on L2. A contract could use this behavior to prevent the\\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\\n // allows us to also charge for the full message nuisance gas, because you deserve that for\\n // trying to break the contract in this way.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // We need to make sure that the transaction isn't trying to access storage that hasn't\\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\\n // We know that we have enough gas to do this check because of the above test.\\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is loaded.\\n (\\n bool _wasContractStorageAlreadyLoaded\\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\\n\\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyLoaded == false) {\\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been changed before.\\n * @param _contract Address of the account to change.\\n * @param _key 32 byte key to change.\\n */\\n function _checkContractStorageChange(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Start by checking for load to make sure we have the storage slot and that we charge the\\n // \\\"nuisance gas\\\" necessary to prove the storage slot state.\\n _checkContractStorageLoad(_contract, _key);\\n\\n // Check whether the slot has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is changed.\\n (\\n bool _wasContractStorageAlreadyChanged\\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\\n\\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyChanged == false) {\\n // Changing a storage slot means that we're also going to have to change the\\n // corresponding account, so do an account change check.\\n _checkAccountChange(_contract);\\n\\n ovmStateManager.incrementTotalUncommittedContractStorage();\\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\\n }\\n }\\n\\n\\n /************************************\\n * Internal Functions: Revert Logic *\\n ************************************/\\n\\n /**\\n * Simple encoding for revert data.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided revert data.\\n * @return _revertdata Encoded revert data.\\n */\\n function _encodeRevertData(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n view\\n returns (\\n bytes memory _revertdata\\n )\\n {\\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\\n if (\\n _flag == RevertFlag.OUT_OF_GAS\\n || _flag == RevertFlag.CREATE_EXCEPTION\\n ) {\\n return bytes('');\\n }\\n\\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\\n return abi.encode(\\n _flag,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // Just ABI encode the rest of the parameters.\\n return abi.encode(\\n _flag,\\n messageRecord.nuisanceGasLeft,\\n transactionRecord.ovmGasRefund,\\n _data\\n );\\n }\\n\\n /**\\n * Simple decoding for revert data.\\n * @param _revertdata Revert data to decode.\\n * @return _flag Flag used to revert.\\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\\n * @return _ovmGasRefund Amount of gas refunded during the message.\\n * @return _data Additional user-provided revert data.\\n */\\n function _decodeRevertData(\\n bytes memory _revertdata\\n )\\n internal\\n pure\\n returns (\\n RevertFlag _flag,\\n uint256 _nuisanceGasLeft,\\n uint256 _ovmGasRefund,\\n bytes memory _data\\n )\\n {\\n // A length of zero means the call ran out of gas, just return empty data.\\n if (_revertdata.length == 0) {\\n return (\\n RevertFlag.OUT_OF_GAS,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // ABI decode the incoming data.\\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided data.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n {\\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\\n // thinking there was a failure.\\n bool isCreation;\\n assembly {\\n isCreation := eq(extcodesize(caller()), 0)\\n }\\n\\n if (isCreation) {\\n messageRecord.revertFlag = _flag;\\n\\n assembly {\\n return(0, 1)\\n }\\n }\\n\\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\\n // revert normally.\\n bytes memory revertdata = _encodeRevertData(\\n _flag,\\n _data\\n );\\n\\n assembly {\\n revert(add(revertdata, 0x20), mload(revertdata))\\n }\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag\\n )\\n internal\\n {\\n _revertWithFlag(_flag, bytes(''));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Nuisance Gas Logic *\\n ******************************************/\\n\\n /**\\n * Computes the nuisance gas limit from the gas limit.\\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\\n * this implementation is perfectly fine, but we may change this formula later.\\n * @param _gasLimit Gas limit to compute from.\\n * @return _nuisanceGasLimit Computed nuisance gas limit.\\n */\\n function _getNuisanceGasLimit(\\n uint256 _gasLimit\\n )\\n internal\\n view\\n returns (\\n uint256 _nuisanceGasLimit\\n )\\n {\\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\\n }\\n\\n /**\\n * Uses a certain amount of nuisance gas.\\n * @param _amount Amount of nuisance gas to use.\\n */\\n function _useNuisanceGas(\\n uint256 _amount\\n )\\n internal\\n {\\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\\n // refund to be given at the end of the transaction.\\n if (messageRecord.nuisanceGasLeft < _amount) {\\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\\n }\\n\\n messageRecord.nuisanceGasLeft -= _amount;\\n }\\n\\n\\n /************************************\\n * Internal Functions: Gas Metering *\\n ************************************/\\n\\n /**\\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\\n * @param _timestamp Transaction timestamp.\\n */\\n function _checkNeedsNewEpoch(\\n uint256 _timestamp\\n )\\n internal\\n {\\n if (\\n _timestamp >= (\\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\\n + gasMeterConfig.secondsPerEpoch\\n )\\n ) {\\n _putGasMetadata(\\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\\n _timestamp\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\\n )\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\\n )\\n );\\n }\\n }\\n\\n /**\\n * Validates the gas limit for a given transaction.\\n * @param _gasLimit Gas limit provided by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n * @return _valid Whether or not the gas limit is valid.\\n */\\n function _isValidGasLimit(\\n uint256 _gasLimit,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n returns (\\n bool _valid\\n )\\n {\\n // Always have to be below the maximum gas limit.\\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\\n return false;\\n }\\n\\n // Always have to be above the minimum gas limit.\\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\\n return false;\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n return true;\\n // GasMetadataKey cumulativeGasKey;\\n // GasMetadataKey prevEpochGasKey;\\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\\n // } else {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\\n // }\\n\\n // return (\\n // (\\n // _getGasMetadata(cumulativeGasKey)\\n // - _getGasMetadata(prevEpochGasKey)\\n // + _gasLimit\\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\\n // );\\n }\\n\\n /**\\n * Updates the cumulative gas after a transaction.\\n * @param _gasUsed Gas used by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n */\\n function _updateCumulativeGas(\\n uint256 _gasUsed,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n {\\n GasMetadataKey cumulativeGasKey;\\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n } else {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n }\\n\\n _putGasMetadata(\\n cumulativeGasKey,\\n (\\n _getGasMetadata(cumulativeGasKey)\\n + gasMeterConfig.minTransactionGasLimit\\n + _gasUsed\\n - transactionRecord.ovmGasRefund\\n )\\n );\\n }\\n\\n /**\\n * Retrieves the value of a gas metadata key.\\n * @param _key Gas metadata key to retrieve.\\n * @return _value Value stored at the given key.\\n */\\n function _getGasMetadata(\\n GasMetadataKey _key\\n )\\n internal\\n returns (\\n uint256 _value\\n )\\n {\\n return uint256(_getContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key))\\n ));\\n }\\n\\n /**\\n * Sets the value of a gas metadata key.\\n * @param _key Gas metadata key to set.\\n * @param _value Value to store at the given key.\\n */\\n function _putGasMetadata(\\n GasMetadataKey _key,\\n uint256 _value\\n )\\n internal\\n {\\n _putContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key)),\\n bytes32(uint256(_value))\\n );\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Execution Context *\\n *****************************************/\\n\\n /**\\n * Swaps over to a new message context.\\n * @param _prevMessageContext Context we're switching from.\\n * @param _nextMessageContext Context we're switching to.\\n */\\n function _switchMessageContext(\\n MessageContext memory _prevMessageContext,\\n MessageContext memory _nextMessageContext\\n )\\n internal\\n {\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n }\\n\\n /**\\n * Initializes the execution context.\\n * @param _transaction OVM transaction being executed.\\n */\\n function _initContext(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n internal\\n {\\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\\n transactionContext.ovmNUMBER = _transaction.blockNumber;\\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\\n\\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\\n }\\n\\n /**\\n * Resets the transaction and message context.\\n */\\n function _resetContext()\\n internal\\n {\\n transactionContext.ovmL1TXORIGIN = address(0);\\n transactionContext.ovmTIMESTAMP = 0;\\n transactionContext.ovmNUMBER = 0;\\n transactionContext.ovmGASLIMIT = 0;\\n transactionContext.ovmTXGASLIMIT = 0;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = 0;\\n\\n messageContext.ovmCALLER = address(0);\\n messageContext.ovmADDRESS = address(0);\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = 0;\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n }\\n\\n /*****************************\\n * L2-only Helper Functions *\\n *****************************/\\n\\n /**\\n * Unreachable helper function for simulating eth_calls with an OVM message context.\\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\\n * @param _transaction the message transaction to simulate.\\n * @param _from the OVM account the simulated call should be from.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n // Prevent this call from having any effect unless in a custom-set VM frame\\n require(msg.sender == address(0));\\n\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n\\n messageRecord.nuisanceGasLeft = uint(-1);\\n messageContext.ovmADDRESS = _transaction.entrypoint;\\n messageContext.ovmCALLER = _from;\\n\\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\\n }\\n}\\n\",\"keccak256\":\"0x5432ac3e92c78d3bc9faf52e4081cd95b4b6d7858ce14636822f1b2c41cfcc43\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_DeployerWhitelist\\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \\n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n \\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n address owner = Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\\n \\\"Function can only be called by the owner of this contract.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n \\n /**\\n * Initializes the whitelist.\\n * @param _owner Address of the owner for this contract.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function initialize(\\n address _owner,\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == true) {\\n return;\\n }\\n\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_INITIALIZED,\\n Lib_Bytes32Utils.fromBool(true)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Gets the owner of the whitelist.\\n */\\n function getOwner()\\n override\\n public\\n returns(\\n address\\n )\\n {\\n return Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n }\\n\\n /**\\n * Adds or removes an address from the deployment whitelist.\\n * @param _deployer Address to update permissions for.\\n * @param _isWhitelisted Whether or not the address is whitelisted.\\n */\\n function setWhitelistedDeployer(\\n address _deployer,\\n bool _isWhitelisted\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n Lib_Bytes32Utils.fromAddress(_deployer),\\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\\n );\\n }\\n\\n /**\\n * Updates the owner of this contract.\\n * @param _owner Address of the new owner.\\n */\\n function setOwner(\\n address _owner\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n }\\n\\n /**\\n * Updates the arbitrary deployment flag.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function setAllowArbitraryDeployment(\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n public\\n onlyOwner\\n {\\n setAllowArbitraryDeployment(true);\\n setOwner(address(0));\\n }\\n\\n /**\\n * Checks whether an address is allowed to deploy contracts.\\n * @param _deployer Address to check.\\n * @return _allowed Whether or not the address can deploy contracts.\\n */\\n function isDeployerAllowed(\\n address _deployer\\n )\\n override\\n public\\n returns (\\n bool _allowed\\n )\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == false) {\\n return true;\\n }\\n\\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\\n );\\n\\n if (allowArbitraryDeployment == true) {\\n return true;\\n }\\n\\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n Lib_Bytes32Utils.fromAddress(_deployer)\\n )\\n );\\n\\n return isWhitelisted; \\n }\\n}\\n\",\"keccak256\":\"0x8737cfb9c47bf262eb16b80ca9111e0b347b1fe06c517569907056b8e2f28aaf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_ECDSAContractAccount\\n */\\ninterface iOVM_ECDSAContractAccount {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external returns (bool _success, bytes memory _returndata);\\n}\\n\",\"keccak256\":\"0x308729bc62dcffb11ff1d840781105cf1bf0dd4cbcfb1af704b800bb0cfe9b85\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_DeployerWhitelist\\n */\\ninterface iOVM_DeployerWhitelist {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\\n function getOwner() external returns (address _owner);\\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\\n function setOwner(address _newOwner) external;\\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\\n function enableArbitraryContractDeployment() external;\\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\\n}\\n\",\"keccak256\":\"0x969394371cacfc36493230150b6d629173ea72dfdf729330bede475b91d0f004\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_ECDSAUtils\\n */\\nlibrary Lib_ECDSAUtils {\\n\\n /**************************************\\n * Internal Functions: ECDSA Recovery *\\n **************************************/\\n\\n /**\\n * Recovers a signed address given a message and signature.\\n * @param _message Message that was originally signed.\\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _sender Signer address.\\n */\\n function recover(\\n bytes memory _message,\\n bool _isEthSignedMessage,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n pure\\n returns (\\n address _sender\\n )\\n {\\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\\n\\n return ecrecover(\\n messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n }\\n\\n function getMessageHash(\\n bytes memory _message,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (bytes32) {\\n if (_isEthSignedMessage) {\\n return getEthSignedMessageHash(_message);\\n }\\n return getNativeMessageHash(_message);\\n }\\n\\n\\n /*************************************\\n * Private Functions: ECDSA Recovery *\\n *************************************/\\n\\n /**\\n * Gets the native message hash (simple keccak256) for a message.\\n * @param _message Message to hash.\\n * @return _messageHash Native message hash.\\n */\\n function getNativeMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n return keccak256(_message);\\n }\\n\\n /**\\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\\n * @param _message Message to hash.\\n * @return _messageHash Prefixed message hash.\\n */\\n function getEthSignedMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n bytes memory prefix = \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\";\\n bytes32 messageHash = keccak256(_message);\\n return keccak256(abi.encodePacked(prefix, messageHash));\\n }\\n}\",\"keccak256\":\"0xda865d8cc014940a4755e329db9c6272a31bd9a340000a4ecc005d46299a585c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Math\\n */\\nlibrary Lib_Math {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates the minumum of two numbers.\\n * @param _x First number to compare.\\n * @param _y Second number to compare.\\n * @return Lesser of the two numbers.\\n */\\n function min(\\n uint256 _x,\\n uint256 _y\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n if (_x < _y) {\\n return _x;\\n }\\n\\n return _y;\\n }\\n}\\n\",\"keccak256\":\"0xcc36559529e708e99b8fd2ab0078fcba5a1f81787b08c1cf4cd46288ad64ee58\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_MerkleTree\\n * @author River Keefer\\n */\\nlibrary Lib_MerkleTree {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\\n * If you do not know the original length of elements for the tree you are verifying,\\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\\n * @param _elements Array of hashes from which to generate a merkle root.\\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\\n */\\n function getMerkleRoot(\\n bytes32[] memory _elements\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _elements.length > 0,\\n \\\"Lib_MerkleTree: Must provide at least one leaf hash.\\\"\\n );\\n\\n if (_elements.length == 0) {\\n return _elements[0];\\n }\\n\\n uint256[16] memory defaults = [\\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\\n ];\\n\\n // Reserve memory space for our hashes.\\n bytes memory buf = new bytes(64);\\n\\n // We'll need to keep track of left and right siblings.\\n bytes32 leftSibling;\\n bytes32 rightSibling;\\n\\n // Number of non-empty nodes at the current depth.\\n uint256 rowSize = _elements.length;\\n\\n // Current depth, counting from 0 at the leaves\\n uint256 depth = 0;\\n\\n // Common sub-expressions\\n uint256 halfRowSize; // rowSize / 2\\n bool rowSizeIsOdd; // rowSize % 2 == 1\\n\\n while (rowSize > 1) {\\n halfRowSize = rowSize / 2;\\n rowSizeIsOdd = rowSize % 2 == 1;\\n\\n for (uint256 i = 0; i < halfRowSize; i++) {\\n leftSibling = _elements[(2 * i) ];\\n rightSibling = _elements[(2 * i) + 1];\\n assembly {\\n mstore(add(buf, 32), leftSibling )\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[i] = keccak256(buf);\\n }\\n\\n if (rowSizeIsOdd) {\\n leftSibling = _elements[rowSize - 1];\\n rightSibling = bytes32(defaults[depth]);\\n assembly {\\n mstore(add(buf, 32), leftSibling)\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[halfRowSize] = keccak256(buf);\\n }\\n\\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\\n depth++;\\n }\\n\\n return _elements[0];\\n }\\n\\n /**\\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\\n * of leaves generated is a known, correct input, and does not return true for indices \\n * extending past that index (even if _siblings would be otherwise valid.)\\n * @param _root The Merkle root to verify against.\\n * @param _leaf The leaf hash to verify inclusion of.\\n * @param _index The index in the tree of this leaf.\\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \\n * @param _totalLeaves The total number of leaves originally passed into.\\n * @return Whether or not the merkle branch and leaf passes verification.\\n */\\n function verify(\\n bytes32 _root,\\n bytes32 _leaf,\\n uint256 _index,\\n bytes32[] memory _siblings,\\n uint256 _totalLeaves\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _totalLeaves > 0,\\n \\\"Lib_MerkleTree: Total leaves must be greater than zero.\\\"\\n );\\n\\n require(\\n _index < _totalLeaves,\\n \\\"Lib_MerkleTree: Index out of bounds.\\\"\\n );\\n\\n require(\\n _siblings.length == _ceilLog2(_totalLeaves),\\n \\\"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\\\"\\n );\\n\\n bytes32 computedRoot = _leaf;\\n\\n for (uint256 i = 0; i < _siblings.length; i++) {\\n if ((_index & 1) == 1) {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n _siblings[i],\\n computedRoot\\n )\\n );\\n } else {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n computedRoot,\\n _siblings[i]\\n )\\n );\\n }\\n\\n _index >>= 1;\\n }\\n\\n return _root == computedRoot;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Calculates the integer ceiling of the log base 2 of an input.\\n * @param _in Unsigned input to calculate the log.\\n * @return ceil(log_base_2(_in))\\n */\\n function _ceilLog2(\\n uint256 _in\\n )\\n private\\n pure\\n returns (\\n uint256\\n )\\n { \\n require(\\n _in > 0,\\n \\\"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\\\"\\n );\\n\\n if (_in == 1) {\\n return 0;\\n }\\n\\n // Find the highest set bit (will be floor(log_2)).\\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\\n uint256 val = _in;\\n uint256 highest = 0;\\n for (uint8 i = 128; i >= 1; i >>= 1) {\\n if (val & (uint(1) << i) - 1 << i != 0) {\\n highest += i;\\n val >>= i;\\n }\\n }\\n\\n // Increment by one if this is not a perfect logarithm.\\n if ((uint(1) << highest) != _in) {\\n highest += 1;\\n }\\n\\n return highest;\\n }\\n}\\n\",\"keccak256\":\"0xd7459ac196122e9ba672802d2726708a206dac46efbf9820fb66f5f1c53f89bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\\n// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"./Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_SafeMathWrapper\\n */\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\n\\nlibrary Lib_SafeMathWrapper {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal returns (uint256) {\\n uint256 c = a + b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \\\"Lib_SafeMathWrapper: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal returns (uint256) {\\n return sub(a, b, \\\"Lib_SafeMathWrapper: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \\\"Lib_SafeMathWrapper: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal returns (uint256) {\\n return div(a, b, \\\"Lib_SafeMathWrapper: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal returns (uint256) {\\n return mod(a, b, \\\"Lib_SafeMathWrapper: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0xc58aa064894677f65fc8205f79252d15e59a0f5e2794e5c2d069c7b2bc97a9e2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620031f8380380620031f8833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61313680620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461022c578063d0f8934414610234578063e10d29ee1461023c578063e561dddc14610244578063f722b41a1461024c578063facdc5da1461025457610137565b8063876ed5cb146102045780638d38c6c11461020c578063b8f7700514610214578063c139eb151461021c578063c2cf696f1461022457610137565b80635ae6256d116100ff5780635ae6256d146101cf5780636fee07e0146101d757806378f4b2f2146101ec5780637a167a8a146101f45780637aa63a86146101fc57610137565b8063138387a41461013c5780632a7f18be1461015a578063378997701461017a578063461a44781461018f5780634de569ce146101af575b600080fd5b610144610267565b6040516101519190612f02565b60405180910390f35b61016d610168366004612396565b61026d565b6040516101519190612ed4565b6101826103bc565b6040516101519190612f32565b6101a261019d366004612229565b6103d0565b60405161015191906123f9565b6101c26101bd36600461226f565b6104ac565b6040516101519190612492565b6101826104e6565b6101ea6101e5366004612196565b6104fa565b005b61014461071d565b610182610724565b610144610739565b610144610754565b61014461075a565b610182610760565b6101446107e9565b6101446107ef565b6101a26107f4565b6101ea61081c565b6101a2610c03565b610144610c26565b610182610ca0565b6101ea610262366004612396565b610cb8565b60025481565b610275611ee7565b600061027f610c03565b604051634a83e9cd60e11b815290915060028402906000906001600160a01b03841690639507d39a906102b6908590600401612f32565b60206040518083038186803b1580156102ce57600080fd5b505afa1580156102e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103069190612211565b90506000836001600160a01b0316639507d39a846001016040518263ffffffff1660e01b81526004016103399190612f32565b60206040518083038186803b15801561035157600080fd5b505afa158015610365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103899190612211565b6040805160608101825293845264ffffffffff808316602086015260289290921c9091169083015250925050505b919050565b6000806103c7610e1b565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610430578181015183820152602001610418565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b505192915050565b82516000901515600114156104ce576104c785858585610ec9565b90506104de565b6104c78585602001518585611094565b949350505050565b6000806104f1610e1b565b94505050505090565b612710815111156105265760405162461bcd60e51b815260040161051d906125ae565b60405180910390fd5b6003548211156105485760405162461bcd60e51b815260040161051d906127b4565b620186a082101561056b5760405162461bcd60e51b815260040161051d90612996565b6020820460005a90508181116105935760405162461bcd60e51b815260040161051d90612c10565b60005b825a830310156105a857600101610596565b6000338787876040516020016105c1949392919061240d565b60408051601f19818403018152919052805160209091012090504360281b421760006105eb610c03565b604051631a83804360e31b81529091506001600160a01b0382169063d41c02189061061c90869086906004016124eb565b600060405180830381600087803b15801561063657600080fd5b505af115801561064a573d6000803e3d6000fd5b5050505060006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190612211565b816106ca57fe5b0490507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b60018603426040516107099695949392919061244a565b60405180910390a150505050505050505050565b620186a081565b60008061072f610e1b565b5090935050505090565b600080610744610e1b565b50505064ffffffffff1692915050565b61271081565b60035481565b6000600261076c610c03565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc9190612211565b816107e357fe5b04905090565b60015481565b602081565b60006108176040518060600160405280602581526020016130a8602591396103d0565b905090565b60043560d81c60093560e890811c90600c35901c610838610739565b8364ffffffffff161461085d5760405162461bcd60e51b815260040161051d90612abb565b61088b6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b0316146108bb5760405162461bcd60e51b815260040161051d90612b18565b60008162ffffff16116108e05760405162461bcd60e51b815260040161051d90612811565b60008262ffffff16116109055760405162461bcd60e51b815260040161051d90612d65565b600f601062ffffff831602013664ffffffffff82168110156109395760405162461bcd60e51b815260040161051d90612dec565b6000610943610760565b905060008562ffffff1667ffffffffffffffff8111801561096357600080fd5b5060405190808252806020026020018201604052801561098d578160200160208202803683370190505b509050600080600061099d610724565b90506109a7611f07565b60005b8962ffffff168163ffffffff161015610ada5760006109ce8263ffffffff16611169565b905063ffffffff82166109e4576109e4816111b9565b6109ef838286611286565b80925060005b835163ffffffff82161015610a50578a3560e81c610a1b8564ffffffffff8e1683611396565b898963ffffffff1681518110610a2d57fe5b60209081029190910101529a909a016003019960019687019695860195016109f5565b5060005b83602001518163ffffffff161015610ad0578864ffffffffff168564ffffffffff1610610a935760405162461bcd60e51b815260040161051d90612e2e565b610aa38564ffffffffff16611420565b888863ffffffff1681518110610ab557fe5b60209081029190910101526001968701969485019401610a54565b50506001016109aa565b50610ae48161146b565b8764ffffffffff168714610b0a5760405162461bcd60e51b815260040161051d90612859565b8962ffffff168463ffffffff1614610b345760405162461bcd60e51b815260040161051d906128a7565b6000838b62ffffff160363ffffffff169050600080836020015160001415610b6757505060408201516060830151610b8e565b6000610b7c6001870364ffffffffff1661026d565b90508060200151925080604001519150505b610baf610b9a896114b3565b8e62ffffff168564ffffffffff1685856118e3565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610bdc610739565b604051610beb93929190612f44565b60405180910390a15050505050505050505050505050565b6000610817604051806060016040528060238152602001612f8b602391396103d0565b6000610c306107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6857600080fd5b505afa158015610c7c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108179190612211565b6000610caa610724565b610cb2610760565b03905090565b60405162461bcd60e51b815260040161051d9061251e565b83811015610d9557610d066040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b031614610d62576000610d308364ffffffffff1661026d565b905042600154826020015164ffffffffff160110610d605760405162461bcd60e51b815260040161051d90612a48565b505b610d728264ffffffffff16611420565b838281518110610d7e57fe5b602090810291909101015260019182019101610cd0565b506000610dab6001830364ffffffffff1661026d565b9050610dca610db9846114b3565b8586846020015185604001516118e3565b7f64d7f508348c70dea42d5302a393987e4abc20e45954ab3f9d320207751956f0848364ffffffffff160385610dfe610739565b604051610e0d93929190612f0b565b60405180910390a150505050565b6000806000806000610e2b6107f4565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9b91906121eb565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610f016040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506103d0565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f3e57600080fd5b505afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f769190612211565b90506000610f8387611a9d565b9050610f90818787611b36565b610fac5760405162461bcd60e51b815260040161051d906126dd565b86606001518860200151148015610fc7575060408701518851145b80156110085750610fef604051806060016040528060228152602001612fae602291396103d0565b6001600160a01b031688608001516001600160a01b0316145b80156110175750818860a00151145b801561102e575060608801516001600160a01b0316155b8015611049575060008860400151600181111561104757fe5b145b801561106a57508660800151805190602001208860c0015180519060200120145b6110865760405162461bcd60e51b815260040161051d9061277d565b506001979650505050505050565b6000806110a085611420565b90506110ad818585611b36565b6110c95760405162461bcd60e51b815260040161051d90612cb0565b6000866060015187608001518860a001518960c001516040516020016110f2949392919061240d565b60405160208183030381529060405280519060200120905060006111158761026d565b80519091508214801561113357508751602082015164ffffffffff16145b801561114d57508760200151816040015164ffffffffff16145b6110865760405162461bcd60e51b815260040161051d90612b65565b611171611f07565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111c3610739565b1115611233576000806111d4610e1b565b9350935050508064ffffffffff16836060015110156112055760405162461bcd60e51b815260040161051d9061272b565b8164ffffffffff16836040015110156112305760405162461bcd60e51b815260040161051d9061260b565b50505b42600154826040015101101561125b5760405162461bcd60e51b815260040161051d90612da6565b4360025482606001510110156112835760405162461bcd60e51b815260040161051d90612565565b50565b8260400151826040015110156112ae5760405162461bcd60e51b815260040161051d90612c5b565b8260600151826060015110156112d65760405162461bcd60e51b815260040161051d90612e77565b6000816112e1610760565b0364ffffffffff1611156113915760006113018264ffffffffff1661026d565b9050600154816020015164ffffffffff160142106113315760405162461bcd60e51b815260040161051d9061265a565b806020015164ffffffffff16836040015111156113605760405162461bcd60e51b815260040161051d906129df565b806040015164ffffffffff168360600151111561138f5760405162461bcd60e51b815260040161051d90612cfa565b505b505050565b6000808260410167ffffffffffffffff811180156113b357600080fd5b506040519080825280601f01601f1916602001820160405280156113de576020820181803683370190505b50604086015160608701519192509060006020840160018153836001820152826021820152866003890160418301376041870190209450505050509392505050565b60006114656040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c27565b92915050565b428160400151111561148f5760405162461bcd60e51b815260040161051d90612bcb565b43816060015111156112835760405162461bcd60e51b815260040161051d90612917565b6000808251116114f45760405162461bcd60e51b81526004018080602001828103825260348152602001806130cd6034913960400191505060405180910390fd5b8151611516578160008151811061150757fe5b602002602001015190506103b7565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118bf5750506002820460018084161460005b8281101561183b578a81600202815181106117e257fe5b602002602001015196508a81600202600101815181106117fe57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061182857fe5b60209081029190910101526001016117cb565b50801561189e5789600185038151811061185157fe5b6020026020010151955087836010811061186757fe5b602002015160001b945085602088015284604088015286805190602001208a838151811061189157fe5b6020026020010181815250505b806118aa5760006118ad565b60015b60ff16820193506001909201916117b3565b896000815181106118cc57fe5b602002602001015198505050505050505050919050565b6000806000806118f1610e1b565b935093509350935060006040518060a0016040528061190e6107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561194657600080fd5b505afa15801561195a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197e9190612211565b81526020018b81526020018a81526020018664ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516119fb94939291906124f9565b60405180910390a26000611a0e82611c6f565b90506000611a26836040015188018b88018b8b611c98565b9050611a306107f4565b6001600160a01b0316632015276c83836040518363ffffffff1660e01b8152600401611a5d9291906124d5565b600060405180830381600087803b158015611a7757600080fd5b505af1158015611a8b573d6000803e3d6000fd5b50505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611ac357600080fd5b506040519080825280601f01601f191660200182016040528015611aee576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611b406107f4565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611b6e91600401612f21565b60206040518083038186803b158015611b8657600080fd5b505afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190612211565b611bc784611c6f565b14611be45760405162461bcd60e51b815260040161051d90612b9c565b611c01836020015185846000015185602001518760400151611cb7565b611c1d5760405162461bcd60e51b815260040161051d9061295f565b5060019392505050565b8051602080830151604080850151606086015160808701519251600096611c5296909594910161249d565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5294939291906124f9565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cf75760405162461bcd60e51b81526004018080602001828103825260378152602001806130246037913960400191505060405180910390fd5b818410611d355760405162461bcd60e51b8152600401808060200182810382526024815260200180612fd06024913960400191505060405180910390fd5b611d3e82611e3c565b835114611d7c5760405162461bcd60e51b815260040180806020018281038252604d81526020018061305b604d913960600191505060405180910390fd5b8460005b8451811015611e2f578560011660011415611dde57848181518110611da157fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e23565b81858281518110611deb57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d80565b5090951495945050505050565b6000808211611e7c5760405162461bcd60e51b8152600401808060200182810382526030815260200180612ff46030913960400191505060405180910390fd5b8160011415611e8d575060006103b7565b81600060805b60018160ff1610611ed1578060ff1660018260ff166001901b03901b8316600014611ec65760ff811692831c9291909101905b60011c607f16611e93565b506001811b8414611ee0576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f4357fe5b611f56601f8401601f1916602001612f66565b9050828152838383011115611f6a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146103b757600080fd5b600082601f830112611fa8578081fd5b611ee083833560208501611f2f565b8035600281106103b757600080fd5b600060a08284031215611fd7578081fd5b60405160a0810167ffffffffffffffff8282108183111715611ff557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b5061203f85828601611f98565b6080830152505092915050565b60006040828403121561205d578081fd5b6040516040810167ffffffffffffffff828210818311171561207b57fe5b816040528293508435835260209150818501358181111561209b57600080fd5b8501601f810187136120ac57600080fd5b8035828111156120b857fe5b83810292506120c8848401612f66565b8181528481019083860185850187018b10156120e357600080fd5b600095505b838610156121065780358352600195909501949186019186016120e8565b5080868801525050505050505092915050565b600060a0828403121561212a578081fd5b60405160a0810167ffffffffffffffff828210818311171561214857fe5b8160405282935084359150811515821461216157600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b6000806000606084860312156121aa578283fd5b6121b384611f81565b925060208401359150604084013567ffffffffffffffff8111156121d5578182fd5b6121e186828701611f98565b9150509250925092565b6000602082840312156121fc578081fd5b815164ffffffffff1981168114611ee0578182fd5b600060208284031215612222578081fd5b5051919050565b60006020828403121561223a578081fd5b813567ffffffffffffffff811115612250578182fd5b8201601f81018413612260578182fd5b6104de84823560208401611f2f565b60008060008060808587031215612284578081fd5b843567ffffffffffffffff8082111561229b578283fd5b9086019060e082890312156122ae578283fd5b6122b860e0612f66565b82358152602083013560208201526122d260408401611fb7565b60408201526122e360608401611f81565b60608201526122f460808401611f81565b608082015260a083013560a082015260c083013582811115612314578485fd5b6123208a828601611f98565b60c0830152509550602087013591508082111561233b578283fd5b61234788838901612119565b9450604087013591508082111561235c578283fd5b61236888838901611fc6565b9350606087013591508082111561237d578283fd5b5061238a8782880161204c565b91505092959194509250565b6000602082840312156123a7578081fd5b5035919050565b60008151808452815b818110156123d3576020818501810151868301820152016123b7565b818111156123e45782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612440908301846123ae565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061247d908301866123ae565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124ca60a08301846123ae565b979650505050505050565b91825264ffffffffff1916602082015260400190565b918252602082015260400190565b60008582528460208301528360408301526080606083015261244060808301846123ae565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252604d908201527f5175657565207472616e73616374696f6e732063616e6e6f742062652073756260408201527f6d697474656420647572696e67207468652073657175656e63657220696e636c60608201526c3ab9b4b7b7103832b934b7b21760991b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b90815260200190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612f8257fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212207e50b0918881377d2fd55a74570ccb494f88c5b34ae4306e6344457f0356744664736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461022c578063d0f8934414610234578063e10d29ee1461023c578063e561dddc14610244578063f722b41a1461024c578063facdc5da1461025457610137565b8063876ed5cb146102045780638d38c6c11461020c578063b8f7700514610214578063c139eb151461021c578063c2cf696f1461022457610137565b80635ae6256d116100ff5780635ae6256d146101cf5780636fee07e0146101d757806378f4b2f2146101ec5780637a167a8a146101f45780637aa63a86146101fc57610137565b8063138387a41461013c5780632a7f18be1461015a578063378997701461017a578063461a44781461018f5780634de569ce146101af575b600080fd5b610144610267565b6040516101519190612f02565b60405180910390f35b61016d610168366004612396565b61026d565b6040516101519190612ed4565b6101826103bc565b6040516101519190612f32565b6101a261019d366004612229565b6103d0565b60405161015191906123f9565b6101c26101bd36600461226f565b6104ac565b6040516101519190612492565b6101826104e6565b6101ea6101e5366004612196565b6104fa565b005b61014461071d565b610182610724565b610144610739565b610144610754565b61014461075a565b610182610760565b6101446107e9565b6101446107ef565b6101a26107f4565b6101ea61081c565b6101a2610c03565b610144610c26565b610182610ca0565b6101ea610262366004612396565b610cb8565b60025481565b610275611ee7565b600061027f610c03565b604051634a83e9cd60e11b815290915060028402906000906001600160a01b03841690639507d39a906102b6908590600401612f32565b60206040518083038186803b1580156102ce57600080fd5b505afa1580156102e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103069190612211565b90506000836001600160a01b0316639507d39a846001016040518263ffffffff1660e01b81526004016103399190612f32565b60206040518083038186803b15801561035157600080fd5b505afa158015610365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103899190612211565b6040805160608101825293845264ffffffffff808316602086015260289290921c9091169083015250925050505b919050565b6000806103c7610e1b565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610430578181015183820152602001610418565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b505192915050565b82516000901515600114156104ce576104c785858585610ec9565b90506104de565b6104c78585602001518585611094565b949350505050565b6000806104f1610e1b565b94505050505090565b612710815111156105265760405162461bcd60e51b815260040161051d906125ae565b60405180910390fd5b6003548211156105485760405162461bcd60e51b815260040161051d906127b4565b620186a082101561056b5760405162461bcd60e51b815260040161051d90612996565b6020820460005a90508181116105935760405162461bcd60e51b815260040161051d90612c10565b60005b825a830310156105a857600101610596565b6000338787876040516020016105c1949392919061240d565b60408051601f19818403018152919052805160209091012090504360281b421760006105eb610c03565b604051631a83804360e31b81529091506001600160a01b0382169063d41c02189061061c90869086906004016124eb565b600060405180830381600087803b15801561063657600080fd5b505af115801561064a573d6000803e3d6000fd5b5050505060006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190612211565b816106ca57fe5b0490507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b60018603426040516107099695949392919061244a565b60405180910390a150505050505050505050565b620186a081565b60008061072f610e1b565b5090935050505090565b600080610744610e1b565b50505064ffffffffff1692915050565b61271081565b60035481565b6000600261076c610c03565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc9190612211565b816107e357fe5b04905090565b60015481565b602081565b60006108176040518060600160405280602581526020016130a8602591396103d0565b905090565b60043560d81c60093560e890811c90600c35901c610838610739565b8364ffffffffff161461085d5760405162461bcd60e51b815260040161051d90612abb565b61088b6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b0316146108bb5760405162461bcd60e51b815260040161051d90612b18565b60008162ffffff16116108e05760405162461bcd60e51b815260040161051d90612811565b60008262ffffff16116109055760405162461bcd60e51b815260040161051d90612d65565b600f601062ffffff831602013664ffffffffff82168110156109395760405162461bcd60e51b815260040161051d90612dec565b6000610943610760565b905060008562ffffff1667ffffffffffffffff8111801561096357600080fd5b5060405190808252806020026020018201604052801561098d578160200160208202803683370190505b509050600080600061099d610724565b90506109a7611f07565b60005b8962ffffff168163ffffffff161015610ada5760006109ce8263ffffffff16611169565b905063ffffffff82166109e4576109e4816111b9565b6109ef838286611286565b80925060005b835163ffffffff82161015610a50578a3560e81c610a1b8564ffffffffff8e1683611396565b898963ffffffff1681518110610a2d57fe5b60209081029190910101529a909a016003019960019687019695860195016109f5565b5060005b83602001518163ffffffff161015610ad0578864ffffffffff168564ffffffffff1610610a935760405162461bcd60e51b815260040161051d90612e2e565b610aa38564ffffffffff16611420565b888863ffffffff1681518110610ab557fe5b60209081029190910101526001968701969485019401610a54565b50506001016109aa565b50610ae48161146b565b8764ffffffffff168714610b0a5760405162461bcd60e51b815260040161051d90612859565b8962ffffff168463ffffffff1614610b345760405162461bcd60e51b815260040161051d906128a7565b6000838b62ffffff160363ffffffff169050600080836020015160001415610b6757505060408201516060830151610b8e565b6000610b7c6001870364ffffffffff1661026d565b90508060200151925080604001519150505b610baf610b9a896114b3565b8e62ffffff168564ffffffffff1685856118e3565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610bdc610739565b604051610beb93929190612f44565b60405180910390a15050505050505050505050505050565b6000610817604051806060016040528060238152602001612f8b602391396103d0565b6000610c306107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6857600080fd5b505afa158015610c7c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108179190612211565b6000610caa610724565b610cb2610760565b03905090565b60405162461bcd60e51b815260040161051d9061251e565b83811015610d9557610d066040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b031614610d62576000610d308364ffffffffff1661026d565b905042600154826020015164ffffffffff160110610d605760405162461bcd60e51b815260040161051d90612a48565b505b610d728264ffffffffff16611420565b838281518110610d7e57fe5b602090810291909101015260019182019101610cd0565b506000610dab6001830364ffffffffff1661026d565b9050610dca610db9846114b3565b8586846020015185604001516118e3565b7f64d7f508348c70dea42d5302a393987e4abc20e45954ab3f9d320207751956f0848364ffffffffff160385610dfe610739565b604051610e0d93929190612f0b565b60405180910390a150505050565b6000806000806000610e2b6107f4565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9b91906121eb565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610f016040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506103d0565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f3e57600080fd5b505afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f769190612211565b90506000610f8387611a9d565b9050610f90818787611b36565b610fac5760405162461bcd60e51b815260040161051d906126dd565b86606001518860200151148015610fc7575060408701518851145b80156110085750610fef604051806060016040528060228152602001612fae602291396103d0565b6001600160a01b031688608001516001600160a01b0316145b80156110175750818860a00151145b801561102e575060608801516001600160a01b0316155b8015611049575060008860400151600181111561104757fe5b145b801561106a57508660800151805190602001208860c0015180519060200120145b6110865760405162461bcd60e51b815260040161051d9061277d565b506001979650505050505050565b6000806110a085611420565b90506110ad818585611b36565b6110c95760405162461bcd60e51b815260040161051d90612cb0565b6000866060015187608001518860a001518960c001516040516020016110f2949392919061240d565b60405160208183030381529060405280519060200120905060006111158761026d565b80519091508214801561113357508751602082015164ffffffffff16145b801561114d57508760200151816040015164ffffffffff16145b6110865760405162461bcd60e51b815260040161051d90612b65565b611171611f07565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111c3610739565b1115611233576000806111d4610e1b565b9350935050508064ffffffffff16836060015110156112055760405162461bcd60e51b815260040161051d9061272b565b8164ffffffffff16836040015110156112305760405162461bcd60e51b815260040161051d9061260b565b50505b42600154826040015101101561125b5760405162461bcd60e51b815260040161051d90612da6565b4360025482606001510110156112835760405162461bcd60e51b815260040161051d90612565565b50565b8260400151826040015110156112ae5760405162461bcd60e51b815260040161051d90612c5b565b8260600151826060015110156112d65760405162461bcd60e51b815260040161051d90612e77565b6000816112e1610760565b0364ffffffffff1611156113915760006113018264ffffffffff1661026d565b9050600154816020015164ffffffffff160142106113315760405162461bcd60e51b815260040161051d9061265a565b806020015164ffffffffff16836040015111156113605760405162461bcd60e51b815260040161051d906129df565b806040015164ffffffffff168360600151111561138f5760405162461bcd60e51b815260040161051d90612cfa565b505b505050565b6000808260410167ffffffffffffffff811180156113b357600080fd5b506040519080825280601f01601f1916602001820160405280156113de576020820181803683370190505b50604086015160608701519192509060006020840160018153836001820152826021820152866003890160418301376041870190209450505050509392505050565b60006114656040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c27565b92915050565b428160400151111561148f5760405162461bcd60e51b815260040161051d90612bcb565b43816060015111156112835760405162461bcd60e51b815260040161051d90612917565b6000808251116114f45760405162461bcd60e51b81526004018080602001828103825260348152602001806130cd6034913960400191505060405180910390fd5b8151611516578160008151811061150757fe5b602002602001015190506103b7565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118bf5750506002820460018084161460005b8281101561183b578a81600202815181106117e257fe5b602002602001015196508a81600202600101815181106117fe57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061182857fe5b60209081029190910101526001016117cb565b50801561189e5789600185038151811061185157fe5b6020026020010151955087836010811061186757fe5b602002015160001b945085602088015284604088015286805190602001208a838151811061189157fe5b6020026020010181815250505b806118aa5760006118ad565b60015b60ff16820193506001909201916117b3565b896000815181106118cc57fe5b602002602001015198505050505050505050919050565b6000806000806118f1610e1b565b935093509350935060006040518060a0016040528061190e6107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561194657600080fd5b505afa15801561195a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197e9190612211565b81526020018b81526020018a81526020018664ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516119fb94939291906124f9565b60405180910390a26000611a0e82611c6f565b90506000611a26836040015188018b88018b8b611c98565b9050611a306107f4565b6001600160a01b0316632015276c83836040518363ffffffff1660e01b8152600401611a5d9291906124d5565b600060405180830381600087803b158015611a7757600080fd5b505af1158015611a8b573d6000803e3d6000fd5b50505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611ac357600080fd5b506040519080825280601f01601f191660200182016040528015611aee576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611b406107f4565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611b6e91600401612f21565b60206040518083038186803b158015611b8657600080fd5b505afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190612211565b611bc784611c6f565b14611be45760405162461bcd60e51b815260040161051d90612b9c565b611c01836020015185846000015185602001518760400151611cb7565b611c1d5760405162461bcd60e51b815260040161051d9061295f565b5060019392505050565b8051602080830151604080850151606086015160808701519251600096611c5296909594910161249d565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5294939291906124f9565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cf75760405162461bcd60e51b81526004018080602001828103825260378152602001806130246037913960400191505060405180910390fd5b818410611d355760405162461bcd60e51b8152600401808060200182810382526024815260200180612fd06024913960400191505060405180910390fd5b611d3e82611e3c565b835114611d7c5760405162461bcd60e51b815260040180806020018281038252604d81526020018061305b604d913960600191505060405180910390fd5b8460005b8451811015611e2f578560011660011415611dde57848181518110611da157fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e23565b81858281518110611deb57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d80565b5090951495945050505050565b6000808211611e7c5760405162461bcd60e51b8152600401808060200182810382526030815260200180612ff46030913960400191505060405180910390fd5b8160011415611e8d575060006103b7565b81600060805b60018160ff1610611ed1578060ff1660018260ff166001901b03901b8316600014611ec65760ff811692831c9291909101905b60011c607f16611e93565b506001811b8414611ee0576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f4357fe5b611f56601f8401601f1916602001612f66565b9050828152838383011115611f6a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146103b757600080fd5b600082601f830112611fa8578081fd5b611ee083833560208501611f2f565b8035600281106103b757600080fd5b600060a08284031215611fd7578081fd5b60405160a0810167ffffffffffffffff8282108183111715611ff557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b5061203f85828601611f98565b6080830152505092915050565b60006040828403121561205d578081fd5b6040516040810167ffffffffffffffff828210818311171561207b57fe5b816040528293508435835260209150818501358181111561209b57600080fd5b8501601f810187136120ac57600080fd5b8035828111156120b857fe5b83810292506120c8848401612f66565b8181528481019083860185850187018b10156120e357600080fd5b600095505b838610156121065780358352600195909501949186019186016120e8565b5080868801525050505050505092915050565b600060a0828403121561212a578081fd5b60405160a0810167ffffffffffffffff828210818311171561214857fe5b8160405282935084359150811515821461216157600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b6000806000606084860312156121aa578283fd5b6121b384611f81565b925060208401359150604084013567ffffffffffffffff8111156121d5578182fd5b6121e186828701611f98565b9150509250925092565b6000602082840312156121fc578081fd5b815164ffffffffff1981168114611ee0578182fd5b600060208284031215612222578081fd5b5051919050565b60006020828403121561223a578081fd5b813567ffffffffffffffff811115612250578182fd5b8201601f81018413612260578182fd5b6104de84823560208401611f2f565b60008060008060808587031215612284578081fd5b843567ffffffffffffffff8082111561229b578283fd5b9086019060e082890312156122ae578283fd5b6122b860e0612f66565b82358152602083013560208201526122d260408401611fb7565b60408201526122e360608401611f81565b60608201526122f460808401611f81565b608082015260a083013560a082015260c083013582811115612314578485fd5b6123208a828601611f98565b60c0830152509550602087013591508082111561233b578283fd5b61234788838901612119565b9450604087013591508082111561235c578283fd5b61236888838901611fc6565b9350606087013591508082111561237d578283fd5b5061238a8782880161204c565b91505092959194509250565b6000602082840312156123a7578081fd5b5035919050565b60008151808452815b818110156123d3576020818501810151868301820152016123b7565b818111156123e45782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612440908301846123ae565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061247d908301866123ae565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124ca60a08301846123ae565b979650505050505050565b91825264ffffffffff1916602082015260400190565b918252602082015260400190565b60008582528460208301528360408301526080606083015261244060808301846123ae565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252604d908201527f5175657565207472616e73616374696f6e732063616e6e6f742062652073756260408201527f6d697474656420647572696e67207468652073657175656e63657220696e636c60608201526c3ab9b4b7b7103832b934b7b21760991b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b90815260200190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612f8257fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212207e50b0918881377d2fd55a74570ccb494f88c5b34ae4306e6344457f0356744664736f6c63430007060033", + "devdoc": { + "details": "The Canonical Transaction Chain (CTC) contract is an append-only log of transactions which must be applied to the rollup state. It defines the ordering of rollup transactions by writing them to the 'CTC:batches' instance of the Chain Storage Container. The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer will eventually append it to the rollup state. If the Sequencer does not include an enqueued transaction within the 'force inclusion period', then any account may force it to be included by calling appendQueueBatch(). Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "appendQueueBatch(uint256)": { + "params": { + "_numQueuedTransactions": "Number of transactions to append." + } + }, + "appendSequencerBatch()": { + "details": "This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch contexts. .param _transactionDataFields Array of raw transaction data." + }, + "batches()": { + "returns": { + "_0": "Reference to the batch storage container." + } + }, + "enqueue(address,uint256,bytes)": { + "params": { + "_data": "Transaction data.", + "_gasLimit": "Gas limit for the enqueued L2 transaction.", + "_target": "Target L2 contract to send the transaction to." + } + }, + "getLastBlockNumber()": { + "returns": { + "_0": "Blocknumber for the last transaction." + } + }, + "getLastTimestamp()": { + "returns": { + "_0": "Timestamp for the last transaction." + } + }, + "getNextQueueIndex()": { + "returns": { + "_0": "Index for the next queue element." + } + }, + "getNumPendingQueueElements()": { + "returns": { + "_0": "Number of pending queue elements." + } + }, + "getQueueElement(uint256)": { + "params": { + "_index": "Index of the queue element to access." + }, + "returns": { + "_element": "Queue element at the given index." + } + }, + "getQueueLength()": { + "returns": { + "_0": "Length of the queue." + } + }, + "getTotalBatches()": { + "returns": { + "_totalBatches": "Total submitted batches." + } + }, + "getTotalElements()": { + "returns": { + "_totalElements": "Total submitted elements." + } + }, + "queue()": { + "returns": { + "_0": "Reference to the queue storage container." + } + }, + "verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "params": { + "_batchHeader": "Header of the batch the transaction was included in.", + "_inclusionProof": "Inclusion proof for the provided transaction chain element.", + "_transaction": "Transaction to verify.", + "_txChainElement": "Transaction chain element corresponding to the transaction." + }, + "returns": { + "_0": "True if the transaction exists in the CTC, false if not." + } + } + }, + "title": "OVM_CanonicalTransactionChain", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "appendQueueBatch(uint256)": { + "notice": "Appends a given number of queued transactions as a single batch." + }, + "appendSequencerBatch()": { + "notice": "Allows the sequencer to append a batch of transactions." + }, + "batches()": { + "notice": "Accesses the batch storage container." + }, + "enqueue(address,uint256,bytes)": { + "notice": "Adds a transaction to the queue." + }, + "getLastBlockNumber()": { + "notice": "Returns the blocknumber of the last transaction." + }, + "getLastTimestamp()": { + "notice": "Returns the timestamp of the last transaction." + }, + "getNextQueueIndex()": { + "notice": "Returns the index of the next element to be enqueued." + }, + "getNumPendingQueueElements()": { + "notice": "Get the number of queue elements which have not yet been included." + }, + "getQueueElement(uint256)": { + "notice": "Gets the queue element at a particular index." + }, + "getQueueLength()": { + "notice": "Retrieves the length of the queue, including both pending and canonical transactions." + }, + "getTotalBatches()": { + "notice": "Retrieves the total number of batches submitted." + }, + "getTotalElements()": { + "notice": "Retrieves the total number of elements submitted." + }, + "queue()": { + "notice": "Accesses the queue storage container." + }, + "verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "notice": "Verifies whether a transaction is included in the chain." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 1991, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodSeconds", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 1993, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "forceInclusionPeriodBlocks", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 1995, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_ExecutionManager.json b/deployments/kovan/OVM_ExecutionManager.json new file mode 100644 index 000000000..99b3a02d8 --- /dev/null +++ b/deployments/kovan/OVM_ExecutionManager.json @@ -0,0 +1,1246 @@ +{ + "address": "0x13E0344eB59423F9f34B3f4394aE922b48E86275", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "minTransactionGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTransactionGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxGasPerQueuePerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "secondsPerEpoch", + "type": "uint256" + } + ], + "internalType": "struct iOVM_ExecutionManager.GasMeterConfig", + "name": "_gasMeterConfig", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "ovmCHAINID", + "type": "uint256" + } + ], + "internalType": "struct iOVM_ExecutionManager.GlobalContext", + "name": "_globalContext", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "getMaxTransactionGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "_maxTransactionGasLimit", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ovmADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "_ADDRESS", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "ovmCALL", + "outputs": [ + { + "internalType": "bool", + "name": "_success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_returndata", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ovmCALLER", + "outputs": [ + { + "internalType": "address", + "name": "_CALLER", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ovmCHAINID", + "outputs": [ + { + "internalType": "uint256", + "name": "_CHAINID", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + } + ], + "name": "ovmCREATE", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + } + ], + "name": "ovmCREATE2", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_messageHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "_v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "_r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_s", + "type": "bytes32" + } + ], + "name": "ovmCREATEEOA", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "ovmDELEGATECALL", + "outputs": [ + { + "internalType": "bool", + "name": "_success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_returndata", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_offset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_length", + "type": "uint256" + } + ], + "name": "ovmEXTCODECOPY", + "outputs": [ + { + "internalType": "bytes", + "name": "_code", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "ovmEXTCODEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "_EXTCODEHASH", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "name": "ovmEXTCODESIZE", + "outputs": [ + { + "internalType": "uint256", + "name": "_EXTCODESIZE", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ovmGASLIMIT", + "outputs": [ + { + "internalType": "uint256", + "name": "_GASLIMIT", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ovmGETNONCE", + "outputs": [ + { + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ovmL1QUEUEORIGIN", + "outputs": [ + { + "internalType": "enum Lib_OVMCodec.QueueOrigin", + "name": "_queueOrigin", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ovmL1TXORIGIN", + "outputs": [ + { + "internalType": "address", + "name": "_l1TxOrigin", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ovmNUMBER", + "outputs": [ + { + "internalType": "uint256", + "name": "_NUMBER", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "ovmREVERT", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "name": "ovmSETNONCE", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + } + ], + "name": "ovmSLOAD", + "outputs": [ + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_value", + "type": "bytes32" + } + ], + "name": "ovmSSTORE", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasLimit", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "ovmSTATICCALL", + "outputs": [ + { + "internalType": "bool", + "name": "_success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "_returndata", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ovmTIMESTAMP", + "outputs": [ + { + "internalType": "uint256", + "name": "_TIMESTAMP", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "enum Lib_OVMCodec.QueueOrigin", + "name": "l1QueueOrigin", + "type": "uint8" + }, + { + "internalType": "address", + "name": "l1TxOrigin", + "type": "address" + }, + { + "internalType": "address", + "name": "entrypoint", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.Transaction", + "name": "_transaction", + "type": "tuple" + }, + { + "internalType": "address", + "name": "_ovmStateManager", + "type": "address" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + } + ], + "name": "safeCREATE", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "enum Lib_OVMCodec.QueueOrigin", + "name": "l1QueueOrigin", + "type": "uint8" + }, + { + "internalType": "address", + "name": "l1TxOrigin", + "type": "address" + }, + { + "internalType": "address", + "name": "entrypoint", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.Transaction", + "name": "_transaction", + "type": "tuple" + }, + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "contract iOVM_StateManager", + "name": "_ovmStateManager", + "type": "address" + } + ], + "name": "simulateMessage", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x36af51a4aa6e814bb6a7351d24ae3170f49ab7645f84a06a88a49368369f233b", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x13E0344eB59423F9f34B3f4394aE922b48E86275", + "transactionIndex": 1, + "gasUsed": "3207657", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0bf0d393ae9d4c3934b091dfb23f9336fb00e9a6adfc6a50256c1627ba9c267b", + "transactionHash": "0x36af51a4aa6e814bb6a7351d24ae3170f49ab7645f84a06a88a49368369f233b", + "logs": [], + "blockNumber": 23635977, + "cumulativeGasUsed": "3250822", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + { + "minTransactionGasLimit": 20000, + "maxTransactionGasLimit": 9000000, + "maxGasPerQueuePerEpoch": 9000000, + "secondsPerEpoch": 0 + }, + { + "ovmCHAINID": 10 + } + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"minTransactionGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTransactionGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxGasPerQueuePerEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondsPerEpoch\",\"type\":\"uint256\"}],\"internalType\":\"struct iOVM_ExecutionManager.GasMeterConfig\",\"name\":\"_gasMeterConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"ovmCHAINID\",\"type\":\"uint256\"}],\"internalType\":\"struct iOVM_ExecutionManager.GlobalContext\",\"name\":\"_globalContext\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getMaxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_ADDRESS\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmCALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmCALLER\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_CALLER\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmCHAINID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_CHAINID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"ovmCREATE\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"_v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"_r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_s\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATEEOA\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmDELEGATECALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_length\",\"type\":\"uint256\"}],\"name\":\"ovmEXTCODECOPY\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmEXTCODEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_EXTCODEHASH\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmEXTCODESIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_EXTCODESIZE\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmGASLIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_GASLIMIT\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmGETNONCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmL1QUEUEORIGIN\",\"outputs\":[{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"_queueOrigin\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmL1TXORIGIN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_l1TxOrigin\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmNUMBER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_NUMBER\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ovmREVERT\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"ovmSETNONCE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"}],\"name\":\"ovmSLOAD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"ovmSSTORE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmSTATICCALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmTIMESTAMP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_TIMESTAMP\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"run\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"safeCREATE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"simulateMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed environment allowing us to execute OVM transactions deterministically on either Layer 1 or Layer 2. The EM's run() function is the first function called during the execution of any transaction on L2. For each context-dependent EVM operation the EM has a function which implements a corresponding OVM operation, which will read state from the State Manager contract. The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any context-dependent operations. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"ovmADDRESS()\":{\"returns\":{\"_ADDRESS\":\"Active ADDRESS within the current message context.\"}},\"ovmCALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmCALLER()\":{\"returns\":{\"_CALLER\":\"Address of the CALLER within the current message context.\"}},\"ovmCHAINID()\":{\"returns\":{\"_CHAINID\":\"Value of the chain's CHAINID within the global context.\"}},\"ovmCREATE(bytes)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE a new contract.\"},\"returns\":{\"_contract\":\"Address of the created contract.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_contract\":\"Address of the created contract.\"}},\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\":{\"details\":\"Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks because the contract we're creating is trusted (no need to do safety checking or to handle unexpected reverts). Doesn't need to return an address because the address is assumed to be the user's actual address.\",\"params\":{\"_messageHash\":\"Hash of a message signed by some user, for verification.\",\"_r\":\"Signature `r` parameter.\",\"_s\":\"Signature `s` parameter.\",\"_v\":\"Signature `v` parameter.\"}},\"ovmDELEGATECALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmEXTCODECOPY(address,uint256,uint256)\":{\"params\":{\"_contract\":\"Address of the contract to copy code from.\",\"_length\":\"Total number of bytes to copy from the contract's code.\",\"_offset\":\"Offset in bytes from the start of contract code to copy beyond.\"},\"returns\":{\"_code\":\"Bytes of code copied from the requested contract.\"}},\"ovmEXTCODEHASH(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the hash of.\"},\"returns\":{\"_EXTCODEHASH\":\"Hash of the requested contract.\"}},\"ovmEXTCODESIZE(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the size of.\"},\"returns\":{\"_EXTCODESIZE\":\"Size of the requested contract in bytes.\"}},\"ovmGASLIMIT()\":{\"returns\":{\"_GASLIMIT\":\"Value of the block's GASLIMIT within the transaction context.\"}},\"ovmGETNONCE()\":{\"returns\":{\"_nonce\":\"Nonce of the current contract.\"}},\"ovmL1QUEUEORIGIN()\":{\"returns\":{\"_queueOrigin\":\"Address of the ovmL1QUEUEORIGIN within the current message context.\"}},\"ovmL1TXORIGIN()\":{\"returns\":{\"_l1TxOrigin\":\"Address of the account which sent the tx into L2 from L1.\"}},\"ovmNUMBER()\":{\"returns\":{\"_NUMBER\":\"Value of the NUMBER within the transaction context.\"}},\"ovmREVERT(bytes)\":{\"params\":{\"_data\":\"Bytes data to pass along with the REVERT.\"}},\"ovmSETNONCE(uint256)\":{\"params\":{\"_nonce\":\"New nonce for the current contract.\"}},\"ovmSLOAD(bytes32)\":{\"params\":{\"_key\":\"32 byte key of the storage slot to load.\"},\"returns\":{\"_value\":\"32 byte value of the requested storage slot.\"}},\"ovmSSTORE(bytes32,bytes32)\":{\"params\":{\"_key\":\"32 byte key of the storage slot to set.\",\"_value\":\"32 byte value for the storage slot.\"}},\"ovmSTATICCALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmTIMESTAMP()\":{\"returns\":{\"_TIMESTAMP\":\"Value of the TIMESTAMP within the transaction context.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(address,bytes)\":{\"details\":\"This function is implemented as `public` because we need to be able to revert a contract creation without losing information about exactly *why* the contract reverted. In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS flag and then revert to reset the flag. We're able to do this by making an external call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay information before reverting.\",\"params\":{\"_address\":\"Address of the contract to associate with the one being created.\",\"_bytecode\":\"Code to be used to create the new contract.\"}},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)\":{\"params\":{\"_from\":\"the OVM account the simulated call should be from.\",\"_transaction\":\"the message transaction to simulate.\"}}},\"title\":\"OVM_ExecutionManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ovmADDRESS()\":{\"notice\":\"Overrides ADDRESS.\"},\"ovmCALL(uint256,address,bytes)\":{\"notice\":\"Overrides CALL.\"},\"ovmCALLER()\":{\"notice\":\"Overrides CALLER.\"},\"ovmCHAINID()\":{\"notice\":\"Overrides CHAINID.\"},\"ovmCREATE(bytes)\":{\"notice\":\"Overrides CREATE.\"},\"ovmCREATE2(bytes,bytes32)\":{\"notice\":\"Overrides CREATE2.\"},\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\":{\"notice\":\"Creates a new EOA contract account, for account abstraction.\"},\"ovmDELEGATECALL(uint256,address,bytes)\":{\"notice\":\"Overrides DELEGATECALL.\"},\"ovmEXTCODECOPY(address,uint256,uint256)\":{\"notice\":\"Overrides EXTCODECOPY.\"},\"ovmEXTCODEHASH(address)\":{\"notice\":\"Overrides EXTCODEHASH.\"},\"ovmEXTCODESIZE(address)\":{\"notice\":\"Overrides EXTCODESIZE.\"},\"ovmGASLIMIT()\":{\"notice\":\"Overrides GASLIMIT.\"},\"ovmGETNONCE()\":{\"notice\":\"Retrieves the nonce of the current ovmADDRESS.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which L1 rollup queue this transaction originated from.\"},\"ovmL1TXORIGIN()\":{\"notice\":\"Specifies which L1 account, if any, sent this transaction by calling enqueue().\"},\"ovmNUMBER()\":{\"notice\":\"Overrides NUMBER.\"},\"ovmREVERT(bytes)\":{\"notice\":\"Overrides REVERT.\"},\"ovmSETNONCE(uint256)\":{\"notice\":\"Sets the nonce of the current ovmADDRESS.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(address,bytes)\":{\"notice\":\"Performs the logic to create a contract and revert under various potential conditions.\"},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)\":{\"notice\":\"Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":\"OVM_ExecutionManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_ECDSAContractAccount } from \\\"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\nimport { Lib_SafeMathWrapper } from \\\"../../libraries/wrappers/Lib_SafeMathWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ECDSAContractAccount\\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \\n * providing eth_sign and EIP155 formatted transaction encodings.\\n *\\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\\n\\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Executes a signed transaction.\\n * @param _transaction Signed EOA transaction.\\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\\n\\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\\n // recovered address of the user who signed this message. This is how we manage to shim\\n // account abstraction even though the user isn't a contract.\\n // Need to make sure that the transaction nonce is right and bump it if so.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_ECDSAUtils.recover(\\n _transaction,\\n isEthSign,\\n _v,\\n _r,\\n _s\\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\\n \\\"Signature provided for EOA transaction execution is invalid.\\\"\\n );\\n\\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\\n\\n // Need to make sure that the transaction chainId is correct.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n \\\"Transaction chainId does not match expected OVM chainId.\\\"\\n );\\n\\n // Need to make sure that the transaction nonce is right.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\\n \\\"Transaction nonce does not match the expected nonce.\\\"\\n );\\n\\n // TEMPORARY: Disable gas checks for minnet.\\n // // Need to make sure that the gas is sufficient to execute the transaction.\\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\\n // \\\"Gas is not sufficient to execute the transaction.\\\"\\n // );\\n\\n // Transfer fee to relayer.\\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\\n gasleft(),\\n ETH_ERC20_ADDRESS,\\n abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", relayer, fee)\\n );\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n success == true,\\n \\\"Fee was not transferred to relayer.\\\"\\n );\\n\\n // Contract creations are signalled by sending a transaction to the zero address.\\n if (decodedTx.to == address(0)) {\\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\\n decodedTx.gasLimit,\\n decodedTx.data\\n );\\n\\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\\n // initialization. Always return `true` for our success value here.\\n return (true, abi.encode(created));\\n } else {\\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\\n // cases, but since this is a contract we'd end up bumping the nonce twice.\\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\\n\\n return Lib_SafeExecutionManagerWrapper.safeCALL(\\n decodedTx.gasLimit,\\n decodedTx.to,\\n decodedTx.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9eaaad64d70fb465dd323504f34ba44861dfe738621fce48e8a1e697405e592e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ProxyEOA\\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \\n * 'account abstraction' on layer 2. \\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ProxyEOA {\\n\\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _implementation\\n )\\n public\\n {\\n _setImplementation(_implementation);\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\\n gasleft(),\\n getImplementation(),\\n msg.data\\n );\\n\\n if (success) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n Lib_SafeExecutionManagerWrapper.safeREVERT(\\n string(returndata)\\n );\\n }\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function upgrade(\\n address _implementation\\n )\\n external\\n {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\\n \\\"EOAs can only upgrade their own EOA implementation\\\"\\n );\\n\\n _setImplementation(_implementation);\\n }\\n\\n function getImplementation()\\n public\\n returns (\\n address _implementation\\n )\\n {\\n return address(uint160(uint256(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n IMPLEMENTATION_KEY\\n )\\n )));\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n IMPLEMENTATION_KEY,\\n bytes32(uint256(uint160(_implementation)))\\n );\\n }\\n}\",\"keccak256\":\"0xfbc7e9737d04824f9c1b63fc2151a591c768e3b643d9b3c44405559c3ef19e5e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ECDSAContractAccount } from \\\"../accounts/OVM_ECDSAContractAccount.sol\\\";\\nimport { OVM_ProxyEOA } from \\\"../accounts/OVM_ProxyEOA.sol\\\";\\nimport { OVM_DeployerWhitelist } from \\\"../precompiles/OVM_DeployerWhitelist.sol\\\";\\n\\n/**\\n * @title OVM_ExecutionManager\\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\\n * Layer 2.\\n * The EM's run() function is the first function called during the execution of any\\n * transaction on L2.\\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\\n * OVM operation, which will read state from the State Manager contract.\\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\\n * context-dependent operations.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n iOVM_SafetyChecker internal ovmSafetyChecker;\\n iOVM_StateManager internal ovmStateManager;\\n\\n\\n /*******************************\\n * Execution Context Variables *\\n *******************************/\\n\\n GasMeterConfig internal gasMeterConfig;\\n GlobalContext internal globalContext;\\n TransactionContext internal transactionContext;\\n MessageContext internal messageContext;\\n TransactionRecord internal transactionRecord;\\n MessageRecord internal messageRecord;\\n\\n\\n /**************************\\n * Gas Metering Constants *\\n **************************/\\n\\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n GasMeterConfig memory _gasMeterConfig,\\n GlobalContext memory _globalContext\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\\n * @param _cost Desired gas cost for the function after the refund.\\n */\\n modifier netGasCost(\\n uint256 _cost\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund everything *except* the specified cost.\\n if (_cost < gasUsed) {\\n transactionRecord.ovmGasRefund += gasUsed - _cost;\\n }\\n }\\n\\n /**\\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\\n */\\n modifier fixedGasDiscount(\\n uint256 _discount\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund the specified _discount, unless this risks underflow.\\n if (_discount < gasUsed) {\\n transactionRecord.ovmGasRefund += _discount;\\n } else {\\n // refund all we can without risking underflow.\\n transactionRecord.ovmGasRefund += gasUsed;\\n }\\n }\\n\\n /**\\n * Makes sure we're not inside a static context.\\n */\\n modifier notStatic() {\\n if (messageContext.isStatic == true) {\\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\\n }\\n _;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n /**\\n * Starts the execution of a transaction via the OVM_ExecutionManager.\\n * @param _transaction Transaction data to be executed.\\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\\n */\\n function run(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _ovmStateManager\\n )\\n override\\n public\\n {\\n require(transactionContext.ovmNUMBER == 0, \\\"Only be callable at the start of a transaction\\\");\\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\\n // address around in calldata).\\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\\n\\n // Make sure this function can't be called by anyone except the owner of the\\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\\n // this would make the `run` itself invalid.\\n require(\\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\\n ovmStateManager.isAuthenticated(msg.sender),\\n \\\"Only authenticated addresses in ovmStateManager can call this function\\\"\\n );\\n\\n // Initialize the execution context, must be initialized before we perform any gas metering\\n // or we'll throw a nuisance gas error.\\n _initContext(_transaction);\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Check whether we need to start a new epoch, do so if necessary.\\n // _checkNeedsNewEpoch(_transaction.timestamp);\\n\\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\\n // reverts for INVALID_STATE_ACCESS.\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return;\\n }\\n\\n // Check gas right before the call to get total gas consumed by OVM transaction.\\n uint256 gasProvided = gasleft();\\n\\n // Run the transaction, make sure to meter the gas usage.\\n ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************\\n * Opcodes: Execution Context *\\n ******************************/\\n\\n /**\\n * @notice Overrides CALLER.\\n * @return _CALLER Address of the CALLER within the current message context.\\n */\\n function ovmCALLER()\\n override\\n public\\n view\\n returns (\\n address _CALLER\\n )\\n {\\n return messageContext.ovmCALLER;\\n }\\n\\n /**\\n * @notice Overrides ADDRESS.\\n * @return _ADDRESS Active ADDRESS within the current message context.\\n */\\n function ovmADDRESS()\\n override\\n public\\n view\\n returns (\\n address _ADDRESS\\n )\\n {\\n return messageContext.ovmADDRESS;\\n }\\n\\n /**\\n * @notice Overrides TIMESTAMP.\\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\\n */\\n function ovmTIMESTAMP()\\n override\\n public\\n view\\n returns (\\n uint256 _TIMESTAMP\\n )\\n {\\n return transactionContext.ovmTIMESTAMP;\\n }\\n\\n /**\\n * @notice Overrides NUMBER.\\n * @return _NUMBER Value of the NUMBER within the transaction context.\\n */\\n function ovmNUMBER()\\n override\\n public\\n view\\n returns (\\n uint256 _NUMBER\\n )\\n {\\n return transactionContext.ovmNUMBER;\\n }\\n\\n /**\\n * @notice Overrides GASLIMIT.\\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\\n */\\n function ovmGASLIMIT()\\n override\\n public\\n view\\n returns (\\n uint256 _GASLIMIT\\n )\\n {\\n return transactionContext.ovmGASLIMIT;\\n }\\n\\n /**\\n * @notice Overrides CHAINID.\\n * @return _CHAINID Value of the chain's CHAINID within the global context.\\n */\\n function ovmCHAINID()\\n override\\n public\\n view\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n return globalContext.ovmCHAINID;\\n }\\n\\n /*********************************\\n * Opcodes: L2 Execution Context *\\n *********************************/\\n\\n /**\\n * @notice Specifies from which L1 rollup queue this transaction originated from.\\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n {\\n return transactionContext.ovmL1QUEUEORIGIN;\\n }\\n\\n /**\\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\\n */\\n function ovmL1TXORIGIN()\\n override\\n public\\n view\\n returns (\\n address _l1TxOrigin\\n )\\n {\\n return transactionContext.ovmL1TXORIGIN;\\n }\\n\\n /********************\\n * Opcodes: Halting *\\n ********************/\\n\\n /**\\n * @notice Overrides REVERT.\\n * @param _data Bytes data to pass along with the REVERT.\\n */\\n function ovmREVERT(\\n bytes memory _data\\n )\\n override\\n public\\n {\\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\\n }\\n\\n\\n /******************************\\n * Opcodes: Contract Creation *\\n ******************************/\\n\\n /**\\n * @notice Overrides CREATE.\\n * @param _bytecode Code to be used to CREATE a new contract.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\\n creator,\\n _getAccountNonce(creator)\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n /**\\n * @notice Overrides CREATE2.\\n * @param _bytecode Code to be used to CREATE2 a new contract.\\n * @param _salt Value used to determine the contract's address.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE2 address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\\n creator,\\n _bytecode,\\n _salt\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n /**\\n * Retrieves the nonce of the current ovmADDRESS.\\n * @return _nonce Nonce of the current contract.\\n */\\n function ovmGETNONCE()\\n override\\n public\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Sets the nonce of the current ovmADDRESS.\\n * @param _nonce New nonce for the current contract.\\n */\\n function ovmSETNONCE(\\n uint256 _nonce\\n )\\n override\\n public\\n notStatic\\n {\\n _setAccountNonce(ovmADDRESS(), _nonce);\\n }\\n\\n /**\\n * Creates a new EOA contract account, for account abstraction.\\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\\n * because the contract we're creating is trusted (no need to do safety checking or to\\n * handle unexpected reverts). Doesn't need to return an address because the address is\\n * assumed to be the user's actual address.\\n * @param _messageHash Hash of a message signed by some user, for verification.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n */\\n function ovmCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n notStatic\\n {\\n // Recover the EOA address from the message hash and signature parameters. Since we do the\\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\\n // function were to return the wrong address (rather than explicitly returning the zero\\n // address), the rest of the transaction would simply fail (since there's no EOA account to\\n // actually execute the transaction).\\n address eoa = ecrecover(\\n _messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n\\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\\n // have this function return a `success` boolean, but this is just easier.\\n if (eoa == address(0)) {\\n ovmREVERT(bytes(\\\"Signature provided for EOA contract creation is invalid.\\\"));\\n }\\n\\n // If the user already has an EOA account, then there's no need to perform this operation.\\n if (_hasEmptyAccount(eoa) == false) {\\n return;\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(eoa);\\n\\n // Temporarily set the current address so it's easier to access on L2.\\n address prevADDRESS = messageContext.ovmADDRESS;\\n messageContext.ovmADDRESS = eoa;\\n\\n // Now actually create the account and get its bytecode. We're not worried about reverts\\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\\n\\n // Reset the address now that we're done deploying.\\n messageContext.ovmADDRESS = prevADDRESS;\\n\\n // Commit the account with its final values.\\n _commitPendingAccount(\\n eoa,\\n address(proxyEOA),\\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\\n );\\n\\n _setAccountNonce(eoa, 0);\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Interaction *\\n *********************************/\\n\\n /**\\n * @notice Overrides CALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(100000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // CALL updates the CALLER and ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides STATICCALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmSTATICCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(80000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides DELEGATECALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmDELEGATECALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(40000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // DELEGATECALL does not change anything about the message context.\\n MessageContext memory nextMessageContext = messageContext;\\n bool isStaticEntrypoint = false;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n\\n /************************************\\n * Opcodes: Contract Storage Access *\\n ************************************/\\n\\n /**\\n * @notice Overrides SLOAD.\\n * @param _key 32 byte key of the storage slot to load.\\n * @return _value 32 byte value of the requested storage slot.\\n */\\n function ovmSLOAD(\\n bytes32 _key\\n )\\n override\\n public\\n netGasCost(40000)\\n returns (\\n bytes32 _value\\n )\\n {\\n // We always SLOAD from the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n return _getContractStorage(\\n contractAddress,\\n _key\\n );\\n }\\n\\n /**\\n * @notice Overrides SSTORE.\\n * @param _key 32 byte key of the storage slot to set.\\n * @param _value 32 byte value for the storage slot.\\n */\\n function ovmSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n notStatic\\n netGasCost(60000)\\n {\\n // We always SSTORE to the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n _putContractStorage(\\n contractAddress,\\n _key,\\n _value\\n );\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Code Access *\\n *********************************/\\n\\n /**\\n * @notice Overrides EXTCODECOPY.\\n * @param _contract Address of the contract to copy code from.\\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\\n * @param _length Total number of bytes to copy from the contract's code.\\n * @return _code Bytes of code copied from the requested contract.\\n */\\n function ovmEXTCODECOPY(\\n address _contract,\\n uint256 _offset,\\n uint256 _length\\n )\\n override\\n public\\n returns (\\n bytes memory _code\\n )\\n {\\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\\n // return data. By blocking reads of one byte, we're able to use the condition that an\\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\\n // an error without an explicit revert. If users were able to read a single byte, they\\n // could forcibly trigger behavior that should only be available to this contract.\\n uint256 length = _length == 1 ? 2 : _length;\\n\\n return Lib_EthUtils.getCode(\\n _getAccountEthAddress(_contract),\\n _offset,\\n length\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODESIZE.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function ovmEXTCODESIZE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n return Lib_EthUtils.getCodeSize(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODEHASH.\\n * @param _contract Address of the contract to query the hash of.\\n * @return _EXTCODEHASH Hash of the requested contract.\\n */\\n function ovmEXTCODEHASH(\\n address _contract\\n )\\n override\\n public\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n /**\\n * Performs the logic to create a contract and revert under various potential conditions.\\n * @dev This function is implemented as `public` because we need to be able to revert a\\n * contract creation without losing information about exactly *why* the contract reverted.\\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\\n * flag and then revert to reset the flag. We're able to do this by making an external\\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\\n * information before reverting.\\n * @param _address Address of the contract to associate with the one being created.\\n * @param _bytecode Code to be used to create the new contract.\\n */\\n function safeCREATE(\\n address _address,\\n bytes memory _bytecode\\n )\\n override\\n public\\n {\\n // Since this function is public, anyone can attempt to directly call it. We need to make\\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\\n // call this function.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n\\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\\n // some existing contract. On L1, users will prove that no contract exists at the address\\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\\n // value that represents \\\"known to be an empty account.\\\"\\n if (_hasEmptyAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\\n // complexity because we need to ensure that contract creation *never* reverts by itself.\\n // We cover this partially by storing a revert flag and returning (instead of reverting)\\n // when we know that we're inside a contract's creation code.\\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\\n\\n // Contract creation returns the zero address when it fails, which should only be possible\\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\\n // explicitly handle this case here.\\n if (ethAddress == address(0)) {\\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\\n }\\n\\n // Here we pull out the revert flag that would've been set during creation code. Now that\\n // we're out of creation code again, we can just revert normally while passing the flag\\n // through the revert data.\\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\\n _revertWithFlag(messageRecord.revertFlag);\\n }\\n\\n // Again simply checking that the deployed code is safe too. Contracts can generate\\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\\n // associating the desired address with the newly created contract's code hash and address.\\n _commitPendingAccount(\\n _address,\\n ethAddress,\\n Lib_EthUtils.getCodeHash(ethAddress)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit()\\n external\\n view\\n override\\n returns (\\n uint256 _maxTransactionGasLimit\\n )\\n {\\n return gasMeterConfig.maxTransactionGasLimit;\\n }\\n\\n /********************************************\\n * Public Functions: Deployment Witelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\\n * @param _deployerAddress Address attempting to deploy a contract.\\n */\\n function _checkDeployerAllowed(\\n address _deployerAddress\\n )\\n internal\\n {\\n // From an OVM semanitcs perspectibe, this will appear the identical to\\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\\n (bool success, bytes memory data) = ovmCALL(\\n gasleft(),\\n 0x4200000000000000000000000000000000000002,\\n abi.encodeWithSignature(\\\"isDeployerAllowed(address)\\\", _deployerAddress)\\n );\\n bool isAllowed = abi.decode(data, (bool));\\n\\n if (!isAllowed || !success) {\\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\\n }\\n }\\n\\n /********************************************\\n * Internal Functions: Contract Interaction *\\n ********************************************/\\n\\n /**\\n * Creates a new contract and associates it with some contract address.\\n * @param _contractAddress Address to associate the created contract with.\\n * @param _bytecode Bytecode to be used to create the contract.\\n * @return _created Final OVM contract address.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n // We always update the nonce of the creating account, even if the creation fails.\\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\\n\\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _contractAddress;\\n\\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\\n // `safeCREATE` reverts.\\n (bool _success, ) = _handleExternalInteraction(\\n nextMessageContext,\\n gasleft(),\\n address(this),\\n abi.encodeWithSignature(\\n \\\"safeCREATE(address,bytes)\\\",\\n _contractAddress,\\n _bytecode\\n )\\n );\\n\\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\\n // some parent EVM message.\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return _success ? _contractAddress : address(0);\\n }\\n\\n /**\\n * Calls the deployed contract associated with a given address.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _contract OVM address to be called.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _callContract(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\\n if (\\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\\n ) {\\n return (true, hex'');\\n }\\n\\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalInteraction(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata\\n );\\n }\\n\\n /**\\n * Handles the logic of making an external call and parsing revert information.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _target Address of the contract to call.\\n * @param _data Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _handleExternalInteraction(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _data\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We need to switch over to our next message context for the duration of this call.\\n MessageContext memory prevMessageContext = messageContext;\\n _switchMessageContext(prevMessageContext, _nextMessageContext);\\n\\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\\n // factor.\\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\\n\\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\\n // behavior can be controlled. In particular, we enforce that flags are passed through\\n // revert data as to retrieve execution metadata that would normally be reverted out of\\n // existence.\\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\\n\\n // Switch back to the original message context now that we're out of the call.\\n _switchMessageContext(_nextMessageContext, prevMessageContext);\\n\\n // Assuming there were no reverts, the message record should be accurate here. We'll update\\n // this value in the case of a revert.\\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n\\n // Reverts at this point are completely OK, but we need to make a few updates based on the\\n // information passed through the revert.\\n if (success == false) {\\n (\\n RevertFlag flag,\\n uint256 nuisanceGasLeftPostRevert,\\n uint256 ovmGasRefund,\\n bytes memory returndataFromFlag\\n ) = _decodeRevertData(returndata);\\n\\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\\n // halt any further transaction execution that could impact the execution result.\\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\\n _revertWithFlag(flag);\\n }\\n\\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\\n // is to record the gas refund reported by the call (enforced by safety checking).\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n || flag == RevertFlag.STATIC_VIOLATION\\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\\n ) {\\n transactionRecord.ovmGasRefund = ovmGasRefund;\\n }\\n\\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\\n // flag, *not* the full encoded flag. All other revert types return no data.\\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\\n returndata = returndataFromFlag;\\n } else {\\n returndata = hex'';\\n }\\n\\n // Reverts mean we need to use up whatever \\\"nuisance gas\\\" was used by the call.\\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\\n // to zero. OUT_OF_GAS is a \\\"pseudo\\\" flag given that messages return no data when they\\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\\n // will simply pass up the remaining nuisance gas.\\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\\n }\\n\\n // We need to reset the nuisance gas back to its original value minus the amount used here.\\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\\n\\n return (\\n success,\\n returndata\\n );\\n }\\n\\n\\n /******************************************\\n * Internal Functions: State Manipulation *\\n ******************************************/\\n\\n /**\\n * Checks whether an account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account exists.\\n */\\n function _hasAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasAccount(_address);\\n }\\n\\n /**\\n * Checks whether a known empty account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account empty exists.\\n */\\n function _hasEmptyAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasEmptyAccount(_address);\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function _setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.setAccountNonce(_address, _nonce);\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function _getAccountNonce(\\n address _address\\n )\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountNonce(_address);\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function _getAccountEthAddress(\\n address _address\\n )\\n internal\\n returns (\\n address _ethAddress\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountEthAddress(_address);\\n }\\n\\n /**\\n * Creates the default account object for the given address.\\n * @param _address Address of the account create.\\n */\\n function _initPendingAccount(\\n address _address\\n )\\n internal\\n {\\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\\n // actually consider an account \\\"changed\\\" until it's inserted into the state (in this case\\n // by `_commitPendingAccount`).\\n _checkAccountLoad(_address);\\n ovmStateManager.initPendingAccount(_address);\\n }\\n\\n /**\\n * Stores additional relevant data for a new account, thereby \\\"committing\\\" it to the state.\\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\\n * creation.\\n * @param _address Address of the account to commit.\\n * @param _ethAddress Address of the associated deployed contract.\\n * @param _codeHash Hash of the code stored at the address.\\n */\\n function _commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.commitPendingAccount(\\n _address,\\n _ethAddress,\\n _codeHash\\n );\\n }\\n\\n /**\\n * Retrieves the value of a storage slot.\\n * @param _contract Address of the contract to query.\\n * @param _key 32 byte key of the storage slot.\\n * @return _value 32 byte storage slot value.\\n */\\n function _getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32 _value\\n )\\n {\\n _checkContractStorageLoad(_contract, _key);\\n return ovmStateManager.getContractStorage(_contract, _key);\\n }\\n\\n /**\\n * Sets the value of a storage slot.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte key of the storage slot.\\n * @param _value 32 byte storage slot value.\\n */\\n function _putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n // We don't set storage if the value didn't change. Although this acts as a convenient\\n // optimization, it's also necessary to avoid the case in which a contract with no storage\\n // attempts to store the value \\\"0\\\" at any key. Putting this value (and therefore requiring\\n // that the value be committed into the storage trie after execution) would incorrectly\\n // modify the storage root.\\n if (_getContractStorage(_contract, _key) == _value) {\\n return;\\n }\\n\\n _checkContractStorageChange(_contract, _key);\\n ovmStateManager.putContractStorage(_contract, _key, _value);\\n }\\n\\n /**\\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been loaded before.\\n * @param _address Address of the account to load.\\n */\\n function _checkAccountLoad(\\n address _address\\n )\\n internal\\n {\\n // See `_checkContractStorageLoad` for more information.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // See `_checkContractStorageLoad` for more information.\\n if (ovmStateManager.hasAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the account has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is loaded.\\n (\\n bool _wasAccountAlreadyLoaded\\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyLoaded == false) {\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been changed before.\\n * @param _address Address of the account to change.\\n */\\n function _checkAccountChange(\\n address _address\\n )\\n internal\\n {\\n // Start by checking for a load as we only want to charge nuisance gas proportional to\\n // contract size once.\\n _checkAccountLoad(_address);\\n\\n // Check whether the account has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is changed.\\n (\\n bool _wasAccountAlreadyChanged\\n ) = ovmStateManager.testAndSetAccountChanged(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyChanged == false) {\\n ovmStateManager.incrementTotalUncommittedAccounts();\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been loaded before.\\n * @param _contract Address of the account to load from.\\n * @param _key 32 byte key to load.\\n */\\n function _checkContractStorageLoad(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\\n // on L1 but not on L2. A contract could use this behavior to prevent the\\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\\n // allows us to also charge for the full message nuisance gas, because you deserve that for\\n // trying to break the contract in this way.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // We need to make sure that the transaction isn't trying to access storage that hasn't\\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\\n // We know that we have enough gas to do this check because of the above test.\\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is loaded.\\n (\\n bool _wasContractStorageAlreadyLoaded\\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\\n\\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyLoaded == false) {\\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been changed before.\\n * @param _contract Address of the account to change.\\n * @param _key 32 byte key to change.\\n */\\n function _checkContractStorageChange(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Start by checking for load to make sure we have the storage slot and that we charge the\\n // \\\"nuisance gas\\\" necessary to prove the storage slot state.\\n _checkContractStorageLoad(_contract, _key);\\n\\n // Check whether the slot has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is changed.\\n (\\n bool _wasContractStorageAlreadyChanged\\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\\n\\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyChanged == false) {\\n // Changing a storage slot means that we're also going to have to change the\\n // corresponding account, so do an account change check.\\n _checkAccountChange(_contract);\\n\\n ovmStateManager.incrementTotalUncommittedContractStorage();\\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\\n }\\n }\\n\\n\\n /************************************\\n * Internal Functions: Revert Logic *\\n ************************************/\\n\\n /**\\n * Simple encoding for revert data.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided revert data.\\n * @return _revertdata Encoded revert data.\\n */\\n function _encodeRevertData(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n view\\n returns (\\n bytes memory _revertdata\\n )\\n {\\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\\n if (\\n _flag == RevertFlag.OUT_OF_GAS\\n || _flag == RevertFlag.CREATE_EXCEPTION\\n ) {\\n return bytes('');\\n }\\n\\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\\n return abi.encode(\\n _flag,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // Just ABI encode the rest of the parameters.\\n return abi.encode(\\n _flag,\\n messageRecord.nuisanceGasLeft,\\n transactionRecord.ovmGasRefund,\\n _data\\n );\\n }\\n\\n /**\\n * Simple decoding for revert data.\\n * @param _revertdata Revert data to decode.\\n * @return _flag Flag used to revert.\\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\\n * @return _ovmGasRefund Amount of gas refunded during the message.\\n * @return _data Additional user-provided revert data.\\n */\\n function _decodeRevertData(\\n bytes memory _revertdata\\n )\\n internal\\n pure\\n returns (\\n RevertFlag _flag,\\n uint256 _nuisanceGasLeft,\\n uint256 _ovmGasRefund,\\n bytes memory _data\\n )\\n {\\n // A length of zero means the call ran out of gas, just return empty data.\\n if (_revertdata.length == 0) {\\n return (\\n RevertFlag.OUT_OF_GAS,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // ABI decode the incoming data.\\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided data.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n {\\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\\n // thinking there was a failure.\\n bool isCreation;\\n assembly {\\n isCreation := eq(extcodesize(caller()), 0)\\n }\\n\\n if (isCreation) {\\n messageRecord.revertFlag = _flag;\\n\\n assembly {\\n return(0, 1)\\n }\\n }\\n\\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\\n // revert normally.\\n bytes memory revertdata = _encodeRevertData(\\n _flag,\\n _data\\n );\\n\\n assembly {\\n revert(add(revertdata, 0x20), mload(revertdata))\\n }\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag\\n )\\n internal\\n {\\n _revertWithFlag(_flag, bytes(''));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Nuisance Gas Logic *\\n ******************************************/\\n\\n /**\\n * Computes the nuisance gas limit from the gas limit.\\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\\n * this implementation is perfectly fine, but we may change this formula later.\\n * @param _gasLimit Gas limit to compute from.\\n * @return _nuisanceGasLimit Computed nuisance gas limit.\\n */\\n function _getNuisanceGasLimit(\\n uint256 _gasLimit\\n )\\n internal\\n view\\n returns (\\n uint256 _nuisanceGasLimit\\n )\\n {\\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\\n }\\n\\n /**\\n * Uses a certain amount of nuisance gas.\\n * @param _amount Amount of nuisance gas to use.\\n */\\n function _useNuisanceGas(\\n uint256 _amount\\n )\\n internal\\n {\\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\\n // refund to be given at the end of the transaction.\\n if (messageRecord.nuisanceGasLeft < _amount) {\\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\\n }\\n\\n messageRecord.nuisanceGasLeft -= _amount;\\n }\\n\\n\\n /************************************\\n * Internal Functions: Gas Metering *\\n ************************************/\\n\\n /**\\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\\n * @param _timestamp Transaction timestamp.\\n */\\n function _checkNeedsNewEpoch(\\n uint256 _timestamp\\n )\\n internal\\n {\\n if (\\n _timestamp >= (\\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\\n + gasMeterConfig.secondsPerEpoch\\n )\\n ) {\\n _putGasMetadata(\\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\\n _timestamp\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\\n )\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\\n )\\n );\\n }\\n }\\n\\n /**\\n * Validates the gas limit for a given transaction.\\n * @param _gasLimit Gas limit provided by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n * @return _valid Whether or not the gas limit is valid.\\n */\\n function _isValidGasLimit(\\n uint256 _gasLimit,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n returns (\\n bool _valid\\n )\\n {\\n // Always have to be below the maximum gas limit.\\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\\n return false;\\n }\\n\\n // Always have to be above the minimum gas limit.\\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\\n return false;\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n return true;\\n // GasMetadataKey cumulativeGasKey;\\n // GasMetadataKey prevEpochGasKey;\\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\\n // } else {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\\n // }\\n\\n // return (\\n // (\\n // _getGasMetadata(cumulativeGasKey)\\n // - _getGasMetadata(prevEpochGasKey)\\n // + _gasLimit\\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\\n // );\\n }\\n\\n /**\\n * Updates the cumulative gas after a transaction.\\n * @param _gasUsed Gas used by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n */\\n function _updateCumulativeGas(\\n uint256 _gasUsed,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n {\\n GasMetadataKey cumulativeGasKey;\\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n } else {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n }\\n\\n _putGasMetadata(\\n cumulativeGasKey,\\n (\\n _getGasMetadata(cumulativeGasKey)\\n + gasMeterConfig.minTransactionGasLimit\\n + _gasUsed\\n - transactionRecord.ovmGasRefund\\n )\\n );\\n }\\n\\n /**\\n * Retrieves the value of a gas metadata key.\\n * @param _key Gas metadata key to retrieve.\\n * @return _value Value stored at the given key.\\n */\\n function _getGasMetadata(\\n GasMetadataKey _key\\n )\\n internal\\n returns (\\n uint256 _value\\n )\\n {\\n return uint256(_getContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key))\\n ));\\n }\\n\\n /**\\n * Sets the value of a gas metadata key.\\n * @param _key Gas metadata key to set.\\n * @param _value Value to store at the given key.\\n */\\n function _putGasMetadata(\\n GasMetadataKey _key,\\n uint256 _value\\n )\\n internal\\n {\\n _putContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key)),\\n bytes32(uint256(_value))\\n );\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Execution Context *\\n *****************************************/\\n\\n /**\\n * Swaps over to a new message context.\\n * @param _prevMessageContext Context we're switching from.\\n * @param _nextMessageContext Context we're switching to.\\n */\\n function _switchMessageContext(\\n MessageContext memory _prevMessageContext,\\n MessageContext memory _nextMessageContext\\n )\\n internal\\n {\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n }\\n\\n /**\\n * Initializes the execution context.\\n * @param _transaction OVM transaction being executed.\\n */\\n function _initContext(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n internal\\n {\\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\\n transactionContext.ovmNUMBER = _transaction.blockNumber;\\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\\n\\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\\n }\\n\\n /**\\n * Resets the transaction and message context.\\n */\\n function _resetContext()\\n internal\\n {\\n transactionContext.ovmL1TXORIGIN = address(0);\\n transactionContext.ovmTIMESTAMP = 0;\\n transactionContext.ovmNUMBER = 0;\\n transactionContext.ovmGASLIMIT = 0;\\n transactionContext.ovmTXGASLIMIT = 0;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = 0;\\n\\n messageContext.ovmCALLER = address(0);\\n messageContext.ovmADDRESS = address(0);\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = 0;\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n }\\n\\n /*****************************\\n * L2-only Helper Functions *\\n *****************************/\\n\\n /**\\n * Unreachable helper function for simulating eth_calls with an OVM message context.\\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\\n * @param _transaction the message transaction to simulate.\\n * @param _from the OVM account the simulated call should be from.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n // Prevent this call from having any effect unless in a custom-set VM frame\\n require(msg.sender == address(0));\\n\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n\\n messageRecord.nuisanceGasLeft = uint(-1);\\n messageContext.ovmADDRESS = _transaction.entrypoint;\\n messageContext.ovmCALLER = _from;\\n\\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\\n }\\n}\\n\",\"keccak256\":\"0x5432ac3e92c78d3bc9faf52e4081cd95b4b6d7858ce14636822f1b2c41cfcc43\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_DeployerWhitelist\\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \\n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n \\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n address owner = Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\\n \\\"Function can only be called by the owner of this contract.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n \\n /**\\n * Initializes the whitelist.\\n * @param _owner Address of the owner for this contract.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function initialize(\\n address _owner,\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == true) {\\n return;\\n }\\n\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_INITIALIZED,\\n Lib_Bytes32Utils.fromBool(true)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Gets the owner of the whitelist.\\n */\\n function getOwner()\\n override\\n public\\n returns(\\n address\\n )\\n {\\n return Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n }\\n\\n /**\\n * Adds or removes an address from the deployment whitelist.\\n * @param _deployer Address to update permissions for.\\n * @param _isWhitelisted Whether or not the address is whitelisted.\\n */\\n function setWhitelistedDeployer(\\n address _deployer,\\n bool _isWhitelisted\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n Lib_Bytes32Utils.fromAddress(_deployer),\\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\\n );\\n }\\n\\n /**\\n * Updates the owner of this contract.\\n * @param _owner Address of the new owner.\\n */\\n function setOwner(\\n address _owner\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n }\\n\\n /**\\n * Updates the arbitrary deployment flag.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function setAllowArbitraryDeployment(\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n public\\n onlyOwner\\n {\\n setAllowArbitraryDeployment(true);\\n setOwner(address(0));\\n }\\n\\n /**\\n * Checks whether an address is allowed to deploy contracts.\\n * @param _deployer Address to check.\\n * @return _allowed Whether or not the address can deploy contracts.\\n */\\n function isDeployerAllowed(\\n address _deployer\\n )\\n override\\n public\\n returns (\\n bool _allowed\\n )\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == false) {\\n return true;\\n }\\n\\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\\n );\\n\\n if (allowArbitraryDeployment == true) {\\n return true;\\n }\\n\\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n Lib_Bytes32Utils.fromAddress(_deployer)\\n )\\n );\\n\\n return isWhitelisted; \\n }\\n}\\n\",\"keccak256\":\"0x8737cfb9c47bf262eb16b80ca9111e0b347b1fe06c517569907056b8e2f28aaf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_ECDSAContractAccount\\n */\\ninterface iOVM_ECDSAContractAccount {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external returns (bool _success, bytes memory _returndata);\\n}\\n\",\"keccak256\":\"0x308729bc62dcffb11ff1d840781105cf1bf0dd4cbcfb1af704b800bb0cfe9b85\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_DeployerWhitelist\\n */\\ninterface iOVM_DeployerWhitelist {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\\n function getOwner() external returns (address _owner);\\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\\n function setOwner(address _newOwner) external;\\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\\n function enableArbitraryContractDeployment() external;\\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\\n}\\n\",\"keccak256\":\"0x969394371cacfc36493230150b6d629173ea72dfdf729330bede475b91d0f004\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_ECDSAUtils\\n */\\nlibrary Lib_ECDSAUtils {\\n\\n /**************************************\\n * Internal Functions: ECDSA Recovery *\\n **************************************/\\n\\n /**\\n * Recovers a signed address given a message and signature.\\n * @param _message Message that was originally signed.\\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _sender Signer address.\\n */\\n function recover(\\n bytes memory _message,\\n bool _isEthSignedMessage,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n pure\\n returns (\\n address _sender\\n )\\n {\\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\\n\\n return ecrecover(\\n messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n }\\n\\n function getMessageHash(\\n bytes memory _message,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (bytes32) {\\n if (_isEthSignedMessage) {\\n return getEthSignedMessageHash(_message);\\n }\\n return getNativeMessageHash(_message);\\n }\\n\\n\\n /*************************************\\n * Private Functions: ECDSA Recovery *\\n *************************************/\\n\\n /**\\n * Gets the native message hash (simple keccak256) for a message.\\n * @param _message Message to hash.\\n * @return _messageHash Native message hash.\\n */\\n function getNativeMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n return keccak256(_message);\\n }\\n\\n /**\\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\\n * @param _message Message to hash.\\n * @return _messageHash Prefixed message hash.\\n */\\n function getEthSignedMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n bytes memory prefix = \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\";\\n bytes32 messageHash = keccak256(_message);\\n return keccak256(abi.encodePacked(prefix, messageHash));\\n }\\n}\",\"keccak256\":\"0xda865d8cc014940a4755e329db9c6272a31bd9a340000a4ecc005d46299a585c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\\n// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"./Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_SafeMathWrapper\\n */\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\n\\nlibrary Lib_SafeMathWrapper {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal returns (uint256) {\\n uint256 c = a + b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \\\"Lib_SafeMathWrapper: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal returns (uint256) {\\n return sub(a, b, \\\"Lib_SafeMathWrapper: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \\\"Lib_SafeMathWrapper: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal returns (uint256) {\\n return div(a, b, \\\"Lib_SafeMathWrapper: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal returns (uint256) {\\n return mod(a, b, \\\"Lib_SafeMathWrapper: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0xc58aa064894677f65fc8205f79252d15e59a0f5e2794e5c2d069c7b2bc97a9e2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620039ae380380620039ae8339810160408190526200003491620001e9565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000cb565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560609091015160065551600755506200028e565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200012d57818101518382015260200162000113565b50505050905090810190601f1680156200015b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200017957600080fd5b505afa1580156200018e573d6000803e3d6000fd5b505050506040513d6020811015620001a557600080fd5b505192915050565b600060208284031215620001bf578081fd5b604051602081016001600160401b0381118282101715620001dc57fe5b6040529151825250919050565b600080600083850360c0811215620001ff578384fd5b84516001600160a01b038116811462000216578485fd5b93506080601f19820112156200022a578283fd5b50604051608081016001600160401b03811182821017156200024857fe5b80604052506020850151815260408501516020820152606085015160408201526080850151606082015280925050620002858560a08601620001ad565b90509250925092565b613710806200029e6000396000f3fe60806040523480156200001157600080fd5b5060043610620001d25760003560e01c8063741a33eb1162000111578063996d79a511620000a55780639dc9dc93116200007b5780639dc9dc9314620003e4578063bdbf8c3614620003ee578063c1fb2ea214620003f8578063ffe73914146200040257620001d2565b8063996d79a514620003ac57806399ccd98b14620003b65780639be3ad6714620003cd57620001d2565b80638540661f11620000e75780638540661f146200034d57806385979f7614620003745780638bb42e15146200038b5780639058025614620003a257620001d2565b8063741a33eb14620002f9578063746c32f114620003105780638435035b146200033657620001d2565b806322bd64c01162000189578063461a4478116200015f578063461a447814620002b75780634d78009214620002ce5780635a98c36114620002e55780637350906414620002ef57620001d2565b806322bd64c0146200027257806324749d5c14620002895780632a2a7adb14620002a057620001d2565b806303daa95914620001d75780630da449d11462000206578063101185a4146200021f57806314aa2ff714620002385780631c4712a7146200025e57806320160f3a1462000268575b600080fd5b620001ee620001e8366004620027ac565b62000419565b604051620001fd919062002b83565b60405180910390f35b6200021d62000217366004620027ac565b62000463565b005b62000229620004a0565b604051620001fd919062002c74565b6200024f6200024936600462002843565b620004a9565b604051620001fd919062002b8c565b620001ee6200054a565b620001ee62000550565b6200021d62000283366004620027de565b62000556565b620001ee6200029a366004620026c2565b620005c1565b6200021d620002b136600462002843565b620005e0565b6200024f620002c83660046200296e565b620005ed565b6200021d620002df36600462002700565b620006cf565b620001ee620008b3565b6200024f620008b9565b6200021d6200030a36600462002800565b620008c8565b620003276200032136600462002753565b62000a52565b604051620001fd919062002c5f565b620001ee62000347366004620026c2565b62000a8b565b620003646200035e36600462002a76565b62000aa2565b604051620001fd92919062002c24565b620003646200038536600462002a76565b62000b1f565b620003646200039c36600462002a0d565b62000b70565b620001ee62000c4e565b6200024f62000c54565b6200024f620003c736600462002881565b62000c63565b6200021d620003de366004620029b8565b62000cfd565b6200024f62000e5b565b620001ee62000e6a565b620001ee62000e70565b620003646200041336600462002a76565b62000e8b565b6000619c4060005a905060006200042f62000c54565b90506200043d818662000f04565b93505060005a82039050808310156200045b57601080548483030190555b505050919050565b600f5460ff600160a01b90910416151560011415620004885762000488600762000fa3565b6200049d6200049662000c54565b8262000fbe565b50565b60085460ff1690565b600f5460009060ff600160a01b90910416151560011415620004d157620004d1600762000fa3565b619c4060005a90506000620004e562000c54565b9050620004f28162001035565b60006200050a826200050484620010c4565b62001157565b9050620005188187620011f3565b9450505060005a82039050808310156200053a5760108054840190556200045b565b6010805482019055505050919050565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156200057b576200057b600762000fa3565b61ea6060005a905060006200058f62000c54565b90506200059e818686620012c1565b5060005a8203905080831015620005ba57601080548483030190555b5050505050565b6000620005d8620005d28362001352565b620013e5565b90505b919050565b6200049d600282620013e9565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200064f57818101518382015260200162000635565b50505050905090810190601f1680156200067d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200069b57600080fd5b505afa158015620006b0573d6000803e3d6000fd5b505050506040513d6020811015620006c757600080fd5b505192915050565b333014620006dd57620008af565b620006e88262001430565b620006f957620006f9600662000fa3565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a906200072b90849060040162002c5f565b60206040518083038186803b1580156200074457600080fd5b505afa15801562000759573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077f91906200278a565b620007905762000790600562000fa3565b6200079b82620014c3565b6000620007a88262001530565b90506001600160a01b038116620007c557620007c5600862000fa3565b600060125460ff166009811115620007d957fe5b14620007f057601254620007f09060ff1662000fa3565b6000620007fd8262001541565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a906200083090849060040162002c5f565b60206040518083038186803b1580156200084957600080fd5b505afa1580156200085e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200088491906200278a565b620008955762000895600562000fa3565b620008ac8483620008a685620013e5565b6200155b565b50505b5050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415620008ed57620008ed600762000fa3565b600060018585601b0185856040516000815260200160405260405162000917949392919062002c41565b6020604051602081039080840390855afa1580156200093a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166200097a576200097a604051806060016040528060388152602001620036a360389139620005e0565b620009858162001430565b620009915750620008ac565b6200099c81620014c3565b600f80546001600160a01b038381166001600160a01b03198316179092556040519116906000906003602160991b0190620009d7906200258d565b620009e3919062002b8c565b604051809103906000f08015801562000a00573d6000803e3d6000fd5b50600f80546001600160a01b0319166001600160a01b038516179055905062000a3c838262000a2f8162001541565b805190602001206200155b565b62000a4983600062000fbe565b50505050505050565b606060008260011462000a66578262000a69565b60025b905062000a8262000a7a8662001352565b85836200159c565b95945050505050565b6000620005d862000a9c8362001352565b620015be565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915062000ae881898989620015c2565b945094505060005a820390508083101562000b0b57601080548401905562000b14565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915062000ae881898989620015c2565b60006060331562000b8057600080fd5b600280546001600160a01b0319166001600160a01b03851617905562000ba68562001659565b6000196011556080850151600f80546001600160a01b039283166001600160a01b03199182168117909255600e8054938816939091169290921790915560a086015160c087015160405162000bfc919062002b65565b60006040518083038160008787f1925050503d806000811462000c3c576040519150601f19603f3d011682016040523d82523d6000602084013e62000c41565b606091505b5091509150935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060ff600160a01b9091041615156001141562000c8b5762000c8b600762000fa3565b619c4060005a9050600062000c9f62000c54565b905062000cac8162001035565b600062000cbb828888620016ce565b905062000cc98188620011f3565b9450505060005a820390508083101562000ceb57601080548401905562000cf4565b60108054820190555b50505092915050565b600a541562000d295760405162461bcd60e51b815260040162000d209062002d65565b60405180910390fd5b600280546001600160a01b0319166001600160a01b038381169190911791829055604051630d15d41560e41b815291169063d15d41509062000d7090339060040162002b8c565b60206040518083038186803b15801562000d8957600080fd5b505afa15801562000d9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000dc491906200278a565b62000de35760405162461bcd60e51b815260040162000d209062002cf9565b62000dee8262001659565b62000e028260a00151836040015162001718565b62000e0d57620008af565b60005a905062000e326003600001548460a001510384608001518560c0015162000b1f565b505060005a8203905062000e456200174c565b5050600280546001600160a01b03191690555050565b600d546001600160a01b031690565b60095490565b600062000e8662000e8062000c54565b620010c4565b905090565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff16151591810191909152909150600062000ee0828a8a8a620015c2565b95509550505060005a820390508083101562000b0b57601080548401905562000b14565b600062000f128383620017af565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f9062000f46908690869060040162002bc4565b60206040518083038186803b15801562000f5f57600080fd5b505afa15801562000f74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9a9190620027c5565b90505b92915050565b6200049d8160405180602001604052806000815250620013e9565b62000fc982620018ff565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb869062000ffd908590859060040162002bc4565b600060405180830381600087803b1580156200101857600080fd5b505af11580156200102d573d6000803e3d6000fd5b505050505050565b600080620010885a6002602160991b018560405160240162001058919062002b8c565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905262000b1f565b91509150600081806020019051810190620010a491906200278a565b9050801580620010b2575082155b15620008ac57620008ac600962000fa3565b6000620010d18262001a25565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f906200110390859060040162002b8c565b60206040518083038186803b1580156200111c57600080fd5b505afa15801562001131573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620027c5565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908162001172579050509050620011958462001b7c565b81600081518110620011a357fe5b6020026020010181905250620011b98362001baa565b81600181518110620011c757fe5b60200260200101819052506000620011df8262001bc1565b905062000a82818051906020012062001bf2565b60006200121a6200120362000c54565b6200121162000e8062000c54565b60010162000fbe565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908416602082015260006200129d825a3088886040516024016200126d92919062002bfe565b60408051601f198184030181529190526020810180516001600160e01b03166326bc004960e11b17905262001bf5565b506012805460ff19169055905080620012b857600062000a82565b50929392505050565b80620012ce848462000f04565b1415620012db576200134d565b620012e7838362001dc7565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906200131d9086908690869060040162002bdd565b600060405180830381600087803b1580156200133857600080fd5b505af115801562000a49573d6000803e3d6000fd5b505050565b60006200135f8262001a25565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906200139190859060040162002b8c565b60206040518083038186803b158015620013aa57600080fd5b505afa158015620013bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620026e1565b3f90565b333b15801562001418576012805484919060ff191660018360098111156200140d57fe5b021790555060016000f35b600062001426848462001ee8565b9050805160208201fd5b60006200143d8262001a25565b6002546040516307a1294560e01b81526001600160a01b03909116906307a12945906200146f90859060040162002b8c565b60206040518083038186803b1580156200148857600080fd5b505afa1580156200149d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d891906200278a565b620014ce8162001a25565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906200150090849060040162002b8c565b600060405180830381600087803b1580156200151b57600080fd5b505af1158015620005ba573d6000803e3d6000fd5b60008151602083016000f092915050565b6060620005d88260006200155585620015be565b6200159c565b6200156683620018ff565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906200131d9086908690869060040162002ba0565b60606040519050602082018101604052818152818360208301863c9392505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156200161357505060408051602081019091526000815260019062001650565b60006064856001600160a01b0316106200163857620016328562001352565b6200163a565b845b90506200164a8787838762001bf5565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156200168957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a0810151620016c89062001fb3565b60115550565b60008060ff60f81b85848680519060200120604051602001620016f5949392919062002b2c565b60405160208183030381529060405280519060200120905062000a828162001bf2565b6004546000908311156200172f5750600062000f9d565b600354831015620017435750600062000f9d565b50600192915050565b600d80546001600160a01b031990811690915560006009819055600a819055600b819055600c8190556008805460ff199081169091556010829055600e8054909316909255600f80546001600160a81b0319169055601155601280549091169055565b6175305a1015620017c657620017c6600162000fa3565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad2267990620017fa908590859060040162002bc4565b60206040518083038186803b1580156200181357600080fd5b505afa15801562001828573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200184e91906200278a565b6200185f576200185f600462000fa3565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649062001894908690869060040162002bc4565b602060405180830381600087803b158015620018af57600080fd5b505af1158015620018c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018ea91906200278a565b9050806200134d576200134d614e2062001fc8565b6200190a8162001a25565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f790906200193d90859060040162002b8c565b602060405180830381600087803b1580156200195857600080fd5b505af11580156200196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200199391906200278a565b905080620008af57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620019ec57600080fd5b505af115801562001a01573d6000803e3d6000fd5b50505050620008af617530606462001a1d62000a9c8662001352565b020162001fc8565b6175305a101562001a3c5762001a3c600162000fa3565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf9062001a6e90849060040162002b8c565b60206040518083038186803b15801562001a8757600080fd5b505afa15801562001a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac291906200278a565b62001ad35762001ad3600462000fa3565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c9062001b0690859060040162002b8c565b602060405180830381600087803b15801562001b2157600080fd5b505af115801562001b36573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b5c91906200278a565b905080620008af57620008af617530606462001a1d62000a9c8662001352565b6060620005d88260405160200162001b95919062002b0f565b60405160208183030381529060405262001feb565b6060620005d862001bbb836200203c565b62001feb565b6060600062001bd0836200214d565b905062001beb62001be4825160c06200225a565b82620023b7565b9392505050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff161515928201929092526000919062001c3e818862002438565b601154600062001c4e8862001fb3565b905080601160000181905550600080886001600160a01b03168a8960405162001c78919062002b65565b60006040518083038160008787f1925050503d806000811462001cb8576040519150601f19603f3d011682016040523d82523d6000602084013e62001cbd565b606091505b509150915062001cce8b8662002438565b6011548262001db05760008060008062001ce886620024ef565b92965090945092509050600484600981111562001d0157fe5b141562001d135762001d138462000fa3565b600284600981111562001d2257fe5b148062001d3b5750600584600981111562001d3957fe5b145b8062001d535750600784600981111562001d5157fe5b145b8062001d6b5750600984600981111562001d6957fe5b145b1562001d775760108290555b600284600981111562001d8657fe5b141562001d965780955062001da9565b6040518060200160405280600081525095505b5090925050505b909203909203601155909890975095505050505050565b62001dd38282620017af565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc0119062001e08908690869060040162002bc4565b602060405180830381600087803b15801562001e2357600080fd5b505af115801562001e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001e5e91906200278a565b9050806200134d5762001e7183620018ff565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b15801562001ec257600080fd5b505af115801562001ed7573d6000803e3d6000fd5b505050506200134d614e2062001fc8565b6060600183600981111562001ef957fe5b148062001f125750600883600981111562001f1057fe5b145b1562001f2e575060408051602081019091526000815262000f9d565b600483600981111562001f3d57fe5b141562001f7f5760408051602080820183526000808352925162001f68938793909283920162002c89565b604051602081830303815290604052905062000f9d565b60115460105460405162001f9c9286929091869060200162002cc9565b604051602081830303815290604052905092915050565b60005a821062001fc4575a620005d8565b5090565b60115481111562001fdf5762001fdf600362000fa3565b60118054919091039055565b606080825160011480156200201557506080836000815181106200200b57fe5b016020015160f81c105b1562002023575081620005d8565b62000f9a62002035845160806200225a565b84620023b7565b606060008260405160200162002053919062002b83565b604051602081830303815290604052905060005b6020811015620020a2578181815181106200207e57fe5b01602001516001600160f81b031916156200209957620020a2565b60010162002067565b6000816020036001600160401b0381118015620020be57600080fd5b506040519080825280601f01601f191660200182016040528015620020ea576020820181803683370190505b50905060005b8151811015620021445783516001840193859181106200210c57fe5b602001015160f81c60f81b8282815181106200212457fe5b60200101906001600160f81b031916908160001a905350600101620020f0565b50949350505050565b6060815160001415620021705750604080516000815260208101909152620005db565b6000805b8351811015620021a6578381815181106200218b57fe5b60200260200101515182019150808060010191505062002174565b6000826001600160401b0381118015620021bf57600080fd5b506040519080825280601f01601f191660200182016040528015620021eb576020820181803683370190505b50600092509050602081015b8551831015620021445760008684815181106200221057fe5b602002602001015190506000602082019050620022308382845162002547565b8785815181106200223d57fe5b6020026020010151518301925050508280600101935050620021f7565b6060806038841015620022b7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106200229a57fe5b60200101906001600160f81b031916908160001a90535062000f9a565b600060015b808681620022c657fe5b0415620022dd5760019091019061010002620022bc565b816001016001600160401b0381118015620022f757600080fd5b506040519080825280601f01601f19166020018201604052801562002323576020820181803683370190505b50925084820160370160f81b836000815181106200233d57fe5b60200101906001600160f81b031916908160001a905350600190505b818111620023ae576101008183036101000a87816200237457fe5b04816200237d57fe5b0660f81b8382815181106200238e57fe5b60200101906001600160f81b031916908160001a90535060010162002359565b50509392505050565b6060806040519050835180825260208201818101602087015b81831015620023ea578051835260209283019201620023d0565b50855184518101855292509050808201602086015b8183101562002419578051835260209283019201620023ff565b508651929092011591909101601f01601f191660405250905092915050565b805182516001600160a01b0390811691161462002471578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614620024b8576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b806040015115158260400151151514620008af5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156200252157505060408051602081019091526000808252600193509150819062002540565b84806020019051810190620025379190620028c7565b93509350935093505b9193509193565b8282825b602081106200256c578151835260209283019290910190601f19016200254b565b905182516020929092036101000a6000190180199091169116179052505050565b6108648062002e3f83390190565b6000620025b2620025ac8462002dd7565b62002db3565b9050828152838383011115620025c757600080fd5b828260208301376000602084830101529392505050565b8035620005db8162002e28565b600082601f830112620025fc578081fd5b62000f9a838335602085016200259b565b803560028110620005db57600080fd5b600060e082840312156200262f578081fd5b6200263b60e062002db3565b9050813581526020820135602082015262002659604083016200260d565b60408201526200266c60608301620025de565b60608201526200267f60808301620025de565b608082015260a082013560a082015260c08201356001600160401b03811115620026a857600080fd5b620026b684828501620025eb565b60c08301525092915050565b600060208284031215620026d4578081fd5b813562000f9a8162002e28565b600060208284031215620026f3578081fd5b815162000f9a8162002e28565b6000806040838503121562002713578081fd5b8235620027208162002e28565b915060208301356001600160401b038111156200273b578182fd5b6200274985828601620025eb565b9150509250929050565b60008060006060848603121562002768578081fd5b8335620027758162002e28565b95602085013595506040909401359392505050565b6000602082840312156200279c578081fd5b8151801515811462000f9a578182fd5b600060208284031215620027be578081fd5b5035919050565b600060208284031215620027d7578081fd5b5051919050565b60008060408385031215620027f1578182fd5b50508035926020909101359150565b6000806000806080858703121562002816578182fd5b84359350602085013560ff811681146200282e578283fd5b93969395505050506040820135916060013590565b60006020828403121562002855578081fd5b81356001600160401b038111156200286b578182fd5b6200287984828501620025eb565b949350505050565b6000806040838503121562002894578182fd5b82356001600160401b03811115620028aa578283fd5b620028b885828601620025eb565b95602094909401359450505050565b60008060008060808587031215620028dd578182fd5b8451600a8110620028ec578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111562002917578182fd5b8501601f8101871362002928578182fd5b805162002939620025ac8262002dd7565b8181528860208385010111156200294e578384fd5b6200296182602083016020860162002df9565b9598949750929550505050565b60006020828403121562002980578081fd5b81356001600160401b0381111562002996578182fd5b8201601f81018413620029a7578182fd5b62002879848235602084016200259b565b60008060408385031215620029cb578182fd5b82356001600160401b03811115620029e1578283fd5b620029ef858286016200261d565b925050602083013562002a028162002e28565b809150509250929050565b60008060006060848603121562002a22578081fd5b83356001600160401b0381111562002a38578182fd5b62002a46868287016200261d565b935050602084013562002a598162002e28565b9150604084013562002a6b8162002e28565b809150509250925092565b60008060006060848603121562002a8b578081fd5b83359250602084013562002a9f8162002e28565b915060408401356001600160401b0381111562002aba578182fd5b62002ac886828701620025eb565b9150509250925092565b6000815180845262002aec81602086016020860162002df9565b601f01601f19169290920160200192915050565b600a811062002b0b57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825162002b7981846020870162002df9565b9190910192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0383168152604060208201819052600090620028799083018462002ad2565b600083151582526040602083015262002879604083018462002ad2565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000f9a602083018462002ad2565b602081016002831062002c8357fe5b91905290565b600062002c97828762002b00565b60ff8516602083015260ff841660408301526080606083015262002cbf608083018462002ad2565b9695505050505050565b600062002cd7828762002b00565b8460208301528360408301526080606083015262002cbf608083018462002ad2565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6020808252602e908201527f4f6e6c792062652063616c6c61626c6520617420746865207374617274206f6660408201526d1030903a3930b739b0b1ba34b7b760911b606082015260800190565b6040518181016001600160401b038111828210171562002dcf57fe5b604052919050565b60006001600160401b0382111562002deb57fe5b50601f01601f191660200190565b60005b8381101562002e1657818101518382015260200162002dfc565b83811115620008ac5750506000910152565b6001600160a01b03811681146200049d57600080fdfe608060405234801561001057600080fd5b506040516108643803806108648339818101604052602081101561003357600080fd5b505161003e81610044565b506101c7565b6100877fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead60001b826001600160a01b031660001b61008a60201b6103ba1760201c565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b03908116628af59360e61b179091526100d691906100db16565b505050565b60606100e75a836100ed565b92915050565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106101325780518252601f199092019160209182019101610113565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d8060008114610195576040519150601f19603f3d011682016040523d82523d6000602084013e61019a565b606091505b509092509050816101ad57805160208201fd5b8051600114156101bd5760016000f35b92506100e7915050565b61068e806101d66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630900f010146100a1578063aaf10f42146100c9575b6000806100825a6100456100ed565b6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061011d92505050565b91509150811561009457805160208201f35b61009d816102c0565b5050005b6100c7600480360360208110156100b757600080fd5b50356001600160a01b031661036a565b005b6100d16100ed565b604080516001600160a01b039092168252519081900360200190f35b60006101187fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead610406565b905090565b6000606060006101e586868660405160240180848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001620631bb60e21b0319179052945061046c9350505050565b90508080602001905160408110156101fc57600080fd5b81516020830180516040519294929383019291908464010000000082111561022357600080fd5b90830190602082018581111561023857600080fd5b825164010000000081118282018810171561025257600080fd5b82525081516020918201929091019080838360005b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b506040525050509250925050935093915050565b610366816040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156103045781810151838201526020016102ec565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316632a2a7adb60e01b179052925061046c915050565b5050565b6103ae61037561047e565b6001600160a01b03166103866104d4565b6001600160a01b0316146040518060600160405280603281526020016106276032913961050b565b6103b781610519565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b0316628af59360e61b1790526104019061046c565b505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303daa95960e01b179052600090819061044c9061046c565b905080806020019051602081101561046357600080fd5b50519392505050565b60606104785a8361054c565b92915050565b6040805160048152602481019091526020810180516001600160e01b0316631cd4241960e21b17905260009081906104b59061046c565b90508080602001905160208110156104cc57600080fd5b505191505090565b6040805160048152602481019091526020810180516001600160e01b031663996d79a560e01b17905260009081906104b59061046c565b8161036657610366816102c0565b6103b77fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead6001600160a01b0383166103ba565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106105915780518252601f199092019160209182019101610572565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090925090508161060c57805160208201fd5b80516001141561061c5760016000f35b925061047891505056fe454f41732063616e206f6e6c792075706772616465207468656972206f776e20454f4120696d706c656d656e746174696f6ea26469706673582212207f82637ab24ef9653a9774102bad776ee1ee930f0e1d73dfcad1f8fd1b18609a64736f6c634300070600335369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642ea2646970667358221220f054814893c33a58bbcbd4f73988d982d06877b6e63ed1b5a478541f1e64b5b164736f6c63430007060033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001d25760003560e01c8063741a33eb1162000111578063996d79a511620000a55780639dc9dc93116200007b5780639dc9dc9314620003e4578063bdbf8c3614620003ee578063c1fb2ea214620003f8578063ffe73914146200040257620001d2565b8063996d79a514620003ac57806399ccd98b14620003b65780639be3ad6714620003cd57620001d2565b80638540661f11620000e75780638540661f146200034d57806385979f7614620003745780638bb42e15146200038b5780639058025614620003a257620001d2565b8063741a33eb14620002f9578063746c32f114620003105780638435035b146200033657620001d2565b806322bd64c01162000189578063461a4478116200015f578063461a447814620002b75780634d78009214620002ce5780635a98c36114620002e55780637350906414620002ef57620001d2565b806322bd64c0146200027257806324749d5c14620002895780632a2a7adb14620002a057620001d2565b806303daa95914620001d75780630da449d11462000206578063101185a4146200021f57806314aa2ff714620002385780631c4712a7146200025e57806320160f3a1462000268575b600080fd5b620001ee620001e8366004620027ac565b62000419565b604051620001fd919062002b83565b60405180910390f35b6200021d62000217366004620027ac565b62000463565b005b62000229620004a0565b604051620001fd919062002c74565b6200024f6200024936600462002843565b620004a9565b604051620001fd919062002b8c565b620001ee6200054a565b620001ee62000550565b6200021d62000283366004620027de565b62000556565b620001ee6200029a366004620026c2565b620005c1565b6200021d620002b136600462002843565b620005e0565b6200024f620002c83660046200296e565b620005ed565b6200021d620002df36600462002700565b620006cf565b620001ee620008b3565b6200024f620008b9565b6200021d6200030a36600462002800565b620008c8565b620003276200032136600462002753565b62000a52565b604051620001fd919062002c5f565b620001ee62000347366004620026c2565b62000a8b565b620003646200035e36600462002a76565b62000aa2565b604051620001fd92919062002c24565b620003646200038536600462002a76565b62000b1f565b620003646200039c36600462002a0d565b62000b70565b620001ee62000c4e565b6200024f62000c54565b6200024f620003c736600462002881565b62000c63565b6200021d620003de366004620029b8565b62000cfd565b6200024f62000e5b565b620001ee62000e6a565b620001ee62000e70565b620003646200041336600462002a76565b62000e8b565b6000619c4060005a905060006200042f62000c54565b90506200043d818662000f04565b93505060005a82039050808310156200045b57601080548483030190555b505050919050565b600f5460ff600160a01b90910416151560011415620004885762000488600762000fa3565b6200049d6200049662000c54565b8262000fbe565b50565b60085460ff1690565b600f5460009060ff600160a01b90910416151560011415620004d157620004d1600762000fa3565b619c4060005a90506000620004e562000c54565b9050620004f28162001035565b60006200050a826200050484620010c4565b62001157565b9050620005188187620011f3565b9450505060005a82039050808310156200053a5760108054840190556200045b565b6010805482019055505050919050565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156200057b576200057b600762000fa3565b61ea6060005a905060006200058f62000c54565b90506200059e818686620012c1565b5060005a8203905080831015620005ba57601080548483030190555b5050505050565b6000620005d8620005d28362001352565b620013e5565b90505b919050565b6200049d600282620013e9565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200064f57818101518382015260200162000635565b50505050905090810190601f1680156200067d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200069b57600080fd5b505afa158015620006b0573d6000803e3d6000fd5b505050506040513d6020811015620006c757600080fd5b505192915050565b333014620006dd57620008af565b620006e88262001430565b620006f957620006f9600662000fa3565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a906200072b90849060040162002c5f565b60206040518083038186803b1580156200074457600080fd5b505afa15801562000759573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077f91906200278a565b620007905762000790600562000fa3565b6200079b82620014c3565b6000620007a88262001530565b90506001600160a01b038116620007c557620007c5600862000fa3565b600060125460ff166009811115620007d957fe5b14620007f057601254620007f09060ff1662000fa3565b6000620007fd8262001541565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a906200083090849060040162002c5f565b60206040518083038186803b1580156200084957600080fd5b505afa1580156200085e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200088491906200278a565b620008955762000895600562000fa3565b620008ac8483620008a685620013e5565b6200155b565b50505b5050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415620008ed57620008ed600762000fa3565b600060018585601b0185856040516000815260200160405260405162000917949392919062002c41565b6020604051602081039080840390855afa1580156200093a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166200097a576200097a604051806060016040528060388152602001620036a360389139620005e0565b620009858162001430565b620009915750620008ac565b6200099c81620014c3565b600f80546001600160a01b038381166001600160a01b03198316179092556040519116906000906003602160991b0190620009d7906200258d565b620009e3919062002b8c565b604051809103906000f08015801562000a00573d6000803e3d6000fd5b50600f80546001600160a01b0319166001600160a01b038516179055905062000a3c838262000a2f8162001541565b805190602001206200155b565b62000a4983600062000fbe565b50505050505050565b606060008260011462000a66578262000a69565b60025b905062000a8262000a7a8662001352565b85836200159c565b95945050505050565b6000620005d862000a9c8362001352565b620015be565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915062000ae881898989620015c2565b945094505060005a820390508083101562000b0b57601080548401905562000b14565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915062000ae881898989620015c2565b60006060331562000b8057600080fd5b600280546001600160a01b0319166001600160a01b03851617905562000ba68562001659565b6000196011556080850151600f80546001600160a01b039283166001600160a01b03199182168117909255600e8054938816939091169290921790915560a086015160c087015160405162000bfc919062002b65565b60006040518083038160008787f1925050503d806000811462000c3c576040519150601f19603f3d011682016040523d82523d6000602084013e62000c41565b606091505b5091509150935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060ff600160a01b9091041615156001141562000c8b5762000c8b600762000fa3565b619c4060005a9050600062000c9f62000c54565b905062000cac8162001035565b600062000cbb828888620016ce565b905062000cc98188620011f3565b9450505060005a820390508083101562000ceb57601080548401905562000cf4565b60108054820190555b50505092915050565b600a541562000d295760405162461bcd60e51b815260040162000d209062002d65565b60405180910390fd5b600280546001600160a01b0319166001600160a01b038381169190911791829055604051630d15d41560e41b815291169063d15d41509062000d7090339060040162002b8c565b60206040518083038186803b15801562000d8957600080fd5b505afa15801562000d9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000dc491906200278a565b62000de35760405162461bcd60e51b815260040162000d209062002cf9565b62000dee8262001659565b62000e028260a00151836040015162001718565b62000e0d57620008af565b60005a905062000e326003600001548460a001510384608001518560c0015162000b1f565b505060005a8203905062000e456200174c565b5050600280546001600160a01b03191690555050565b600d546001600160a01b031690565b60095490565b600062000e8662000e8062000c54565b620010c4565b905090565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff16151591810191909152909150600062000ee0828a8a8a620015c2565b95509550505060005a820390508083101562000b0b57601080548401905562000b14565b600062000f128383620017af565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f9062000f46908690869060040162002bc4565b60206040518083038186803b15801562000f5f57600080fd5b505afa15801562000f74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9a9190620027c5565b90505b92915050565b6200049d8160405180602001604052806000815250620013e9565b62000fc982620018ff565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb869062000ffd908590859060040162002bc4565b600060405180830381600087803b1580156200101857600080fd5b505af11580156200102d573d6000803e3d6000fd5b505050505050565b600080620010885a6002602160991b018560405160240162001058919062002b8c565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905262000b1f565b91509150600081806020019051810190620010a491906200278a565b9050801580620010b2575082155b15620008ac57620008ac600962000fa3565b6000620010d18262001a25565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f906200110390859060040162002b8c565b60206040518083038186803b1580156200111c57600080fd5b505afa15801562001131573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620027c5565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908162001172579050509050620011958462001b7c565b81600081518110620011a357fe5b6020026020010181905250620011b98362001baa565b81600181518110620011c757fe5b60200260200101819052506000620011df8262001bc1565b905062000a82818051906020012062001bf2565b60006200121a6200120362000c54565b6200121162000e8062000c54565b60010162000fbe565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908416602082015260006200129d825a3088886040516024016200126d92919062002bfe565b60408051601f198184030181529190526020810180516001600160e01b03166326bc004960e11b17905262001bf5565b506012805460ff19169055905080620012b857600062000a82565b50929392505050565b80620012ce848462000f04565b1415620012db576200134d565b620012e7838362001dc7565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906200131d9086908690869060040162002bdd565b600060405180830381600087803b1580156200133857600080fd5b505af115801562000a49573d6000803e3d6000fd5b505050565b60006200135f8262001a25565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906200139190859060040162002b8c565b60206040518083038186803b158015620013aa57600080fd5b505afa158015620013bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620026e1565b3f90565b333b15801562001418576012805484919060ff191660018360098111156200140d57fe5b021790555060016000f35b600062001426848462001ee8565b9050805160208201fd5b60006200143d8262001a25565b6002546040516307a1294560e01b81526001600160a01b03909116906307a12945906200146f90859060040162002b8c565b60206040518083038186803b1580156200148857600080fd5b505afa1580156200149d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d891906200278a565b620014ce8162001a25565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906200150090849060040162002b8c565b600060405180830381600087803b1580156200151b57600080fd5b505af1158015620005ba573d6000803e3d6000fd5b60008151602083016000f092915050565b6060620005d88260006200155585620015be565b6200159c565b6200156683620018ff565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906200131d9086908690869060040162002ba0565b60606040519050602082018101604052818152818360208301863c9392505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156200161357505060408051602081019091526000815260019062001650565b60006064856001600160a01b0316106200163857620016328562001352565b6200163a565b845b90506200164a8787838762001bf5565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156200168957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a0810151620016c89062001fb3565b60115550565b60008060ff60f81b85848680519060200120604051602001620016f5949392919062002b2c565b60405160208183030381529060405280519060200120905062000a828162001bf2565b6004546000908311156200172f5750600062000f9d565b600354831015620017435750600062000f9d565b50600192915050565b600d80546001600160a01b031990811690915560006009819055600a819055600b819055600c8190556008805460ff199081169091556010829055600e8054909316909255600f80546001600160a81b0319169055601155601280549091169055565b6175305a1015620017c657620017c6600162000fa3565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad2267990620017fa908590859060040162002bc4565b60206040518083038186803b1580156200181357600080fd5b505afa15801562001828573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200184e91906200278a565b6200185f576200185f600462000fa3565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649062001894908690869060040162002bc4565b602060405180830381600087803b158015620018af57600080fd5b505af1158015620018c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018ea91906200278a565b9050806200134d576200134d614e2062001fc8565b6200190a8162001a25565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f790906200193d90859060040162002b8c565b602060405180830381600087803b1580156200195857600080fd5b505af11580156200196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200199391906200278a565b905080620008af57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620019ec57600080fd5b505af115801562001a01573d6000803e3d6000fd5b50505050620008af617530606462001a1d62000a9c8662001352565b020162001fc8565b6175305a101562001a3c5762001a3c600162000fa3565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf9062001a6e90849060040162002b8c565b60206040518083038186803b15801562001a8757600080fd5b505afa15801562001a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac291906200278a565b62001ad35762001ad3600462000fa3565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c9062001b0690859060040162002b8c565b602060405180830381600087803b15801562001b2157600080fd5b505af115801562001b36573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b5c91906200278a565b905080620008af57620008af617530606462001a1d62000a9c8662001352565b6060620005d88260405160200162001b95919062002b0f565b60405160208183030381529060405262001feb565b6060620005d862001bbb836200203c565b62001feb565b6060600062001bd0836200214d565b905062001beb62001be4825160c06200225a565b82620023b7565b9392505050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff161515928201929092526000919062001c3e818862002438565b601154600062001c4e8862001fb3565b905080601160000181905550600080886001600160a01b03168a8960405162001c78919062002b65565b60006040518083038160008787f1925050503d806000811462001cb8576040519150601f19603f3d011682016040523d82523d6000602084013e62001cbd565b606091505b509150915062001cce8b8662002438565b6011548262001db05760008060008062001ce886620024ef565b92965090945092509050600484600981111562001d0157fe5b141562001d135762001d138462000fa3565b600284600981111562001d2257fe5b148062001d3b5750600584600981111562001d3957fe5b145b8062001d535750600784600981111562001d5157fe5b145b8062001d6b5750600984600981111562001d6957fe5b145b1562001d775760108290555b600284600981111562001d8657fe5b141562001d965780955062001da9565b6040518060200160405280600081525095505b5090925050505b909203909203601155909890975095505050505050565b62001dd38282620017af565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc0119062001e08908690869060040162002bc4565b602060405180830381600087803b15801562001e2357600080fd5b505af115801562001e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001e5e91906200278a565b9050806200134d5762001e7183620018ff565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b15801562001ec257600080fd5b505af115801562001ed7573d6000803e3d6000fd5b505050506200134d614e2062001fc8565b6060600183600981111562001ef957fe5b148062001f125750600883600981111562001f1057fe5b145b1562001f2e575060408051602081019091526000815262000f9d565b600483600981111562001f3d57fe5b141562001f7f5760408051602080820183526000808352925162001f68938793909283920162002c89565b604051602081830303815290604052905062000f9d565b60115460105460405162001f9c9286929091869060200162002cc9565b604051602081830303815290604052905092915050565b60005a821062001fc4575a620005d8565b5090565b60115481111562001fdf5762001fdf600362000fa3565b60118054919091039055565b606080825160011480156200201557506080836000815181106200200b57fe5b016020015160f81c105b1562002023575081620005d8565b62000f9a62002035845160806200225a565b84620023b7565b606060008260405160200162002053919062002b83565b604051602081830303815290604052905060005b6020811015620020a2578181815181106200207e57fe5b01602001516001600160f81b031916156200209957620020a2565b60010162002067565b6000816020036001600160401b0381118015620020be57600080fd5b506040519080825280601f01601f191660200182016040528015620020ea576020820181803683370190505b50905060005b8151811015620021445783516001840193859181106200210c57fe5b602001015160f81c60f81b8282815181106200212457fe5b60200101906001600160f81b031916908160001a905350600101620020f0565b50949350505050565b6060815160001415620021705750604080516000815260208101909152620005db565b6000805b8351811015620021a6578381815181106200218b57fe5b60200260200101515182019150808060010191505062002174565b6000826001600160401b0381118015620021bf57600080fd5b506040519080825280601f01601f191660200182016040528015620021eb576020820181803683370190505b50600092509050602081015b8551831015620021445760008684815181106200221057fe5b602002602001015190506000602082019050620022308382845162002547565b8785815181106200223d57fe5b6020026020010151518301925050508280600101935050620021f7565b6060806038841015620022b7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106200229a57fe5b60200101906001600160f81b031916908160001a90535062000f9a565b600060015b808681620022c657fe5b0415620022dd5760019091019061010002620022bc565b816001016001600160401b0381118015620022f757600080fd5b506040519080825280601f01601f19166020018201604052801562002323576020820181803683370190505b50925084820160370160f81b836000815181106200233d57fe5b60200101906001600160f81b031916908160001a905350600190505b818111620023ae576101008183036101000a87816200237457fe5b04816200237d57fe5b0660f81b8382815181106200238e57fe5b60200101906001600160f81b031916908160001a90535060010162002359565b50509392505050565b6060806040519050835180825260208201818101602087015b81831015620023ea578051835260209283019201620023d0565b50855184518101855292509050808201602086015b8183101562002419578051835260209283019201620023ff565b508651929092011591909101601f01601f191660405250905092915050565b805182516001600160a01b0390811691161462002471578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614620024b8576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b806040015115158260400151151514620008af5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156200252157505060408051602081019091526000808252600193509150819062002540565b84806020019051810190620025379190620028c7565b93509350935093505b9193509193565b8282825b602081106200256c578151835260209283019290910190601f19016200254b565b905182516020929092036101000a6000190180199091169116179052505050565b6108648062002e3f83390190565b6000620025b2620025ac8462002dd7565b62002db3565b9050828152838383011115620025c757600080fd5b828260208301376000602084830101529392505050565b8035620005db8162002e28565b600082601f830112620025fc578081fd5b62000f9a838335602085016200259b565b803560028110620005db57600080fd5b600060e082840312156200262f578081fd5b6200263b60e062002db3565b9050813581526020820135602082015262002659604083016200260d565b60408201526200266c60608301620025de565b60608201526200267f60808301620025de565b608082015260a082013560a082015260c08201356001600160401b03811115620026a857600080fd5b620026b684828501620025eb565b60c08301525092915050565b600060208284031215620026d4578081fd5b813562000f9a8162002e28565b600060208284031215620026f3578081fd5b815162000f9a8162002e28565b6000806040838503121562002713578081fd5b8235620027208162002e28565b915060208301356001600160401b038111156200273b578182fd5b6200274985828601620025eb565b9150509250929050565b60008060006060848603121562002768578081fd5b8335620027758162002e28565b95602085013595506040909401359392505050565b6000602082840312156200279c578081fd5b8151801515811462000f9a578182fd5b600060208284031215620027be578081fd5b5035919050565b600060208284031215620027d7578081fd5b5051919050565b60008060408385031215620027f1578182fd5b50508035926020909101359150565b6000806000806080858703121562002816578182fd5b84359350602085013560ff811681146200282e578283fd5b93969395505050506040820135916060013590565b60006020828403121562002855578081fd5b81356001600160401b038111156200286b578182fd5b6200287984828501620025eb565b949350505050565b6000806040838503121562002894578182fd5b82356001600160401b03811115620028aa578283fd5b620028b885828601620025eb565b95602094909401359450505050565b60008060008060808587031215620028dd578182fd5b8451600a8110620028ec578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111562002917578182fd5b8501601f8101871362002928578182fd5b805162002939620025ac8262002dd7565b8181528860208385010111156200294e578384fd5b6200296182602083016020860162002df9565b9598949750929550505050565b60006020828403121562002980578081fd5b81356001600160401b0381111562002996578182fd5b8201601f81018413620029a7578182fd5b62002879848235602084016200259b565b60008060408385031215620029cb578182fd5b82356001600160401b03811115620029e1578283fd5b620029ef858286016200261d565b925050602083013562002a028162002e28565b809150509250929050565b60008060006060848603121562002a22578081fd5b83356001600160401b0381111562002a38578182fd5b62002a46868287016200261d565b935050602084013562002a598162002e28565b9150604084013562002a6b8162002e28565b809150509250925092565b60008060006060848603121562002a8b578081fd5b83359250602084013562002a9f8162002e28565b915060408401356001600160401b0381111562002aba578182fd5b62002ac886828701620025eb565b9150509250925092565b6000815180845262002aec81602086016020860162002df9565b601f01601f19169290920160200192915050565b600a811062002b0b57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825162002b7981846020870162002df9565b9190910192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0383168152604060208201819052600090620028799083018462002ad2565b600083151582526040602083015262002879604083018462002ad2565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000f9a602083018462002ad2565b602081016002831062002c8357fe5b91905290565b600062002c97828762002b00565b60ff8516602083015260ff841660408301526080606083015262002cbf608083018462002ad2565b9695505050505050565b600062002cd7828762002b00565b8460208301528360408301526080606083015262002cbf608083018462002ad2565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6020808252602e908201527f4f6e6c792062652063616c6c61626c6520617420746865207374617274206f6660408201526d1030903a3930b739b0b1ba34b7b760911b606082015260800190565b6040518181016001600160401b038111828210171562002dcf57fe5b604052919050565b60006001600160401b0382111562002deb57fe5b50601f01601f191660200190565b60005b8381101562002e1657818101518382015260200162002dfc565b83811115620008ac5750506000910152565b6001600160a01b03811681146200049d57600080fdfe608060405234801561001057600080fd5b506040516108643803806108648339818101604052602081101561003357600080fd5b505161003e81610044565b506101c7565b6100877fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead60001b826001600160a01b031660001b61008a60201b6103ba1760201c565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b03908116628af59360e61b179091526100d691906100db16565b505050565b60606100e75a836100ed565b92915050565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106101325780518252601f199092019160209182019101610113565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d8060008114610195576040519150601f19603f3d011682016040523d82523d6000602084013e61019a565b606091505b509092509050816101ad57805160208201fd5b8051600114156101bd5760016000f35b92506100e7915050565b61068e806101d66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630900f010146100a1578063aaf10f42146100c9575b6000806100825a6100456100ed565b6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061011d92505050565b91509150811561009457805160208201f35b61009d816102c0565b5050005b6100c7600480360360208110156100b757600080fd5b50356001600160a01b031661036a565b005b6100d16100ed565b604080516001600160a01b039092168252519081900360200190f35b60006101187fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead610406565b905090565b6000606060006101e586868660405160240180848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001620631bb60e21b0319179052945061046c9350505050565b90508080602001905160408110156101fc57600080fd5b81516020830180516040519294929383019291908464010000000082111561022357600080fd5b90830190602082018581111561023857600080fd5b825164010000000081118282018810171561025257600080fd5b82525081516020918201929091019080838360005b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b506040525050509250925050935093915050565b610366816040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156103045781810151838201526020016102ec565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316632a2a7adb60e01b179052925061046c915050565b5050565b6103ae61037561047e565b6001600160a01b03166103866104d4565b6001600160a01b0316146040518060600160405280603281526020016106276032913961050b565b6103b781610519565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b0316628af59360e61b1790526104019061046c565b505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303daa95960e01b179052600090819061044c9061046c565b905080806020019051602081101561046357600080fd5b50519392505050565b60606104785a8361054c565b92915050565b6040805160048152602481019091526020810180516001600160e01b0316631cd4241960e21b17905260009081906104b59061046c565b90508080602001905160208110156104cc57600080fd5b505191505090565b6040805160048152602481019091526020810180516001600160e01b031663996d79a560e01b17905260009081906104b59061046c565b8161036657610366816102c0565b6103b77fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead6001600160a01b0383166103ba565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106105915780518252601f199092019160209182019101610572565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090925090508161060c57805160208201fd5b80516001141561061c5760016000f35b925061047891505056fe454f41732063616e206f6e6c792075706772616465207468656972206f776e20454f4120696d706c656d656e746174696f6ea26469706673582212207f82637ab24ef9653a9774102bad776ee1ee930f0e1d73dfcad1f8fd1b18609a64736f6c634300070600335369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642ea2646970667358221220f054814893c33a58bbcbd4f73988d982d06877b6e63ed1b5a478541f1e64b5b164736f6c63430007060033", + "devdoc": { + "details": "The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed environment allowing us to execute OVM transactions deterministically on either Layer 1 or Layer 2. The EM's run() function is the first function called during the execution of any transaction on L2. For each context-dependent EVM operation the EM has a function which implements a corresponding OVM operation, which will read state from the State Manager contract. The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any context-dependent operations. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager." + } + }, + "ovmADDRESS()": { + "returns": { + "_ADDRESS": "Active ADDRESS within the current message context." + } + }, + "ovmCALL(uint256,address,bytes)": { + "params": { + "_address": "Address of the contract to call.", + "_calldata": "Data to send along with the call.", + "_gasLimit": "Amount of gas to be passed into this call." + }, + "returns": { + "_returndata": "Data returned by the call.", + "_success": "Whether or not the call returned (rather than reverted)." + } + }, + "ovmCALLER()": { + "returns": { + "_CALLER": "Address of the CALLER within the current message context." + } + }, + "ovmCHAINID()": { + "returns": { + "_CHAINID": "Value of the chain's CHAINID within the global context." + } + }, + "ovmCREATE(bytes)": { + "params": { + "_bytecode": "Code to be used to CREATE a new contract." + }, + "returns": { + "_contract": "Address of the created contract." + } + }, + "ovmCREATE2(bytes,bytes32)": { + "params": { + "_bytecode": "Code to be used to CREATE2 a new contract.", + "_salt": "Value used to determine the contract's address." + }, + "returns": { + "_contract": "Address of the created contract." + } + }, + "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)": { + "details": "Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks because the contract we're creating is trusted (no need to do safety checking or to handle unexpected reverts). Doesn't need to return an address because the address is assumed to be the user's actual address.", + "params": { + "_messageHash": "Hash of a message signed by some user, for verification.", + "_r": "Signature `r` parameter.", + "_s": "Signature `s` parameter.", + "_v": "Signature `v` parameter." + } + }, + "ovmDELEGATECALL(uint256,address,bytes)": { + "params": { + "_address": "Address of the contract to call.", + "_calldata": "Data to send along with the call.", + "_gasLimit": "Amount of gas to be passed into this call." + }, + "returns": { + "_returndata": "Data returned by the call.", + "_success": "Whether or not the call returned (rather than reverted)." + } + }, + "ovmEXTCODECOPY(address,uint256,uint256)": { + "params": { + "_contract": "Address of the contract to copy code from.", + "_length": "Total number of bytes to copy from the contract's code.", + "_offset": "Offset in bytes from the start of contract code to copy beyond." + }, + "returns": { + "_code": "Bytes of code copied from the requested contract." + } + }, + "ovmEXTCODEHASH(address)": { + "params": { + "_contract": "Address of the contract to query the hash of." + }, + "returns": { + "_EXTCODEHASH": "Hash of the requested contract." + } + }, + "ovmEXTCODESIZE(address)": { + "params": { + "_contract": "Address of the contract to query the size of." + }, + "returns": { + "_EXTCODESIZE": "Size of the requested contract in bytes." + } + }, + "ovmGASLIMIT()": { + "returns": { + "_GASLIMIT": "Value of the block's GASLIMIT within the transaction context." + } + }, + "ovmGETNONCE()": { + "returns": { + "_nonce": "Nonce of the current contract." + } + }, + "ovmL1QUEUEORIGIN()": { + "returns": { + "_queueOrigin": "Address of the ovmL1QUEUEORIGIN within the current message context." + } + }, + "ovmL1TXORIGIN()": { + "returns": { + "_l1TxOrigin": "Address of the account which sent the tx into L2 from L1." + } + }, + "ovmNUMBER()": { + "returns": { + "_NUMBER": "Value of the NUMBER within the transaction context." + } + }, + "ovmREVERT(bytes)": { + "params": { + "_data": "Bytes data to pass along with the REVERT." + } + }, + "ovmSETNONCE(uint256)": { + "params": { + "_nonce": "New nonce for the current contract." + } + }, + "ovmSLOAD(bytes32)": { + "params": { + "_key": "32 byte key of the storage slot to load." + }, + "returns": { + "_value": "32 byte value of the requested storage slot." + } + }, + "ovmSSTORE(bytes32,bytes32)": { + "params": { + "_key": "32 byte key of the storage slot to set.", + "_value": "32 byte value for the storage slot." + } + }, + "ovmSTATICCALL(uint256,address,bytes)": { + "params": { + "_address": "Address of the contract to call.", + "_calldata": "Data to send along with the call.", + "_gasLimit": "Amount of gas to be passed into this call." + }, + "returns": { + "_returndata": "Data returned by the call.", + "_success": "Whether or not the call returned (rather than reverted)." + } + }, + "ovmTIMESTAMP()": { + "returns": { + "_TIMESTAMP": "Value of the TIMESTAMP within the transaction context." + } + }, + "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { + "params": { + "_ovmStateManager": "iOVM_StateManager implementation providing account state.", + "_transaction": "Transaction data to be executed." + } + }, + "safeCREATE(address,bytes)": { + "details": "This function is implemented as `public` because we need to be able to revert a contract creation without losing information about exactly *why* the contract reverted. In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS flag and then revert to reset the flag. We're able to do this by making an external call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay information before reverting.", + "params": { + "_address": "Address of the contract to associate with the one being created.", + "_bytecode": "Code to be used to create the new contract." + } + }, + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "params": { + "_from": "the OVM account the simulated call should be from.", + "_transaction": "the message transaction to simulate." + } + } + }, + "title": "OVM_ExecutionManager", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "ovmADDRESS()": { + "notice": "Overrides ADDRESS." + }, + "ovmCALL(uint256,address,bytes)": { + "notice": "Overrides CALL." + }, + "ovmCALLER()": { + "notice": "Overrides CALLER." + }, + "ovmCHAINID()": { + "notice": "Overrides CHAINID." + }, + "ovmCREATE(bytes)": { + "notice": "Overrides CREATE." + }, + "ovmCREATE2(bytes,bytes32)": { + "notice": "Overrides CREATE2." + }, + "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)": { + "notice": "Creates a new EOA contract account, for account abstraction." + }, + "ovmDELEGATECALL(uint256,address,bytes)": { + "notice": "Overrides DELEGATECALL." + }, + "ovmEXTCODECOPY(address,uint256,uint256)": { + "notice": "Overrides EXTCODECOPY." + }, + "ovmEXTCODEHASH(address)": { + "notice": "Overrides EXTCODEHASH." + }, + "ovmEXTCODESIZE(address)": { + "notice": "Overrides EXTCODESIZE." + }, + "ovmGASLIMIT()": { + "notice": "Overrides GASLIMIT." + }, + "ovmGETNONCE()": { + "notice": "Retrieves the nonce of the current ovmADDRESS." + }, + "ovmL1QUEUEORIGIN()": { + "notice": "Specifies from which L1 rollup queue this transaction originated from." + }, + "ovmL1TXORIGIN()": { + "notice": "Specifies which L1 account, if any, sent this transaction by calling enqueue()." + }, + "ovmNUMBER()": { + "notice": "Overrides NUMBER." + }, + "ovmREVERT(bytes)": { + "notice": "Overrides REVERT." + }, + "ovmSETNONCE(uint256)": { + "notice": "Sets the nonce of the current ovmADDRESS." + }, + "ovmSLOAD(bytes32)": { + "notice": "Overrides SLOAD." + }, + "ovmSSTORE(bytes32,bytes32)": { + "notice": "Overrides SSTORE." + }, + "ovmSTATICCALL(uint256,address,bytes)": { + "notice": "Overrides STATICCALL." + }, + "ovmTIMESTAMP()": { + "notice": "Overrides TIMESTAMP." + }, + "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { + "notice": "Starts the execution of a transaction via the OVM_ExecutionManager." + }, + "safeCREATE(address,bytes)": { + "notice": "Performs the logic to create a contract and revert under various potential conditions." + }, + "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { + "notice": "Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 4291, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmSafetyChecker", + "offset": 0, + "slot": "1", + "type": "t_contract(iOVM_SafetyChecker)10816" + }, + { + "astId": 4293, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmStateManager", + "offset": 0, + "slot": "2", + "type": "t_contract(iOVM_StateManager)11048" + }, + { + "astId": 4295, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "gasMeterConfig", + "offset": 0, + "slot": "3", + "type": "t_struct(GasMeterConfig)10594_storage" + }, + { + "astId": 4297, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "globalContext", + "offset": 0, + "slot": "7", + "type": "t_struct(GlobalContext)10597_storage" + }, + { + "astId": 4299, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionContext", + "offset": 0, + "slot": "8", + "type": "t_struct(TransactionContext)10610_storage" + }, + { + "astId": 4301, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageContext", + "offset": 0, + "slot": "14", + "type": "t_struct(MessageContext)10620_storage" + }, + { + "astId": 4303, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "transactionRecord", + "offset": 0, + "slot": "16", + "type": "t_struct(TransactionRecord)10613_storage" + }, + { + "astId": 4305, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "messageRecord", + "offset": 0, + "slot": "17", + "type": "t_struct(MessageRecord)10625_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_SafetyChecker)10816": { + "encoding": "inplace", + "label": "contract iOVM_SafetyChecker", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateManager)11048": { + "encoding": "inplace", + "label": "contract iOVM_StateManager", + "numberOfBytes": "20" + }, + "t_enum(QueueOrigin)11644": { + "encoding": "inplace", + "label": "enum Lib_OVMCodec.QueueOrigin", + "numberOfBytes": "1" + }, + "t_enum(RevertFlag)10579": { + "encoding": "inplace", + "label": "enum iOVM_ExecutionManager.RevertFlag", + "numberOfBytes": "1" + }, + "t_struct(GasMeterConfig)10594_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GasMeterConfig", + "members": [ + { + "astId": 10587, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "minTransactionGasLimit", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10589, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxTransactionGasLimit", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10591, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "maxGasPerQueuePerEpoch", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10593, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "secondsPerEpoch", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_struct(GlobalContext)10597_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.GlobalContext", + "members": [ + { + "astId": 10596, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCHAINID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_struct(MessageContext)10620_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageContext", + "members": [ + { + "astId": 10615, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmCALLER", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10617, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmADDRESS", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 10619, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "isStatic", + "offset": 20, + "slot": "1", + "type": "t_bool" + } + ], + "numberOfBytes": "64" + }, + "t_struct(MessageRecord)10625_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.MessageRecord", + "members": [ + { + "astId": 10622, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "nuisanceGasLeft", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 10624, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "revertFlag", + "offset": 0, + "slot": "1", + "type": "t_enum(RevertFlag)10579" + } + ], + "numberOfBytes": "64" + }, + "t_struct(TransactionContext)10610_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionContext", + "members": [ + { + "astId": 10599, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1QUEUEORIGIN", + "offset": 0, + "slot": "0", + "type": "t_enum(QueueOrigin)11644" + }, + { + "astId": 10601, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTIMESTAMP", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 10603, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmNUMBER", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 10605, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGASLIMIT", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 10607, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmTXGASLIMIT", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 10609, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmL1TXORIGIN", + "offset": 0, + "slot": "5", + "type": "t_address" + } + ], + "numberOfBytes": "192" + }, + "t_struct(TransactionRecord)10613_storage": { + "encoding": "inplace", + "label": "struct iOVM_ExecutionManager.TransactionRecord", + "members": [ + { + "astId": 10612, + "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", + "label": "ovmGasRefund", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_FraudVerifier.json b/deployments/kovan/OVM_FraudVerifier.json new file mode 100644 index 000000000..24fc5b09a --- /dev/null +++ b/deployments/kovan/OVM_FraudVerifier.json @@ -0,0 +1,552 @@ +{ + "address": "0x22d5693F575d3DeDA9cb4A23ADff6a7A65C290af", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_preStateRootIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_transactionHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "FraudProofFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_preStateRootIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_transactionHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "_who", + "type": "address" + } + ], + "name": "FraudProofInitialized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_preStateRootBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_preStateRootProof", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "_txHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_postStateRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_postStateRootBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_postStateRootProof", + "type": "tuple" + } + ], + "name": "finalizeFraudVerification", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_txHash", + "type": "bytes32" + } + ], + "name": "getStateTransitioner", + "outputs": [ + { + "internalType": "contract iOVM_StateTransitioner", + "name": "_transitioner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_preStateRootBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_preStateRootProof", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "enum Lib_OVMCodec.QueueOrigin", + "name": "l1QueueOrigin", + "type": "uint8" + }, + { + "internalType": "address", + "name": "l1TxOrigin", + "type": "address" + }, + { + "internalType": "address", + "name": "entrypoint", + "type": "address" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.Transaction", + "name": "_transaction", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "isSequenced", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "queueIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "txData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.TransactionChainElement", + "name": "_txChainElement", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_transactionBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_transactionProof", + "type": "tuple" + } + ], + "name": "initializeFraudVerification", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x4b58fe171fdc1dde44839a5e76f05e33c5e1a3323cce6e937df497e0cd573495", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x22d5693F575d3DeDA9cb4A23ADff6a7A65C290af", + "transactionIndex": 2, + "gasUsed": "1375611", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x92a9f80b9e794a7ed77c396aed92cfb4b024d1b72ba517574fa759335cca198f", + "transactionHash": "0x4b58fe171fdc1dde44839a5e76f05e33c5e1a3323cce6e937df497e0cd573495", + "logs": [], + "blockNumber": 23636599, + "cumulativeGasUsed": "1564561", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofFinalized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofInitialized\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_postStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_postStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_postStateRootProof\",\"type\":\"tuple\"}],\"name\":\"finalizeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"}],\"name\":\"getStateTransitioner\",\"outputs\":[{\"internalType\":\"contract iOVM_StateTransitioner\",\"name\":\"_transitioner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"isSequenced\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"txData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.TransactionChainElement\",\"name\":\"_txChainElement\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_transactionBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_transactionProof\",\"type\":\"tuple\"}],\"name\":\"initializeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Fraud Verifier contract coordinates the entire fraud proof verification process. If the fraud proof was successful it prunes any state batches from State Commitment Chain which were published after the fraudulent state root. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_postStateRoot\":\"State root after the fraudulent transaction.\",\"_postStateRootBatchHeader\":\"Batch header for the provided post-state root.\",\"_postStateRootProof\":\"Inclusion proof for the provided post-state root.\",\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_txHash\":\"The transaction for the state root\"}},\"getStateTransitioner(bytes32,bytes32)\":{\"params\":{\"_preStateRoot\":\"State root to query a transitioner for.\"},\"returns\":{\"_transitioner\":\"Corresponding state transitioner contract.\"}},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_transaction\":\"OVM transaction claimed to be fraudulent.\",\"_transactionBatchHeader\":\"Batch header for the provided transaction.\",\"_transactionProof\":\"Inclusion proof for the provided transaction.\",\"_txChainElement\":\"OVM transaction chain element.\"}}},\"title\":\"OVM_FraudVerifier\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Finalizes the fraud verification process.\"},\"getStateTransitioner(bytes32,bytes32)\":{\"notice\":\"Retrieves the state transitioner for a given root.\"},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Begins the fraud verification process.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":\"OVM_FraudVerifier\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/// Minimal contract to be inherited by contracts consumed by users that provide\\n/// data for fraud proofs\\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\\n /// Decorate your functions with this modifier to store how much total gas was\\n /// consumed by the sender, to reward users fairly\\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\\n uint256 startGas = gasleft();\\n _;\\n uint256 gasSpent = startGas - gasleft();\\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\\n }\\n}\\n\",\"keccak256\":\"0x6c27d089a297103cb93b30f7649ab68691cc6b948c315f1037e5de1fe9bf5903\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_StateTransitionerFactory } from \\\"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_FraudContributor } from \\\"./Abs_FraudContributor.sol\\\";\\n\\n\\n\\n/**\\n * @title OVM_FraudVerifier\\n * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. \\n * If the fraud proof was successful it prunes any state batches from State Commitment Chain\\n * which were published after the fraudulent state root.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier {\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => iOVM_StateTransitioner) internal transitioners;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n /**\\n * Retrieves the state transitioner for a given root.\\n * @param _preStateRoot State root to query a transitioner for.\\n * @return _transitioner Corresponding state transitioner contract.\\n */\\n function getStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n override\\n public\\n view\\n returns (\\n iOVM_StateTransitioner _transitioner\\n )\\n {\\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\\n }\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n /**\\n * Begins the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _transaction OVM transaction claimed to be fraudulent.\\n * @param _txChainElement OVM transaction chain element.\\n * @param _transactionBatchHeader Batch header for the provided transaction.\\n * @param _transactionProof Inclusion proof for the provided transaction.\\n */\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _transactionProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction))\\n {\\n bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction);\\n\\n if (_hasStateTransitioner(_preStateRoot, _txHash)) {\\n return;\\n }\\n\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\"));\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmCanonicalTransactionChain.verifyTransaction(\\n _transaction,\\n _txChainElement,\\n _transactionBatchHeader,\\n _transactionProof\\n ),\\n \\\"Invalid transaction inclusion proof.\\\"\\n );\\n\\n require (\\n _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index,\\n \\\"Pre-state root global index must equal to the transaction root global index.\\\"\\n );\\n\\n _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);\\n\\n emit FraudProofInitialized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n /**\\n * Finalizes the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _txHash The transaction for the state root\\n * @param _postStateRoot State root after the fraudulent transaction.\\n * @param _postStateRootBatchHeader Batch header for the provided post-state root.\\n * @param _postStateRootProof Inclusion proof for the provided post-state root.\\n */\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, _txHash)\\n {\\n iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n require(\\n transitioner.isComplete() == true,\\n \\\"State transition process must be completed prior to finalization.\\\"\\n );\\n\\n require (\\n _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,\\n \\\"Post-state root global index must equal to the pre state root global index plus one.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _postStateRoot,\\n _postStateRootBatchHeader,\\n _postStateRootProof\\n ),\\n \\\"Invalid post-state root inclusion proof.\\\"\\n );\\n\\n // If the post state root did not match, then there was fraud and we should delete the batch\\n require(\\n _postStateRoot != transitioner.getPostStateRoot(),\\n \\\"State transition has not been proven fraudulent.\\\"\\n );\\n \\n _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);\\n\\n // TEMPORARY: Remove the transitioner; for minnet.\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000);\\n\\n emit FraudProofFinalized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n\\n /************************************\\n * Internal Functions: Verification *\\n ************************************/\\n\\n /**\\n * Checks whether a transitioner already exists for a given pre-state root.\\n * @param _preStateRoot Pre-state root to check.\\n * @return _exists Whether or not we already have a transitioner for the root.\\n */\\n function _hasStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n internal\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return address(getStateTransitioner(_preStateRoot, _txHash)) != address(0);\\n }\\n\\n /**\\n * Deploys a new state transitioner.\\n * @param _preStateRoot Pre-state root to initialize the transitioner with.\\n * @param _txHash Hash of the transaction this transitioner will execute.\\n * @param _stateTransitionIndex Index of the transaction in the chain.\\n */\\n function _deployTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n uint256 _stateTransitionIndex\\n )\\n internal\\n {\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitionerFactory(\\n resolve(\\\"OVM_StateTransitionerFactory\\\")\\n ).create(\\n address(libAddressManager),\\n _stateTransitionIndex,\\n _preStateRoot,\\n _txHash\\n );\\n }\\n\\n /**\\n * Removes a state transition from the state commitment chain.\\n * @param _postStateRootBatchHeader Header for the post-state root.\\n * @param _preStateRoot Pre-state root hash.\\n */\\n function _cancelStateTransition(\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n bytes32 _preStateRoot\\n )\\n internal\\n {\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n // Delete the state batch.\\n ovmStateCommitmentChain.deleteStateBatch(\\n _postStateRootBatchHeader\\n );\\n\\n // Get the timestamp and publisher for that block.\\n (uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));\\n\\n // Slash the bonds at the bond manager.\\n ovmBondManager.finalize(\\n _preStateRoot,\\n publisher,\\n timestamp\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc15adfd74295cc85f1aa3e69838f320d90bf036b31af8a75717e22033f3f3f1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitionerFactory\\n */\\ninterface iOVM_StateTransitionerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _proxyManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n external\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n );\\n}\\n\",\"keccak256\":\"0x60a0f0c104e4c0c7863268a93005762e8146d393f9cfddfdd6a2d6585c5911fc\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161181238038061181283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b611781806100916000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063461a44781461005157806398d8867d1461007a578063a286ba1c1461008f578063b48ec820146100a2575b600080fd5b61006461005f3660046110d2565b6100b5565b60405161007191906112d7565b60405180910390f35b61008d610088366004610ffa565b610193565b005b61008d61009d366004610f35565b6104d2565b6100646100b0366004610f14565b61088c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561015f57600080fd5b505afa158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b505190505b919050565b8661019d856108db565b60005a905060006101ad886108db565b90506101b98b826108f4565b156101c45750610410565b60006101ff6040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006102416040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100b5565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161027393929190611330565b60206040518083038186803b15801561028b57600080fd5b505afa15801561029f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c39190610ee0565b6102e85760405162461bcd60e51b81526004016102df906115b8565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061031a908d908d908d908d90600401611612565b60206040518083038186803b15801561033257600080fd5b505afa158015610346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036a9190610ee0565b6103865760405162461bcd60e51b81526004016102df9061146a565b86600001518860600151018b600001518d6060015101600101146103bc5760405162461bcd60e51b81526004016102df906114f6565b6103cb8d848d60000151610913565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104049493929190611365565b60405180910390a15050505b60005a820390506104476040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104ad57600080fd5b505af11580156104c1573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006104e58b8961088c565b905060006105226040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006105566040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b9050826001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059157600080fd5b505afa1580156105a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c99190610ee0565b15156001146105ea5760405162461bcd60e51b81526004016102df90611389565b8a600001518c60600151016001018760000151896060015101146106205760405162461bcd60e51b81526004016102df906113f0565b816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161065093929190611330565b60206040518083038186803b15801561066857600080fd5b505afa15801561067c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a09190610ee0565b6106bc5760405162461bcd60e51b81526004016102df906115b8565b604051634d69ee5760e01b81526001600160a01b03831690634d69ee57906106ec908c908c908c90600401611330565b60206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073c9190610ee0565b6107585760405162461bcd60e51b81526004016102df906114ae565b826001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190610efc565b8914156107e85760405162461bcd60e51b81526004016102df90611568565b6107f2888e610a3e565b6000600160008f8d60405160200161080b92919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18d8c600001518c336040516104049493929190611365565b60006001600084846040516020016108a592919061125a565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b60006108e682610b98565b805190602001209050919050565b600080610901848461088c565b6001600160a01b031614159392505050565b6109516040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100b5565b600054604051631168a38160e11b81526001600160a01b03928316926322d1470292610988929116908590889088906004016112eb565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da91906110b6565b6001600085856040516020016109f192919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610a796040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b90506000610aad6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610adc9087906004016115ff565b600060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b299190611120565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b5e90889085908790600401611311565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610bd39796959493929190611268565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610bfd57fe5b610c10601f8401601f19166020016116d1565b9050828152838383011115610c2457600080fd5b828260208301376000602084830101529392505050565b803561018e81611725565b600082601f830112610c56578081fd5b610c6583833560208501610be9565b9392505050565b80356002811061018e57600080fd5b600060a08284031215610c8c578081fd5b60405160a0810167ffffffffffffffff8282108183111715610caa57fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b50610cf485828601610c46565b6080830152505092915050565b600060408284031215610d12578081fd5b6040516040810167ffffffffffffffff8282108183111715610d3057fe5b8160405282935084358352602091508185013581811115610d5057600080fd5b8501601f81018713610d6157600080fd5b803582811115610d6d57fe5b8381029250610d7d8484016116d1565b8181528481019083860185850187018b1015610d9857600080fd5b600095505b83861015610dbb578035835260019590950194918601918601610d9d565b5080868801525050505050505092915050565b600060a08284031215610ddf578081fd5b60405160a0810167ffffffffffffffff8282108183111715610dfd57fe5b8160405282935084359150610e118261173d565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b600060e08284031215610e57578081fd5b610e6160e06116d1565b90508135815260208201356020820152610e7d60408301610c6c565b6040820152610e8e60608301610c3b565b6060820152610e9f60808301610c3b565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ec857600080fd5b610ed484828501610c46565b60c08301525092915050565b600060208284031215610ef1578081fd5b8151610c658161173d565b600060208284031215610f0d578081fd5b5051919050565b60008060408385031215610f26578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f4f578283fd5b87359650602088013567ffffffffffffffff80821115610f6d578485fd5b610f798b838c01610c7b565b975060408a0135915080821115610f8e578485fd5b610f9a8b838c01610d01565b965060608a0135955060808a0135945060a08a0135915080821115610fbd578384fd5b610fc98b838c01610c7b565b935060c08a0135915080821115610fde578283fd5b50610feb8a828b01610d01565b91505092959891949750929550565b600080600080600080600060e0888a031215611014578081fd5b87359650602088013567ffffffffffffffff80821115611032578283fd5b61103e8b838c01610c7b565b975060408a0135915080821115611053578283fd5b61105f8b838c01610d01565b965060608a0135915080821115611074578283fd5b6110808b838c01610e46565b955060808a0135915080821115611095578283fd5b6110a18b838c01610dce565b945060a08a0135915080821115610fbd578283fd5b6000602082840312156110c7578081fd5b8151610c6581611725565b6000602082840312156110e3578081fd5b813567ffffffffffffffff8111156110f9578182fd5b8201601f81018413611109578182fd5b61111884823560208401610be9565b949350505050565b60008060408385031215611132578182fd5b82519150602083015161114481611725565b809150509250929050565b6001600160a01b03169052565b600081518084526111748160208601602086016116f5565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561121057845182529383019360019290920191908301906111f0565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b918252602082015260400190565b60008882528760208301526002871061127d57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112c48160898501602087016116f5565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b6000848252606060208301526113496060830185611188565b828103604084015261135b81856111c5565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c656020830184611188565b60006080825285516080830152602086015160a083015260408601516002811061163857fe5b60c083015260608601516001600160a01b031660e0830152608086015161166361010084018261114f565b5060a086015161012083015260c086015160e061014084015261168a61016084018261115c565b9050828103602084015261169e818761121b565b905082810360408401526116b28186611188565b905082810360608401526116c681856111c5565b979650505050505050565b60405181810167ffffffffffffffff811182821017156116ed57fe5b604052919050565b60005b838110156117105781810151838201526020016116f8565b8381111561171f576000848401525b50505050565b6001600160a01b038116811461173a57600080fd5b50565b801515811461173a57600080fdfea2646970667358221220d5dc2a42c875765178976d1988d00ffd806a5dd5d5e646dcec12318b4b29b42564736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063461a44781461005157806398d8867d1461007a578063a286ba1c1461008f578063b48ec820146100a2575b600080fd5b61006461005f3660046110d2565b6100b5565b60405161007191906112d7565b60405180910390f35b61008d610088366004610ffa565b610193565b005b61008d61009d366004610f35565b6104d2565b6100646100b0366004610f14565b61088c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561015f57600080fd5b505afa158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b505190505b919050565b8661019d856108db565b60005a905060006101ad886108db565b90506101b98b826108f4565b156101c45750610410565b60006101ff6040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006102416040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100b5565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161027393929190611330565b60206040518083038186803b15801561028b57600080fd5b505afa15801561029f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c39190610ee0565b6102e85760405162461bcd60e51b81526004016102df906115b8565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061031a908d908d908d908d90600401611612565b60206040518083038186803b15801561033257600080fd5b505afa158015610346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036a9190610ee0565b6103865760405162461bcd60e51b81526004016102df9061146a565b86600001518860600151018b600001518d6060015101600101146103bc5760405162461bcd60e51b81526004016102df906114f6565b6103cb8d848d60000151610913565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104049493929190611365565b60405180910390a15050505b60005a820390506104476040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104ad57600080fd5b505af11580156104c1573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006104e58b8961088c565b905060006105226040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006105566040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b9050826001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059157600080fd5b505afa1580156105a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c99190610ee0565b15156001146105ea5760405162461bcd60e51b81526004016102df90611389565b8a600001518c60600151016001018760000151896060015101146106205760405162461bcd60e51b81526004016102df906113f0565b816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161065093929190611330565b60206040518083038186803b15801561066857600080fd5b505afa15801561067c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a09190610ee0565b6106bc5760405162461bcd60e51b81526004016102df906115b8565b604051634d69ee5760e01b81526001600160a01b03831690634d69ee57906106ec908c908c908c90600401611330565b60206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073c9190610ee0565b6107585760405162461bcd60e51b81526004016102df906114ae565b826001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190610efc565b8914156107e85760405162461bcd60e51b81526004016102df90611568565b6107f2888e610a3e565b6000600160008f8d60405160200161080b92919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18d8c600001518c336040516104049493929190611365565b60006001600084846040516020016108a592919061125a565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b60006108e682610b98565b805190602001209050919050565b600080610901848461088c565b6001600160a01b031614159392505050565b6109516040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100b5565b600054604051631168a38160e11b81526001600160a01b03928316926322d1470292610988929116908590889088906004016112eb565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da91906110b6565b6001600085856040516020016109f192919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610a796040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b90506000610aad6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610adc9087906004016115ff565b600060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b299190611120565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b5e90889085908790600401611311565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610bd39796959493929190611268565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610bfd57fe5b610c10601f8401601f19166020016116d1565b9050828152838383011115610c2457600080fd5b828260208301376000602084830101529392505050565b803561018e81611725565b600082601f830112610c56578081fd5b610c6583833560208501610be9565b9392505050565b80356002811061018e57600080fd5b600060a08284031215610c8c578081fd5b60405160a0810167ffffffffffffffff8282108183111715610caa57fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b50610cf485828601610c46565b6080830152505092915050565b600060408284031215610d12578081fd5b6040516040810167ffffffffffffffff8282108183111715610d3057fe5b8160405282935084358352602091508185013581811115610d5057600080fd5b8501601f81018713610d6157600080fd5b803582811115610d6d57fe5b8381029250610d7d8484016116d1565b8181528481019083860185850187018b1015610d9857600080fd5b600095505b83861015610dbb578035835260019590950194918601918601610d9d565b5080868801525050505050505092915050565b600060a08284031215610ddf578081fd5b60405160a0810167ffffffffffffffff8282108183111715610dfd57fe5b8160405282935084359150610e118261173d565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b600060e08284031215610e57578081fd5b610e6160e06116d1565b90508135815260208201356020820152610e7d60408301610c6c565b6040820152610e8e60608301610c3b565b6060820152610e9f60808301610c3b565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ec857600080fd5b610ed484828501610c46565b60c08301525092915050565b600060208284031215610ef1578081fd5b8151610c658161173d565b600060208284031215610f0d578081fd5b5051919050565b60008060408385031215610f26578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f4f578283fd5b87359650602088013567ffffffffffffffff80821115610f6d578485fd5b610f798b838c01610c7b565b975060408a0135915080821115610f8e578485fd5b610f9a8b838c01610d01565b965060608a0135955060808a0135945060a08a0135915080821115610fbd578384fd5b610fc98b838c01610c7b565b935060c08a0135915080821115610fde578283fd5b50610feb8a828b01610d01565b91505092959891949750929550565b600080600080600080600060e0888a031215611014578081fd5b87359650602088013567ffffffffffffffff80821115611032578283fd5b61103e8b838c01610c7b565b975060408a0135915080821115611053578283fd5b61105f8b838c01610d01565b965060608a0135915080821115611074578283fd5b6110808b838c01610e46565b955060808a0135915080821115611095578283fd5b6110a18b838c01610dce565b945060a08a0135915080821115610fbd578283fd5b6000602082840312156110c7578081fd5b8151610c6581611725565b6000602082840312156110e3578081fd5b813567ffffffffffffffff8111156110f9578182fd5b8201601f81018413611109578182fd5b61111884823560208401610be9565b949350505050565b60008060408385031215611132578182fd5b82519150602083015161114481611725565b809150509250929050565b6001600160a01b03169052565b600081518084526111748160208601602086016116f5565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561121057845182529383019360019290920191908301906111f0565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b918252602082015260400190565b60008882528760208301526002871061127d57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112c48160898501602087016116f5565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b6000848252606060208301526113496060830185611188565b828103604084015261135b81856111c5565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c656020830184611188565b60006080825285516080830152602086015160a083015260408601516002811061163857fe5b60c083015260608601516001600160a01b031660e0830152608086015161166361010084018261114f565b5060a086015161012083015260c086015160e061014084015261168a61016084018261115c565b9050828103602084015261169e818761121b565b905082810360408401526116b28186611188565b905082810360608401526116c681856111c5565b979650505050505050565b60405181810167ffffffffffffffff811182821017156116ed57fe5b604052919050565b60005b838110156117105781810151838201526020016116f8565b8381111561171f576000848401525b50505050565b6001600160a01b038116811461173a57600080fd5b50565b801515811461173a57600080fdfea2646970667358221220d5dc2a42c875765178976d1988d00ffd806a5dd5d5e646dcec12318b4b29b42564736f6c63430007060033", + "devdoc": { + "details": "The Fraud Verifier contract coordinates the entire fraud proof verification process. If the fraud proof was successful it prunes any state batches from State Commitment Chain which were published after the fraudulent state root. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager." + } + }, + "finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "params": { + "_postStateRoot": "State root after the fraudulent transaction.", + "_postStateRootBatchHeader": "Batch header for the provided post-state root.", + "_postStateRootProof": "Inclusion proof for the provided post-state root.", + "_preStateRoot": "State root before the fraudulent transaction.", + "_preStateRootBatchHeader": "Batch header for the provided pre-state root.", + "_preStateRootProof": "Inclusion proof for the provided pre-state root.", + "_txHash": "The transaction for the state root" + } + }, + "getStateTransitioner(bytes32,bytes32)": { + "params": { + "_preStateRoot": "State root to query a transitioner for." + }, + "returns": { + "_transitioner": "Corresponding state transitioner contract." + } + }, + "initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "params": { + "_preStateRoot": "State root before the fraudulent transaction.", + "_preStateRootBatchHeader": "Batch header for the provided pre-state root.", + "_preStateRootProof": "Inclusion proof for the provided pre-state root.", + "_transaction": "OVM transaction claimed to be fraudulent.", + "_transactionBatchHeader": "Batch header for the provided transaction.", + "_transactionProof": "Inclusion proof for the provided transaction.", + "_txChainElement": "OVM transaction chain element." + } + } + }, + "title": "OVM_FraudVerifier", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "notice": "Finalizes the fraud verification process." + }, + "getStateTransitioner(bytes32,bytes32)": { + "notice": "Retrieves the state transitioner for a given root." + }, + "initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "notice": "Begins the fraud verification process." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 8900, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", + "label": "transitioners", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11498)" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_contract(iOVM_StateTransitioner)11498": { + "encoding": "inplace", + "label": "contract iOVM_StateTransitioner", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11498)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", + "numberOfBytes": "32", + "value": "t_contract(iOVM_StateTransitioner)11498" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateCommitmentChain.json b/deployments/kovan/OVM_StateCommitmentChain.json new file mode 100644 index 000000000..0ddec5ac1 --- /dev/null +++ b/deployments/kovan/OVM_StateCommitmentChain.json @@ -0,0 +1,505 @@ +{ + "address": "0x61486103c072Dc1A6ac275d6E50D2adb1162263C", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fraudProofWindow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sequencerPublishWindow", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_batchIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_batchRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_prevTotalElements", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "StateBatchAppended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_batchIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "_batchRoot", + "type": "bytes32" + } + ], + "name": "StateBatchDeleted", + "type": "event" + }, + { + "inputs": [], + "name": "FRAUD_PROOF_WINDOW", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SEQUENCER_PUBLISH_WINDOW", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "_batch", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "_shouldStartAtElement", + "type": "uint256" + } + ], + "name": "appendStateBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "batches", + "outputs": [ + { + "internalType": "contract iOVM_ChainStorageContainer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_batchHeader", + "type": "tuple" + } + ], + "name": "deleteStateBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getLastSequencerTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "_lastSequencerTimestamp", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBatches", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalBatches", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalElements", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalElements", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_batchHeader", + "type": "tuple" + } + ], + "name": "insideFraudProofWindow", + "outputs": [ + { + "internalType": "bool", + "name": "_inside", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_element", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "_batchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "_proof", + "type": "tuple" + } + ], + "name": "verifyStateCommitment", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x00ac04aac57fb9e0f2a09bf37b8d96df9a1072f653b85061743aad995a298c87", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x61486103c072Dc1A6ac275d6E50D2adb1162263C", + "transactionIndex": 3, + "gasUsed": "1620938", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x02dfe2482f15052adc685b554cbea05696e42ffc7626482817417ae9dd5efc9a", + "transactionHash": "0x00ac04aac57fb9e0f2a09bf37b8d96df9a1072f653b85061743aad995a298c87", + "logs": [], + "blockNumber": 23635980, + "cumulativeGasUsed": "1747814", + "status": 1, + "byzantium": true + }, + "args": [ + "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + 60000, + 60000 + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fraudProofWindow\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_sequencerPublishWindow\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_prevTotalElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"StateBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"}],\"name\":\"StateBatchDeleted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FRAUD_PROOF_WINDOW\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SEQUENCER_PUBLISH_WINDOW\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_batch\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256\",\"name\":\"_shouldStartAtElement\",\"type\":\"uint256\"}],\"name\":\"appendStateBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batches\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"}],\"name\":\"deleteStateBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastSequencerTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_lastSequencerTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalBatches\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBatches\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalElements\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"}],\"name\":\"insideFraudProofWindow\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_inside\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_element\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"verifyStateCommitment\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Commitment Chain (SCC) contract contains a list of proposed state roots which Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique state root calculated off-chain by applying the canonical transactions one by one. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"appendStateBatch(bytes32[],uint256)\":{\"params\":{\"_batch\":\"Batch of state roots.\",\"_shouldStartAtElement\":\"Index of the element at which this batch should start.\"}},\"batches()\":{\"returns\":{\"_0\":\"Reference to the batch storage container.\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))\":{\"params\":{\"_batchHeader\":\"Header of the batch to start deleting from.\"}},\"getLastSequencerTimestamp()\":{\"returns\":{\"_lastSequencerTimestamp\":\"Last sequencer batch timestamp.\"}},\"getTotalBatches()\":{\"returns\":{\"_totalBatches\":\"Total submitted batches.\"}},\"getTotalElements()\":{\"returns\":{\"_totalElements\":\"Total submitted elements.\"}},\"insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))\":{\"params\":{\"_batchHeader\":\"Header of the batch to check.\"},\"returns\":{\"_inside\":\"Whether or not the batch is inside the fraud proof window.\"}},\"verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_batchHeader\":\"Header of the batch in which the element was included.\",\"_element\":\"Hash of the element to verify a proof for.\",\"_proof\":\"Merkle inclusion proof for the element.\"}}},\"title\":\"OVM_StateCommitmentChain\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"appendStateBatch(bytes32[],uint256)\":{\"notice\":\"Appends a batch of state roots to the chain.\"},\"batches()\":{\"notice\":\"Accesses the batch storage container.\"},\"deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))\":{\"notice\":\"Deletes all state roots after (and including) a given batch.\"},\"getLastSequencerTimestamp()\":{\"notice\":\"Retrieves the timestamp of the last batch submitted by the sequencer.\"},\"getTotalBatches()\":{\"notice\":\"Retrieves the total number of batches submitted.\"},\"getTotalElements()\":{\"notice\":\"Retrieves the total number of elements submitted.\"},\"insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))\":{\"notice\":\"Checks whether a given batch is still inside its fraud proof window.\"},\"verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Verifies a batch inclusion proof.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol\":\"OVM_StateCommitmentChain\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_MerkleTree } from \\\"../../libraries/utils/Lib_MerkleTree.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/* External Imports */\\nimport '@openzeppelin/contracts/math/SafeMath.sol';\\n\\n/**\\n * @title OVM_StateCommitmentChain\\n * @dev The State Commitment Chain (SCC) contract contains a list of proposed state roots which\\n * Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). \\n * Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique\\n * state root calculated off-chain by applying the canonical transactions one by one.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResolver {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 public FRAUD_PROOF_WINDOW;\\n uint256 public SEQUENCER_PUBLISH_WINDOW;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n uint256 _fraudProofWindow,\\n uint256 _sequencerPublishWindow\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:SCC:batches\\\")\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getTotalElements()\\n override\\n public\\n view\\n returns (\\n uint256 _totalElements\\n )\\n {\\n (uint40 totalElements, ) = _getBatchExtraData();\\n return uint256(totalElements);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getTotalBatches()\\n override\\n public\\n view\\n returns (\\n uint256 _totalBatches\\n )\\n {\\n return batches().length();\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getLastSequencerTimestamp()\\n override\\n public\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n )\\n {\\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\\n return uint256(lastSequencerTimestamp);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function appendStateBatch(\\n bytes32[] memory _batch,\\n uint256 _shouldStartAtElement\\n )\\n override\\n public\\n {\\n // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the\\n // publication of batches by some other user.\\n require(\\n _shouldStartAtElement == getTotalElements(),\\n \\\"Actual batch start index does not match expected start index.\\\"\\n );\\n\\n // Proposers must have previously staked at the BondManager\\n require(\\n iOVM_BondManager(resolve(\\\"OVM_BondManager\\\")).isCollateralized(msg.sender),\\n \\\"Proposer does not have enough collateral posted\\\"\\n );\\n\\n require(\\n _batch.length > 0,\\n \\\"Cannot submit an empty state batch.\\\"\\n );\\n\\n require(\\n getTotalElements() + _batch.length <= iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\")).getTotalElements(),\\n \\\"Number of state roots cannot exceed the number of canonical transactions.\\\"\\n );\\n\\n // Pass the block's timestamp and the publisher of the data\\n // to be used in the fraud proofs\\n _appendBatch(\\n _batch,\\n abi.encode(block.timestamp, msg.sender)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n override\\n public\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"State batches can only be deleted by the OVM_FraudVerifier.\\\"\\n );\\n\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n insideFraudProofWindow(_batchHeader),\\n \\\"State batches can only be deleted within the fraud proof window.\\\"\\n );\\n\\n _deleteBatch(_batchHeader);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n Lib_MerkleTree.verify(\\n _batchHeader.batchRoot,\\n _element,\\n _proof.index,\\n _proof.siblings,\\n _batchHeader.batchSize\\n ),\\n \\\"Invalid inclusion proof.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n override\\n public\\n view\\n returns (\\n bool _inside\\n )\\n {\\n (uint256 timestamp,) = abi.decode(\\n _batchHeader.extraData,\\n (uint256, address)\\n );\\n\\n require(\\n timestamp != 0,\\n \\\"Batch header timestamp cannot be zero\\\"\\n );\\n return SafeMath.add(timestamp, FRAUD_PROOF_WINDOW) > block.timestamp;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Parses the batch context from the extra data.\\n * @return Total number of elements submitted.\\n * @return Timestamp of the last batch submitted by the sequencer.\\n */\\n function _getBatchExtraData()\\n internal\\n view\\n returns (\\n uint40,\\n uint40\\n )\\n {\\n bytes27 extraData = batches().getGlobalMetadata();\\n\\n uint40 totalElements;\\n uint40 lastSequencerTimestamp;\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n lastSequencerTimestamp := shr(40, and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\\n }\\n\\n return (\\n totalElements,\\n lastSequencerTimestamp\\n );\\n }\\n\\n /**\\n * Encodes the batch context for the extra data.\\n * @param _totalElements Total number of elements submitted.\\n * @param _lastSequencerTimestamp Timestamp of the last batch submitted by the sequencer.\\n * @return Encoded batch context.\\n */\\n function _makeBatchExtraData(\\n uint40 _totalElements,\\n uint40 _lastSequencerTimestamp\\n )\\n internal\\n pure\\n returns (\\n bytes27\\n )\\n {\\n bytes27 extraData;\\n assembly {\\n extraData := _totalElements\\n extraData := or(extraData, shl(40, _lastSequencerTimestamp))\\n extraData := shl(40, extraData)\\n }\\n\\n return extraData;\\n }\\n\\n /**\\n * Appends a batch to the chain.\\n * @param _batch Elements within the batch.\\n * @param _extraData Any extra data to append to the batch.\\n */\\n function _appendBatch(\\n bytes32[] memory _batch,\\n bytes memory _extraData\\n )\\n internal\\n {\\n address sequencer = resolve(\\\"OVM_Sequencer\\\");\\n (uint40 totalElements, uint40 lastSequencerTimestamp) = _getBatchExtraData();\\n\\n if (msg.sender == sequencer) {\\n lastSequencerTimestamp = uint40(block.timestamp);\\n } else {\\n // We keep track of the last batch submitted by the sequencer so there's a window in\\n // which only the sequencer can publish state roots. A window like this just reduces\\n // the chance of \\\"system breaking\\\" state roots being published while we're still in\\n // testing mode. This window should be removed or significantly reduced in the future.\\n require(\\n lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp,\\n \\\"Cannot publish state roots within the sequencer publication window.\\\"\\n );\\n }\\n\\n Lib_OVMCodec.ChainBatchHeader memory batchHeader = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: getTotalBatches(),\\n batchRoot: Lib_MerkleTree.getMerkleRoot(_batch),\\n batchSize: _batch.length,\\n prevTotalElements: totalElements,\\n extraData: _extraData\\n });\\n\\n emit StateBatchAppended(\\n batchHeader.batchIndex,\\n batchHeader.batchRoot,\\n batchHeader.batchSize,\\n batchHeader.prevTotalElements,\\n batchHeader.extraData\\n );\\n\\n batches().push(\\n Lib_OVMCodec.hashBatchHeader(batchHeader),\\n _makeBatchExtraData(\\n uint40(batchHeader.prevTotalElements + batchHeader.batchSize),\\n lastSequencerTimestamp\\n )\\n );\\n }\\n\\n /**\\n * Removes a batch and all subsequent batches from the chain.\\n * @param _batchHeader Header of the batch to remove.\\n */\\n function _deleteBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n {\\n require(\\n _batchHeader.batchIndex < batches().length(),\\n \\\"Invalid batch index.\\\"\\n );\\n\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n batches().deleteElementsAfterInclusive(\\n _batchHeader.batchIndex,\\n _makeBatchExtraData(\\n uint40(_batchHeader.prevTotalElements),\\n 0\\n )\\n );\\n\\n emit StateBatchDeleted(\\n _batchHeader.batchIndex,\\n _batchHeader.batchRoot\\n );\\n }\\n\\n /**\\n * Checks that a batch header matches the stored hash for the given index.\\n * @param _batchHeader Batch header to validate.\\n * @return Whether or not the header matches the stored one.\\n */\\n function _isValidBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\\n }\\n}\\n\",\"keccak256\":\"0x69cf5f5859dbae537accdc4be2a82ec243d6519ee9fc8d01a9b5cbbd1a198fe8\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_MerkleTree\\n * @author River Keefer\\n */\\nlibrary Lib_MerkleTree {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\\n * If you do not know the original length of elements for the tree you are verifying,\\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\\n * @param _elements Array of hashes from which to generate a merkle root.\\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\\n */\\n function getMerkleRoot(\\n bytes32[] memory _elements\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _elements.length > 0,\\n \\\"Lib_MerkleTree: Must provide at least one leaf hash.\\\"\\n );\\n\\n if (_elements.length == 0) {\\n return _elements[0];\\n }\\n\\n uint256[16] memory defaults = [\\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\\n ];\\n\\n // Reserve memory space for our hashes.\\n bytes memory buf = new bytes(64);\\n\\n // We'll need to keep track of left and right siblings.\\n bytes32 leftSibling;\\n bytes32 rightSibling;\\n\\n // Number of non-empty nodes at the current depth.\\n uint256 rowSize = _elements.length;\\n\\n // Current depth, counting from 0 at the leaves\\n uint256 depth = 0;\\n\\n // Common sub-expressions\\n uint256 halfRowSize; // rowSize / 2\\n bool rowSizeIsOdd; // rowSize % 2 == 1\\n\\n while (rowSize > 1) {\\n halfRowSize = rowSize / 2;\\n rowSizeIsOdd = rowSize % 2 == 1;\\n\\n for (uint256 i = 0; i < halfRowSize; i++) {\\n leftSibling = _elements[(2 * i) ];\\n rightSibling = _elements[(2 * i) + 1];\\n assembly {\\n mstore(add(buf, 32), leftSibling )\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[i] = keccak256(buf);\\n }\\n\\n if (rowSizeIsOdd) {\\n leftSibling = _elements[rowSize - 1];\\n rightSibling = bytes32(defaults[depth]);\\n assembly {\\n mstore(add(buf, 32), leftSibling)\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[halfRowSize] = keccak256(buf);\\n }\\n\\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\\n depth++;\\n }\\n\\n return _elements[0];\\n }\\n\\n /**\\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\\n * of leaves generated is a known, correct input, and does not return true for indices \\n * extending past that index (even if _siblings would be otherwise valid.)\\n * @param _root The Merkle root to verify against.\\n * @param _leaf The leaf hash to verify inclusion of.\\n * @param _index The index in the tree of this leaf.\\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \\n * @param _totalLeaves The total number of leaves originally passed into.\\n * @return Whether or not the merkle branch and leaf passes verification.\\n */\\n function verify(\\n bytes32 _root,\\n bytes32 _leaf,\\n uint256 _index,\\n bytes32[] memory _siblings,\\n uint256 _totalLeaves\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _totalLeaves > 0,\\n \\\"Lib_MerkleTree: Total leaves must be greater than zero.\\\"\\n );\\n\\n require(\\n _index < _totalLeaves,\\n \\\"Lib_MerkleTree: Index out of bounds.\\\"\\n );\\n\\n require(\\n _siblings.length == _ceilLog2(_totalLeaves),\\n \\\"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\\\"\\n );\\n\\n bytes32 computedRoot = _leaf;\\n\\n for (uint256 i = 0; i < _siblings.length; i++) {\\n if ((_index & 1) == 1) {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n _siblings[i],\\n computedRoot\\n )\\n );\\n } else {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n computedRoot,\\n _siblings[i]\\n )\\n );\\n }\\n\\n _index >>= 1;\\n }\\n\\n return _root == computedRoot;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Calculates the integer ceiling of the log base 2 of an input.\\n * @param _in Unsigned input to calculate the log.\\n * @return ceil(log_base_2(_in))\\n */\\n function _ceilLog2(\\n uint256 _in\\n )\\n private\\n pure\\n returns (\\n uint256\\n )\\n { \\n require(\\n _in > 0,\\n \\\"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\\\"\\n );\\n\\n if (_in == 1) {\\n return 0;\\n }\\n\\n // Find the highest set bit (will be floor(log_2)).\\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\\n uint256 val = _in;\\n uint256 highest = 0;\\n for (uint8 i = 128; i >= 1; i >>= 1) {\\n if (val & (uint(1) << i) - 1 << i != 0) {\\n highest += i;\\n val >>= i;\\n }\\n }\\n\\n // Increment by one if this is not a perfect logarithm.\\n if ((uint(1) << highest) != _in) {\\n highest += 1;\\n }\\n\\n return highest;\\n }\\n}\\n\",\"keccak256\":\"0xd7459ac196122e9ba672802d2726708a206dac46efbf9820fb66f5f1c53f89bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051611bdd380380611bdd83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b32806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638ca5cbb9116100715780638ca5cbb91461011c5780639418bddd14610131578063b8e189ac14610144578063c17b291b14610157578063cfdf677e1461015f578063e561dddc14610167576100a9565b8063461a4478146100ae5780634d69ee57146100d75780637aa63a86146100f75780637ad168a01461010c57806381eb62ef14610114575b600080fd5b6100c16100bc3660046114d2565b61016f565b6040516100ce919061158e565b60405180910390f35b6100ea6100e5366004611420565b61024d565b6040516100ce91906115a2565b6100ff6102c0565b6040516100ce91906115ad565b6100ff6102d9565b6100ff6102f2565b61012f61012a36600461137f565b6102f8565b005b6100ea61013f366004611520565b61050c565b61012f610152366004611520565b61055c565b6100ff610614565b6100c161061a565b6100ff610642565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b505190505b919050565b6000610258836106bc565b61027d5760405162461bcd60e51b815260040161027490611738565b60405180910390fd5b61029a836020015185846000015185602001518760400151610754565b6102b65760405162461bcd60e51b8152600401610274906116a4565b5060019392505050565b6000806102cb6108d9565b5064ffffffffff1691505090565b6000806102e46108d9565b64ffffffffff169250505090565b60025481565b6103006102c0565b811461031e5760405162461bcd60e51b8152600401610274906116db565b61034e6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061016f565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b8152600401610379919061158e565b60206040518083038186803b15801561039157600080fd5b505afa1580156103a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c991906113c2565b6103e55760405162461bcd60e51b8152600401610274906118aa565b60008251116104065760405162461bcd60e51b815260040161027490611867565b6104446040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061016f565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b49190611408565b82516104be6102c0565b0111156104dd5760405162461bcd60e51b815260040161027490611635565b6105088242336040516020016104f4929190611990565b60405160208183030381529060405261096e565b5050565b60008082608001518060200190518101906105279190611553565b509050806105475760405162461bcd60e51b815260040161027490611822565b4261055482600154610b10565b119392505050565b61058e6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b81525061016f565b6001600160a01b0316336001600160a01b0316146105be5760405162461bcd60e51b8152600401610274906117c5565b6105c7816106bc565b6105e35760405162461bcd60e51b815260040161027490611738565b6105ec8161050c565b6106085760405162461bcd60e51b815260040161027490611767565b61061181610b71565b50565b60015481565b600061063d604051806060016040528060258152602001611aa46025913961016f565b905090565b600061064c61061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068457600080fd5b505afa158015610698573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190611408565b60006106c661061a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916106f4916004016115ad565b60206040518083038186803b15801561070c57600080fd5b505afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107449190611408565b61074d83610ce9565b1492915050565b60008082116107945760405162461bcd60e51b8152600401808060200182810382526037815260200180611a206037913960400191505060405180910390fd5b8184106107d25760405162461bcd60e51b81526004018080602001828103825260248152602001806119cc6024913960400191505060405180910390fd5b6107db82610d2f565b8351146108195760405162461bcd60e51b815260040180806020018281038252604d815260200180611a57604d913960600191505060405180910390fd5b8460005b84518110156108cc57856001166001141561087b5784818151811061083e57fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108c0565b8185828151811061088857fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161081d565b5090951495945050505050565b60008060006108e661061a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561091e57600080fd5b505afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906113e2565b64ffffffffff602882901c16935060501c9150509091565b600061099e6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b81525061016f565b90506000806109ab6108d9565b9092509050336001600160a01b03841614156109c85750426109f2565b426002548264ffffffffff1601106109f25760405162461bcd60e51b8152600401610274906118f9565b60006040518060a00160405280610a07610642565b8152602001610a1588610dd9565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a7e94939291906115cc565b60405180910390a2610a8e61061a565b6001600160a01b0316632015276c610aa583610ce9565b610ab9846040015185606001510186611209565b6040518363ffffffff1660e01b8152600401610ad69291906115b6565b600060405180830381600087803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b6a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b7961061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb157600080fd5b505afa158015610bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be99190611408565b815110610c085760405162461bcd60e51b815260040161027490611962565b610c11816106bc565b610c2d5760405162461bcd60e51b815260040161027490611738565b610c3561061a565b6001600160a01b031663167fd6818260000151610c5784606001516000611209565b6040518363ffffffff1660e01b8152600401610c749291906115b6565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cde91906115ad565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d1294939291906115cc565b604051602081830303815290604052805190602001209050919050565b6000808211610d6f5760405162461bcd60e51b81526004018080602001828103825260308152602001806119f06030913960400191505060405180910390fd5b8160011415610d8057506000610248565b81600060805b60018160ff1610610dc4578060ff1660018260ff166001901b03901b8316600014610db95760ff811692831c9291909101905b60011c607f16610d86565b506001811b8414610b6a576001019392505050565b600080825111610e1a5760405162461bcd60e51b8152600401808060200182810382526034815260200180611ac96034913960400191505060405180910390fd5b8151610e3c5781600081518110610e2d57fe5b60200260200101519050610248565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111e55750506002820460018084161460005b82811015611161578a816002028151811061110857fe5b602002602001015196508a816002026001018151811061112457fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061114e57fe5b60209081029190910101526001016110f1565b5080156111c45789600185038151811061117757fe5b6020026020010151955087836010811061118d57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111b757fe5b6020026020010181815250505b806111d05760006111d3565b60015b60ff16820193506001909201916110d9565b896000815181106111f257fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561122b57fe5b61123e601f8401601f19166020016119a7565b905082815283838301111561125257600080fd5b828260208301376000602084830101529392505050565b600082601f830112611279578081fd5b8135602067ffffffffffffffff82111561128f57fe5b80820261129d8282016119a7565b8381528281019086840183880185018910156112b7578687fd5b8693505b858410156112d95780358352600193909301929184019184016112bb565b50979650505050505050565b600060a082840312156112f6578081fd5b60405160a0810167ffffffffffffffff828210818311171561131457fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561135157600080fd5b508301601f8101851361136357600080fd5b61137285823560208401611217565b6080830152505092915050565b60008060408385031215611391578182fd5b823567ffffffffffffffff8111156113a7578283fd5b6113b385828601611269565b95602094909401359450505050565b6000602082840312156113d3578081fd5b81518015158114610b6a578182fd5b6000602082840312156113f3578081fd5b815164ffffffffff1981168114610b6a578182fd5b600060208284031215611419578081fd5b5051919050565b600080600060608486031215611434578081fd5b83359250602084013567ffffffffffffffff80821115611452578283fd5b61145e878388016112e5565b93506040860135915080821115611473578283fd5b9085019060408288031215611486578283fd5b60405160408101818110838211171561149b57fe5b604052823581526020830135828111156114b3578485fd5b6114bf89828601611269565b6020830152508093505050509250925092565b6000602082840312156114e3578081fd5b813567ffffffffffffffff8111156114f9578182fd5b8201601f81018413611509578182fd5b61151884823560208401611217565b949350505050565b600060208284031215611531578081fd5b813567ffffffffffffffff811115611547578182fd5b611518848285016112e5565b60008060408385031215611565578182fd5b825160208401519092506001600160a01b0381168114611583578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561160b5785810183015185820160a0015282016115ef565b8181111561161c578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119c357fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209cac82e6f8ed57077f98f7f2fa680b67b8ab39a271ed4164dce93565b3664cd864736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638ca5cbb9116100715780638ca5cbb91461011c5780639418bddd14610131578063b8e189ac14610144578063c17b291b14610157578063cfdf677e1461015f578063e561dddc14610167576100a9565b8063461a4478146100ae5780634d69ee57146100d75780637aa63a86146100f75780637ad168a01461010c57806381eb62ef14610114575b600080fd5b6100c16100bc3660046114d2565b61016f565b6040516100ce919061158e565b60405180910390f35b6100ea6100e5366004611420565b61024d565b6040516100ce91906115a2565b6100ff6102c0565b6040516100ce91906115ad565b6100ff6102d9565b6100ff6102f2565b61012f61012a36600461137f565b6102f8565b005b6100ea61013f366004611520565b61050c565b61012f610152366004611520565b61055c565b6100ff610614565b6100c161061a565b6100ff610642565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b505190505b919050565b6000610258836106bc565b61027d5760405162461bcd60e51b815260040161027490611738565b60405180910390fd5b61029a836020015185846000015185602001518760400151610754565b6102b65760405162461bcd60e51b8152600401610274906116a4565b5060019392505050565b6000806102cb6108d9565b5064ffffffffff1691505090565b6000806102e46108d9565b64ffffffffff169250505090565b60025481565b6103006102c0565b811461031e5760405162461bcd60e51b8152600401610274906116db565b61034e6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061016f565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b8152600401610379919061158e565b60206040518083038186803b15801561039157600080fd5b505afa1580156103a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c991906113c2565b6103e55760405162461bcd60e51b8152600401610274906118aa565b60008251116104065760405162461bcd60e51b815260040161027490611867565b6104446040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061016f565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b49190611408565b82516104be6102c0565b0111156104dd5760405162461bcd60e51b815260040161027490611635565b6105088242336040516020016104f4929190611990565b60405160208183030381529060405261096e565b5050565b60008082608001518060200190518101906105279190611553565b509050806105475760405162461bcd60e51b815260040161027490611822565b4261055482600154610b10565b119392505050565b61058e6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b81525061016f565b6001600160a01b0316336001600160a01b0316146105be5760405162461bcd60e51b8152600401610274906117c5565b6105c7816106bc565b6105e35760405162461bcd60e51b815260040161027490611738565b6105ec8161050c565b6106085760405162461bcd60e51b815260040161027490611767565b61061181610b71565b50565b60015481565b600061063d604051806060016040528060258152602001611aa46025913961016f565b905090565b600061064c61061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068457600080fd5b505afa158015610698573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190611408565b60006106c661061a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916106f4916004016115ad565b60206040518083038186803b15801561070c57600080fd5b505afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107449190611408565b61074d83610ce9565b1492915050565b60008082116107945760405162461bcd60e51b8152600401808060200182810382526037815260200180611a206037913960400191505060405180910390fd5b8184106107d25760405162461bcd60e51b81526004018080602001828103825260248152602001806119cc6024913960400191505060405180910390fd5b6107db82610d2f565b8351146108195760405162461bcd60e51b815260040180806020018281038252604d815260200180611a57604d913960600191505060405180910390fd5b8460005b84518110156108cc57856001166001141561087b5784818151811061083e57fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108c0565b8185828151811061088857fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161081d565b5090951495945050505050565b60008060006108e661061a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561091e57600080fd5b505afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906113e2565b64ffffffffff602882901c16935060501c9150509091565b600061099e6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b81525061016f565b90506000806109ab6108d9565b9092509050336001600160a01b03841614156109c85750426109f2565b426002548264ffffffffff1601106109f25760405162461bcd60e51b8152600401610274906118f9565b60006040518060a00160405280610a07610642565b8152602001610a1588610dd9565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a7e94939291906115cc565b60405180910390a2610a8e61061a565b6001600160a01b0316632015276c610aa583610ce9565b610ab9846040015185606001510186611209565b6040518363ffffffff1660e01b8152600401610ad69291906115b6565b600060405180830381600087803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b6a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b7961061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb157600080fd5b505afa158015610bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be99190611408565b815110610c085760405162461bcd60e51b815260040161027490611962565b610c11816106bc565b610c2d5760405162461bcd60e51b815260040161027490611738565b610c3561061a565b6001600160a01b031663167fd6818260000151610c5784606001516000611209565b6040518363ffffffff1660e01b8152600401610c749291906115b6565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cde91906115ad565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d1294939291906115cc565b604051602081830303815290604052805190602001209050919050565b6000808211610d6f5760405162461bcd60e51b81526004018080602001828103825260308152602001806119f06030913960400191505060405180910390fd5b8160011415610d8057506000610248565b81600060805b60018160ff1610610dc4578060ff1660018260ff166001901b03901b8316600014610db95760ff811692831c9291909101905b60011c607f16610d86565b506001811b8414610b6a576001019392505050565b600080825111610e1a5760405162461bcd60e51b8152600401808060200182810382526034815260200180611ac96034913960400191505060405180910390fd5b8151610e3c5781600081518110610e2d57fe5b60200260200101519050610248565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111e55750506002820460018084161460005b82811015611161578a816002028151811061110857fe5b602002602001015196508a816002026001018151811061112457fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061114e57fe5b60209081029190910101526001016110f1565b5080156111c45789600185038151811061117757fe5b6020026020010151955087836010811061118d57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111b757fe5b6020026020010181815250505b806111d05760006111d3565b60015b60ff16820193506001909201916110d9565b896000815181106111f257fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561122b57fe5b61123e601f8401601f19166020016119a7565b905082815283838301111561125257600080fd5b828260208301376000602084830101529392505050565b600082601f830112611279578081fd5b8135602067ffffffffffffffff82111561128f57fe5b80820261129d8282016119a7565b8381528281019086840183880185018910156112b7578687fd5b8693505b858410156112d95780358352600193909301929184019184016112bb565b50979650505050505050565b600060a082840312156112f6578081fd5b60405160a0810167ffffffffffffffff828210818311171561131457fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561135157600080fd5b508301601f8101851361136357600080fd5b61137285823560208401611217565b6080830152505092915050565b60008060408385031215611391578182fd5b823567ffffffffffffffff8111156113a7578283fd5b6113b385828601611269565b95602094909401359450505050565b6000602082840312156113d3578081fd5b81518015158114610b6a578182fd5b6000602082840312156113f3578081fd5b815164ffffffffff1981168114610b6a578182fd5b600060208284031215611419578081fd5b5051919050565b600080600060608486031215611434578081fd5b83359250602084013567ffffffffffffffff80821115611452578283fd5b61145e878388016112e5565b93506040860135915080821115611473578283fd5b9085019060408288031215611486578283fd5b60405160408101818110838211171561149b57fe5b604052823581526020830135828111156114b3578485fd5b6114bf89828601611269565b6020830152508093505050509250925092565b6000602082840312156114e3578081fd5b813567ffffffffffffffff8111156114f9578182fd5b8201601f81018413611509578182fd5b61151884823560208401611217565b949350505050565b600060208284031215611531578081fd5b813567ffffffffffffffff811115611547578182fd5b611518848285016112e5565b60008060408385031215611565578182fd5b825160208401519092506001600160a01b0381168114611583578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561160b5785810183015185820160a0015282016115ef565b8181111561161c578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119c357fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209cac82e6f8ed57077f98f7f2fa680b67b8ab39a271ed4164dce93565b3664cd864736f6c63430007060033", + "devdoc": { + "details": "The State Commitment Chain (SCC) contract contains a list of proposed state roots which Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique state root calculated off-chain by applying the canonical transactions one by one. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "appendStateBatch(bytes32[],uint256)": { + "params": { + "_batch": "Batch of state roots.", + "_shouldStartAtElement": "Index of the element at which this batch should start." + } + }, + "batches()": { + "returns": { + "_0": "Reference to the batch storage container." + } + }, + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager." + } + }, + "deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))": { + "params": { + "_batchHeader": "Header of the batch to start deleting from." + } + }, + "getLastSequencerTimestamp()": { + "returns": { + "_lastSequencerTimestamp": "Last sequencer batch timestamp." + } + }, + "getTotalBatches()": { + "returns": { + "_totalBatches": "Total submitted batches." + } + }, + "getTotalElements()": { + "returns": { + "_totalElements": "Total submitted elements." + } + }, + "insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))": { + "params": { + "_batchHeader": "Header of the batch to check." + }, + "returns": { + "_inside": "Whether or not the batch is inside the fraud proof window." + } + }, + "verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "params": { + "_batchHeader": "Header of the batch in which the element was included.", + "_element": "Hash of the element to verify a proof for.", + "_proof": "Merkle inclusion proof for the element." + } + } + }, + "title": "OVM_StateCommitmentChain", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "appendStateBatch(bytes32[],uint256)": { + "notice": "Appends a batch of state roots to the chain." + }, + "batches()": { + "notice": "Accesses the batch storage container." + }, + "deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))": { + "notice": "Deletes all state roots after (and including) a given batch." + }, + "getLastSequencerTimestamp()": { + "notice": "Retrieves the timestamp of the last batch submitted by the sequencer." + }, + "getTotalBatches()": { + "notice": "Retrieves the total number of batches submitted." + }, + "getTotalElements()": { + "notice": "Retrieves the total number of elements submitted." + }, + "insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))": { + "notice": "Checks whether a given batch is still inside its fraud proof window." + }, + "verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { + "notice": "Verifies a batch inclusion proof." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 3783, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "FRAUD_PROOF_WINDOW", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 3785, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", + "label": "SEQUENCER_PUBLISH_WINDOW", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "types": { + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateManagerFactory.json b/deployments/kovan/OVM_StateManagerFactory.json new file mode 100644 index 000000000..67fb8cd3c --- /dev/null +++ b/deployments/kovan/OVM_StateManagerFactory.json @@ -0,0 +1,74 @@ +{ + "address": "0x8ba74b3C5AAc1b26AFBfD5780EA8a2c81753bF36", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "contract iOVM_StateManager", + "name": "_ovmStateManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xdc9418127414cbd58dd03790012b29196e06951c105dc9bc43347934414c2e2f", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x8ba74b3C5AAc1b26AFBfD5780EA8a2c81753bF36", + "transactionIndex": 0, + "gasUsed": "1170970", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf889adc978b910b12386513fe0bddc36c5309325a4bc4e5f94f08f0a2565a0ce", + "transactionHash": "0xdc9418127414cbd58dd03790012b29196e06951c105dc9bc43347934414c2e2f", + "logs": [], + "blockNumber": 23635982, + "cumulativeGasUsed": "1170970", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"create\",\"outputs\":[{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Manager Factory is called by a State Transitioner's init code, to create a new State Manager for use in the Fraud Verification process. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"create(address)\":{\"params\":{\"_owner\":\"Owner of the created contract.\"},\"returns\":{\"_ovmStateManager\":\"New OVM_StateManager instance.\"}}},\"title\":\"OVM_StateManagerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address)\":{\"notice\":\"Creates a new OVM_StateManager\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol\":\"OVM_StateManagerFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title OVM_StateManager\\n * @dev The State Manager contract holds all storage values for contracts in the OVM. It can only be written to by the\\n * the Execution Manager and State Transitioner. It runs on L1 during the setup and execution of a fraud proof.\\n * The same logic runs on L2, but has been implemented as a precompile in the L2 go-ethereum client\\n * (see https://github.com/ethereum-optimism/go-ethereum/blob/master/core/vm/ovm_state_manager.go).\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateManager is iOVM_StateManager {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 constant internal EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\\n bytes32 constant internal EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n bytes32 constant internal STORAGE_XOR_VALUE = 0xFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEF;\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\n\\n\\n /****************************************\\n * Contract Variables: Internal Storage *\\n ****************************************/\\n\\n mapping (address => Lib_OVMCodec.Account) internal accounts;\\n mapping (address => mapping (bytes32 => bytes32)) internal contractStorage;\\n mapping (address => mapping (bytes32 => bool)) internal verifiedContractStorage;\\n mapping (bytes32 => ItemState) internal itemStates;\\n uint256 internal totalUncommittedAccounts;\\n uint256 internal totalUncommittedContractStorage;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _owner Address of the owner of this contract.\\n */\\n constructor(\\n address _owner\\n )\\n public\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Simple authentication, this contract should only be accessible to the owner (which is expected to be the State Transitioner during `PRE_EXECUTION` \\n * or the OVM_ExecutionManager during transaction execution.\\n */\\n modifier authenticated() {\\n // owner is the State Transitioner\\n require(\\n msg.sender == owner || msg.sender == ovmExecutionManager,\\n \\\"Function can only be called by authenticated addresses\\\"\\n );\\n _;\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (bool)\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\n }\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n /**\\n * Sets the address of the OVM_ExecutionManager.\\n * @param _ovmExecutionManager Address of the OVM_ExecutionManager.\\n */\\n function setExecutionManager(\\n address _ovmExecutionManager\\n )\\n override\\n public\\n authenticated\\n {\\n ovmExecutionManager = _ovmExecutionManager;\\n }\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n /**\\n * Inserts an account into the state.\\n * @param _address Address of the account to insert.\\n * @param _account Account to insert for the given address.\\n */\\n function putAccount(\\n address _address,\\n Lib_OVMCodec.Account memory _account\\n )\\n override\\n public\\n authenticated\\n {\\n accounts[_address] = _account;\\n }\\n\\n /**\\n * Marks an account as empty.\\n * @param _address Address of the account to mark.\\n */\\n function putEmptyAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\\n }\\n\\n /**\\n * Retrieves an account from the state.\\n * @param _address Address of the account to retrieve.\\n * @return _account Account for the given address.\\n */\\n function getAccount(address _address)\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory _account\\n )\\n {\\n return accounts[_address];\\n }\\n\\n /**\\n * Checks whether the state has a given account.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the state has the account.\\n */\\n function hasAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return accounts[_address].codeHash != bytes32(0);\\n }\\n\\n /**\\n * Checks whether the state has a given known empty account.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the state has the empty account.\\n */\\n function hasEmptyAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return (\\n accounts[_address].codeHash == EMPTY_ACCOUNT_CODE_HASH\\n && accounts[_address].nonce == 0\\n );\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n override\\n public\\n authenticated\\n {\\n accounts[_address].nonce = _nonce;\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256 _nonce\\n )\\n {\\n return accounts[_address].nonce;\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address _ethAddress\\n )\\n {\\n return accounts[_address].ethAddress;\\n }\\n\\n /**\\n * Retrieves the storage root of an account.\\n * @param _address Address of the account to access.\\n * @return _storageRoot Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32 _storageRoot\\n )\\n {\\n return accounts[_address].storageRoot;\\n }\\n\\n /**\\n * Initializes a pending account (during CREATE or CREATE2) with the default values.\\n * @param _address Address of the account to initialize.\\n */\\n function initPendingAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.nonce = 1;\\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\\n account.isFresh = true;\\n }\\n\\n /**\\n * Finalizes the creation of a pending account (during CREATE or CREATE2).\\n * @param _address Address of the account to finalize.\\n * @param _ethAddress Address of the account's associated contract on Ethereum.\\n * @param _codeHash Hash of the account's code.\\n */\\n function commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.ethAddress = _ethAddress;\\n account.codeHash = _codeHash;\\n }\\n\\n /**\\n * Checks whether an account has already been retrieved, and marks it as retrieved if not.\\n * @param _address Address of the account to check.\\n * @return _wasAccountAlreadyLoaded Whether or not the account was already loaded.\\n */\\n function testAndSetAccountLoaded(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountAlreadyLoaded\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_address),\\n ItemState.ITEM_LOADED\\n );\\n }\\n\\n /**\\n * Checks whether an account has already been modified, and marks it as modified if not.\\n * @param _address Address of the account to check.\\n * @return _wasAccountAlreadyChanged Whether or not the account was already modified.\\n */\\n function testAndSetAccountChanged(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountAlreadyChanged\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_address),\\n ItemState.ITEM_CHANGED\\n );\\n }\\n\\n /**\\n * Attempts to mark an account as committed.\\n * @param _address Address of the account to commit.\\n * @return _wasAccountCommitted Whether or not the account was committed.\\n */\\n function commitAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountCommitted\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\\n return false;\\n }\\n\\n itemStates[item] = ItemState.ITEM_COMMITTED;\\n totalUncommittedAccounts -= 1;\\n\\n return true;\\n }\\n\\n /**\\n * Increments the total number of uncommitted accounts.\\n */\\n function incrementTotalUncommittedAccounts()\\n override\\n public\\n authenticated\\n {\\n totalUncommittedAccounts += 1;\\n }\\n\\n /**\\n * Gets the total number of uncommitted accounts.\\n * @return _total Total uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256 _total\\n )\\n {\\n return totalUncommittedAccounts;\\n }\\n\\n /**\\n * Checks whether a given account was changed during execution.\\n * @param _address Address to check.\\n * @return Whether or not the account was changed.\\n */\\n function wasAccountChanged(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n return itemStates[item] >= ItemState.ITEM_CHANGED;\\n }\\n\\n /**\\n * Checks whether a given account was committed after execution.\\n * @param _address Address to check.\\n * @return Whether or not the account was committed.\\n */\\n function wasAccountCommitted(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\\n }\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n /**\\n * Changes a contract storage slot value.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte storage slot key.\\n * @param _value 32 byte storage slot value.\\n */\\n function putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n authenticated\\n {\\n // A hilarious optimization. `SSTORE`ing a value of `bytes32(0)` is common enough that it's\\n // worth populating this with a non-zero value in advance (during the fraud proof\\n // initialization phase) to cut the execution-time cost down to 5000 gas.\\n contractStorage[_contract][_key] = _value ^ STORAGE_XOR_VALUE;\\n\\n // Only used when initially populating the contract storage. OVM_ExecutionManager will\\n // perform a `hasContractStorage` INVALID_STATE_ACCESS check before putting any contract\\n // storage because writing to zero when the actual value is nonzero causes a gas\\n // discrepancy. Could be moved into a new `putVerifiedContractStorage` function, or\\n // something along those lines.\\n if (verifiedContractStorage[_contract][_key] == false) {\\n verifiedContractStorage[_contract][_key] = true;\\n }\\n }\\n\\n /**\\n * Retrieves a contract storage slot value.\\n * @param _contract Address of the contract to access.\\n * @param _key 32 byte storage slot key.\\n * @return _value 32 byte storage slot value.\\n */\\n function getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bytes32 _value\\n )\\n {\\n // Storage XOR system doesn't work for newly created contracts that haven't set this\\n // storage slot value yet.\\n if (\\n verifiedContractStorage[_contract][_key] == false\\n && accounts[_contract].isFresh\\n ) {\\n return bytes32(0);\\n }\\n\\n // See `putContractStorage` for more information about the XOR here.\\n return contractStorage[_contract][_key] ^ STORAGE_XOR_VALUE;\\n }\\n\\n /**\\n * Checks whether a contract storage slot exists in the state.\\n * @param _contract Address of the contract to access.\\n * @param _key 32 byte storage slot key.\\n * @return _exists Whether or not the key was set in the state.\\n */\\n function hasContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return verifiedContractStorage[_contract][_key] || accounts[_contract].isFresh;\\n }\\n\\n /**\\n * Checks whether a storage slot has already been retrieved, and marks it as retrieved if not.\\n * @param _contract Address of the contract to check.\\n * @param _key 32 byte storage slot key.\\n * @return _wasContractStorageAlreadyLoaded Whether or not the slot was already loaded.\\n */\\n function testAndSetContractStorageLoaded(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageAlreadyLoaded\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_contract, _key),\\n ItemState.ITEM_LOADED\\n );\\n }\\n\\n /**\\n * Checks whether a storage slot has already been modified, and marks it as modified if not.\\n * @param _contract Address of the contract to check.\\n * @param _key 32 byte storage slot key.\\n * @return _wasContractStorageAlreadyChanged Whether or not the slot was already modified.\\n */\\n function testAndSetContractStorageChanged(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageAlreadyChanged\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_contract, _key),\\n ItemState.ITEM_CHANGED\\n );\\n }\\n\\n /**\\n * Attempts to mark a storage slot as committed.\\n * @param _contract Address of the account to commit.\\n * @param _key 32 byte slot key to commit.\\n * @return _wasContractStorageCommitted Whether or not the slot was committed.\\n */\\n function commitContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageCommitted\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\\n return false;\\n }\\n\\n itemStates[item] = ItemState.ITEM_COMMITTED;\\n totalUncommittedContractStorage -= 1;\\n\\n return true;\\n }\\n\\n /**\\n * Increments the total number of uncommitted storage slots.\\n */\\n function incrementTotalUncommittedContractStorage()\\n override\\n public\\n authenticated\\n {\\n totalUncommittedContractStorage += 1;\\n }\\n\\n /**\\n * Gets the total number of uncommitted storage slots.\\n * @return _total Total uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256 _total\\n )\\n {\\n return totalUncommittedContractStorage;\\n }\\n\\n /**\\n * Checks whether a given storage slot was changed during execution.\\n * @param _contract Address to check.\\n * @param _key Key of the storage slot to check.\\n * @return Whether or not the storage slot was changed.\\n */\\n function wasContractStorageChanged(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n return itemStates[item] >= ItemState.ITEM_CHANGED;\\n }\\n\\n /**\\n * Checks whether a given storage slot was committed after execution.\\n * @param _contract Address to check.\\n * @param _key Key of the storage slot to check.\\n * @return Whether or not the storage slot was committed.\\n */\\n function wasContractStorageCommitted(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Generates a unique hash for an address.\\n * @param _address Address to generate a hash for.\\n * @return Unique hash for the given address.\\n */\\n function _getItemHash(\\n address _address\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_address));\\n }\\n\\n /**\\n * Generates a unique hash for an address/key pair.\\n * @param _contract Address to generate a hash for.\\n * @param _key Key to generate a hash for.\\n * @return Unique hash for the given pair.\\n */\\n function _getItemHash(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(\\n _contract,\\n _key\\n ));\\n }\\n\\n /**\\n * Checks whether an item is in a particular state (ITEM_LOADED or ITEM_CHANGED) and sets the\\n * item to the provided state if not.\\n * @param _item 32 byte item ID to check.\\n * @param _minItemState Minimum state that must be satisfied by the item.\\n * @return _wasItemState Whether or not the item was already in the state.\\n */\\n function _testAndSetItemState(\\n bytes32 _item,\\n ItemState _minItemState\\n )\\n internal\\n returns (\\n bool _wasItemState\\n )\\n {\\n bool wasItemState = itemStates[_item] >= _minItemState;\\n\\n if (wasItemState == false) {\\n itemStates[_item] = _minItemState;\\n }\\n\\n return wasItemState;\\n }\\n}\\n\",\"keccak256\":\"0x0b94b51e9da97ae06fc61499af543174c15954616f30996064a53a02f5b34d7a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_StateManagerFactory } from \\\"../../iOVM/execution/iOVM_StateManagerFactory.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_StateManager } from \\\"./OVM_StateManager.sol\\\";\\n\\n/**\\n * @title OVM_StateManagerFactory\\n * @dev The State Manager Factory is called by a State Transitioner's init code, to create a new \\n * State Manager for use in the Fraud Verification process.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateManagerFactory is iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return _ovmStateManager New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager _ovmStateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xecc22c73897708daccd0fb5f32e6a3f9eef5f0dab9d593834a83c9e0983e5144\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateManager } from \\\"./iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title iOVM_StateManagerFactory\\n */\\ninterface iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _owner\\n )\\n external\\n returns (\\n iOVM_StateManager _ovmStateManager\\n );\\n}\\n\",\"keccak256\":\"0x27a90fc43889d0c7d1db50f37907ef7386d9b415d15a1e91a0a068cba59afd36\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220e828fe40bec66e46eda3270ac747c1de16bdf5522d70c49b6a3f57a17ac6330e64736f6c63430007060033a264697066735822122076e75b14babd96506fc8c5ce0f379018a386361ff1618a85cde718d095d69b0764736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220e828fe40bec66e46eda3270ac747c1de16bdf5522d70c49b6a3f57a17ac6330e64736f6c63430007060033a264697066735822122076e75b14babd96506fc8c5ce0f379018a386361ff1618a85cde718d095d69b0764736f6c63430007060033", + "devdoc": { + "details": "The State Manager Factory is called by a State Transitioner's init code, to create a new State Manager for use in the Fraud Verification process. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "create(address)": { + "params": { + "_owner": "Owner of the created contract." + }, + "returns": { + "_ovmStateManager": "New OVM_StateManager instance." + } + } + }, + "title": "OVM_StateManagerFactory", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "create(address)": { + "notice": "Creates a new OVM_StateManager" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json b/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json new file mode 100644 index 000000000..563d59527 --- /dev/null +++ b/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json @@ -0,0 +1,399 @@ +{ + "language": "Solidity", + "sources": { + "contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_ECDSAContractAccount\n */\ninterface iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external returns (bool _success, bytes memory _returndata);\n}\n" + }, + "contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../rlp/Lib_RLPReader.sol\";\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\nimport { Lib_Bytes32Utils } from \"../utils/Lib_Bytes32Utils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*************\n * Constants *\n *************/\n\n bytes constant internal RLP_NULL_BYTES = hex'80';\n bytes constant internal NULL_BYTES = bytes('');\n\n // Ring buffer IDs\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\"RING_BUFFER_SCC_BATCHES\");\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\"RING_BUFFER_CTC_BATCHES\");\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\"RING_BUFFER_CTC_QUEUE\");\n\n\n /*********\n * Enums *\n *********/\n\n enum EOASignatureType {\n EIP155_TRANSACTON,\n ETH_SIGNED_MESSAGE\n }\n\n enum QueueOrigin {\n SEQUENCER_QUEUE,\n L1TOL2_QUEUE\n }\n\n\n /***********\n * Structs *\n ***********/\n\n struct Account {\n uint256 nonce;\n uint256 balance;\n bytes32 storageRoot;\n bytes32 codeHash;\n address ethAddress;\n bool isFresh;\n }\n\n struct EVMAccount {\n uint256 nonce;\n uint256 balance;\n bytes32 storageRoot;\n bytes32 codeHash;\n }\n\n struct ChainBatchHeader {\n uint256 batchIndex;\n bytes32 batchRoot;\n uint256 batchSize;\n uint256 prevTotalElements;\n bytes extraData;\n }\n\n struct ChainInclusionProof {\n uint256 index;\n bytes32[] siblings;\n }\n\n struct Transaction {\n uint256 timestamp;\n uint256 blockNumber;\n QueueOrigin l1QueueOrigin;\n address l1TxOrigin;\n address entrypoint;\n uint256 gasLimit;\n bytes data;\n }\n\n struct TransactionChainElement {\n bool isSequenced;\n uint256 queueIndex; // QUEUED TX ONLY\n uint256 timestamp; // SEQUENCER TX ONLY\n uint256 blockNumber; // SEQUENCER TX ONLY\n bytes txData; // SEQUENCER TX ONLY\n }\n\n struct QueueElement {\n bytes32 queueRoot;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n struct EIP155Transaction {\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint256 chainId;\n }\n\n\n /*********************************************\n * Internal Functions: Encoding and Decoding *\n *********************************************/\n\n /**\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\n * @param _transaction Encoded EOA transaction.\n * @return _decoded Transaction decoded into a struct.\n */\n function decodeEIP155Transaction(\n bytes memory _transaction,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (\n EIP155Transaction memory _decoded\n )\n {\n if (_isEthSignedMessage) {\n (\n uint256 _nonce,\n uint256 _gasLimit,\n uint256 _gasPrice,\n uint256 _chainId,\n address _to,\n bytes memory _data\n ) = abi.decode(\n _transaction,\n (uint256, uint256, uint256, uint256, address ,bytes)\n );\n return EIP155Transaction({\n nonce: _nonce,\n gasPrice: _gasPrice,\n gasLimit: _gasLimit,\n to: _to,\n value: 0,\n data: _data,\n chainId: _chainId\n });\n } else {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\n\n return EIP155Transaction({\n nonce: Lib_RLPReader.readUint256(decoded[0]),\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\n to: Lib_RLPReader.readAddress(decoded[3]),\n value: Lib_RLPReader.readUint256(decoded[4]),\n data: Lib_RLPReader.readBytes(decoded[5]),\n chainId: Lib_RLPReader.readUint256(decoded[6])\n });\n }\n }\n\n function decompressEIP155Transaction(\n bytes memory _transaction\n )\n internal\n returns (\n EIP155Transaction memory _decompressed\n )\n {\n return EIP155Transaction({\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\n to: Lib_BytesUtils.toAddress(_transaction, 9),\n data: Lib_BytesUtils.slice(_transaction, 29),\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\n value: 0\n });\n }\n\n /**\n * Encodes an EOA transaction back into the original transaction.\n * @param _transaction EIP155transaction to encode.\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\n * @return Encoded transaction.\n */\n function encodeEIP155Transaction(\n EIP155Transaction memory _transaction,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n if (_isEthSignedMessage) {\n return abi.encode(\n _transaction.nonce,\n _transaction.gasLimit,\n _transaction.gasPrice,\n _transaction.chainId,\n _transaction.to,\n _transaction.data\n );\n } else {\n bytes[] memory raw = new bytes[](9);\n\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\n if (_transaction.to == address(0)) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n raw[4] = Lib_RLPWriter.writeUint(0);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\n\n return Lib_RLPWriter.writeList(raw);\n }\n }\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return _encoded Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory _encoded\n )\n {\n return abi.encodePacked(\n _transaction.timestamp,\n _transaction.blockNumber,\n _transaction.l1QueueOrigin,\n _transaction.l1TxOrigin,\n _transaction.entrypoint,\n _transaction.gasLimit,\n _transaction.data\n );\n }\n\n /**\n * Hashes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return _hash Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(encodeTransaction(_transaction));\n }\n\n /**\n * Converts an OVM account to an EVM account.\n * @param _in OVM account to convert.\n * @return _out Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory _out\n )\n {\n return EVMAccount({\n nonce: _in.nonce,\n balance: _in.balance,\n storageRoot: _in.storageRoot,\n codeHash: _in.codeHash\n });\n }\n\n /**\n * @notice RLP-encodes an account state struct.\n * @param _account Account state struct.\n * @return _encoded RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory _encoded\n )\n {\n bytes[] memory raw = new bytes[](4);\n\n // Unfortunately we can't create this array outright because\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\n // index-by-index circumvents this issue.\n raw[0] = Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(\n bytes32(_account.nonce)\n )\n );\n raw[1] = Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(\n bytes32(_account.balance)\n )\n );\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * @notice Decodes an RLP-encoded account state into a useful struct.\n * @param _encoded RLP-encoded account state.\n * @return _account Account state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory _account\n )\n {\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\n\n return EVMAccount({\n nonce: Lib_RLPReader.readUint256(accountState[0]),\n balance: Lib_RLPReader.readUint256(accountState[1]),\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\n });\n }\n\n /**\n * Calculates a hash for a given batch header.\n * @param _batchHeader Header to hash.\n * @return _hash Hash of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(\n abi.encode(\n _batchHeader.batchRoot,\n _batchHeader.batchSize,\n _batchHeader.prevTotalElements,\n _batchHeader.extraData\n )\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_RLPReader\n * @dev Adapted from \"RLPReader\" by Hamdi Allam (hamdi.allam97@gmail.com).\n */\nlibrary Lib_RLPReader {\n\n /*************\n * Constants *\n *************/\n\n uint256 constant internal MAX_LIST_LENGTH = 32;\n\n\n /*********\n * Enums *\n *********/\n\n enum RLPItemType {\n DATA_ITEM,\n LIST_ITEM\n }\n\n \n /***********\n * Structs *\n ***********/\n\n struct RLPItem {\n uint256 length;\n uint256 ptr;\n }\n \n\n /**********************\n * Internal Functions *\n **********************/\n \n /**\n * Converts bytes to a reference to memory position and length.\n * @param _in Input bytes to convert.\n * @return Output memory reference.\n */\n function toRLPItem(\n bytes memory _in\n )\n internal\n pure\n returns (\n RLPItem memory\n )\n {\n uint256 ptr;\n assembly {\n ptr := add(_in, 32)\n }\n\n return RLPItem({\n length: _in.length,\n ptr: ptr\n });\n }\n\n /**\n * Reads an RLP list value into a list of RLP items.\n * @param _in RLP list value.\n * @return Decoded RLP list items.\n */\n function readList(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n RLPItem[] memory\n )\n {\n (\n uint256 listOffset,\n ,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.LIST_ITEM,\n \"Invalid RLP list value.\"\n );\n\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\n // writing to the length. Since we can't know the number of RLP items without looping over\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\n // simply set a reasonable maximum list length and decrease the size before we finish.\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\n\n uint256 itemCount = 0;\n uint256 offset = listOffset;\n while (offset < _in.length) {\n require(\n itemCount < MAX_LIST_LENGTH,\n \"Provided RLP list exceeds max list length.\"\n );\n\n (\n uint256 itemOffset,\n uint256 itemLength,\n ) = _decodeLength(RLPItem({\n length: _in.length - offset,\n ptr: _in.ptr + offset\n }));\n\n out[itemCount] = RLPItem({\n length: itemLength + itemOffset,\n ptr: _in.ptr + offset\n });\n\n itemCount += 1;\n offset += itemOffset + itemLength;\n }\n\n // Decrease the array size to match the actual item count.\n assembly {\n mstore(out, itemCount)\n }\n\n return out;\n }\n\n /**\n * Reads an RLP list value into a list of RLP items.\n * @param _in RLP list value.\n * @return Decoded RLP list items.\n */\n function readList(\n bytes memory _in\n )\n internal\n pure\n returns (\n RLPItem[] memory\n )\n {\n return readList(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bytes value into bytes.\n * @param _in RLP bytes value.\n * @return Decoded bytes.\n */\n function readBytes(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n (\n uint256 itemOffset,\n uint256 itemLength,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.DATA_ITEM,\n \"Invalid RLP bytes value.\"\n );\n\n return _copy(_in.ptr, itemOffset, itemLength);\n }\n\n /**\n * Reads an RLP bytes value into bytes.\n * @param _in RLP bytes value.\n * @return Decoded bytes.\n */\n function readBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return readBytes(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP string value into a string.\n * @param _in RLP string value.\n * @return Decoded string.\n */\n function readString(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n string memory\n )\n {\n return string(readBytes(_in));\n }\n\n /**\n * Reads an RLP string value into a string.\n * @param _in RLP string value.\n * @return Decoded string.\n */\n function readString(\n bytes memory _in\n )\n internal\n pure\n returns (\n string memory\n )\n {\n return readString(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bytes32 value into a bytes32.\n * @param _in RLP bytes32 value.\n * @return Decoded bytes32.\n */\n function readBytes32(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n require(\n _in.length <= 33,\n \"Invalid RLP bytes32 value.\"\n );\n\n (\n uint256 itemOffset,\n uint256 itemLength,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.DATA_ITEM,\n \"Invalid RLP bytes32 value.\"\n );\n\n uint256 ptr = _in.ptr + itemOffset;\n bytes32 out;\n assembly {\n out := mload(ptr)\n\n // Shift the bytes over to match the item size.\n if lt(itemLength, 32) {\n out := div(out, exp(256, sub(32, itemLength)))\n }\n }\n\n return out;\n }\n\n /**\n * Reads an RLP bytes32 value into a bytes32.\n * @param _in RLP bytes32 value.\n * @return Decoded bytes32.\n */\n function readBytes32(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return readBytes32(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP uint256 value into a uint256.\n * @param _in RLP uint256 value.\n * @return Decoded uint256.\n */\n function readUint256(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n uint256\n )\n {\n return uint256(readBytes32(_in));\n }\n\n /**\n * Reads an RLP uint256 value into a uint256.\n * @param _in RLP uint256 value.\n * @return Decoded uint256.\n */\n function readUint256(\n bytes memory _in\n )\n internal\n pure\n returns (\n uint256\n )\n {\n return readUint256(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bool value into a bool.\n * @param _in RLP bool value.\n * @return Decoded bool.\n */\n function readBool(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n require(\n _in.length == 1,\n \"Invalid RLP boolean value.\"\n );\n\n uint256 ptr = _in.ptr;\n uint256 out;\n assembly {\n out := byte(0, mload(ptr))\n }\n\n return out != 0;\n }\n\n /**\n * Reads an RLP bool value into a bool.\n * @param _in RLP bool value.\n * @return Decoded bool.\n */\n function readBool(\n bytes memory _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return readBool(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP address value into a address.\n * @param _in RLP address value.\n * @return Decoded address.\n */\n function readAddress(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n address\n )\n {\n if (_in.length == 1) {\n return address(0);\n }\n\n require(\n _in.length == 21,\n \"Invalid RLP address value.\"\n );\n\n return address(readUint256(_in));\n }\n\n /**\n * Reads an RLP address value into a address.\n * @param _in RLP address value.\n * @return Decoded address.\n */\n function readAddress(\n bytes memory _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return readAddress(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads the raw bytes of an RLP item.\n * @param _in RLP item to read.\n * @return Raw RLP bytes.\n */\n function readRawBytes(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return _copy(_in);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Decodes the length of an RLP item.\n * @param _in RLP item to decode.\n * @return Offset of the encoded data.\n * @return Length of the encoded data.\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\n */\n function _decodeLength(\n RLPItem memory _in\n )\n private\n pure\n returns (\n uint256,\n uint256,\n RLPItemType\n )\n {\n require(\n _in.length > 0,\n \"RLP item cannot be null.\"\n );\n\n uint256 ptr = _in.ptr;\n uint256 prefix;\n assembly {\n prefix := byte(0, mload(ptr))\n }\n\n if (prefix <= 0x7f) {\n // Single byte.\n\n return (0, 1, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xb7) {\n // Short string.\n\n uint256 strLen = prefix - 0x80;\n \n require(\n _in.length > strLen,\n \"Invalid RLP short string.\"\n );\n\n return (1, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xbf) {\n // Long string.\n uint256 lenOfStrLen = prefix - 0xb7;\n\n require(\n _in.length > lenOfStrLen,\n \"Invalid RLP long string length.\"\n );\n\n uint256 strLen;\n assembly {\n // Pick out the string length.\n strLen := div(\n mload(add(ptr, 1)),\n exp(256, sub(32, lenOfStrLen))\n )\n }\n\n require(\n _in.length > lenOfStrLen + strLen,\n \"Invalid RLP long string.\"\n );\n\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xf7) {\n // Short list.\n uint256 listLen = prefix - 0xc0;\n\n require(\n _in.length > listLen,\n \"Invalid RLP short list.\"\n );\n\n return (1, listLen, RLPItemType.LIST_ITEM);\n } else {\n // Long list.\n uint256 lenOfListLen = prefix - 0xf7;\n\n require(\n _in.length > lenOfListLen,\n \"Invalid RLP long list length.\"\n );\n\n uint256 listLen;\n assembly {\n // Pick out the list length.\n listLen := div(\n mload(add(ptr, 1)),\n exp(256, sub(32, lenOfListLen))\n )\n }\n\n require(\n _in.length > lenOfListLen + listLen,\n \"Invalid RLP long list.\"\n );\n\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\n }\n }\n\n /**\n * Copies the bytes from a memory location.\n * @param _src Pointer to the location to read from.\n * @param _offset Offset to start reading from.\n * @param _length Number of bytes to read.\n * @return Copied bytes.\n */\n function _copy(\n uint256 _src,\n uint256 _offset,\n uint256 _length\n )\n private\n pure\n returns (\n bytes memory\n )\n {\n bytes memory out = new bytes(_length);\n if (out.length == 0) {\n return out;\n }\n\n uint256 src = _src + _offset;\n uint256 dest;\n assembly {\n dest := add(out, 32)\n }\n\n // Copy over as many complete words as we can.\n for (uint256 i = 0; i < _length / 32; i++) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += 32;\n dest += 32;\n }\n\n // Pick out the remaining bytes.\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\n assembly {\n mstore(\n dest,\n or(\n and(mload(src), not(mask)),\n and(mload(dest), mask)\n )\n )\n }\n\n return out;\n }\n\n /**\n * Copies an RLP item into bytes.\n * @param _in RLP item to copy.\n * @return Copied bytes.\n */\n function _copy(\n RLPItem memory _in\n )\n private\n pure\n returns (\n bytes memory\n )\n {\n return _copy(_in.ptr, 0, _in.length);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\n\n/**\n * @title Lib_RLPWriter\n * @author Bakaoh (with modifications)\n */\nlibrary Lib_RLPWriter {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * RLP encodes a byte string.\n * @param _in The byte string to encode.\n * @return _out The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\n }\n\n return encoded;\n }\n\n /**\n * RLP encodes a list of RLP encoded byte byte strings.\n * @param _in The list of RLP encoded byte strings.\n * @return _out The RLP encoded list of items in bytes.\n */\n function writeList(\n bytes[] memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory list = _flatten(_in);\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return _out The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return _out The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a uint.\n * @param _in The uint256 to encode.\n * @return _out The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return _out The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory encoded = new bytes(1);\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\n return encoded;\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\n * @param _len The length of the string or the payload.\n * @param _offset 128 if item is string, 192 if item is list.\n * @return _encoded RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory _encoded\n )\n {\n bytes memory encoded;\n\n if (_len < 56) {\n encoded = new bytes(1);\n encoded[0] = byte(uint8(_len) + uint8(_offset));\n } else {\n uint256 lenLen;\n uint256 i = 1;\n while (_len / i != 0) {\n lenLen++;\n i *= 256;\n }\n\n encoded = new bytes(lenLen + 1);\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\n for(i = 1; i <= lenLen; i++) {\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\n }\n }\n\n return encoded;\n }\n\n /**\n * Encode integer in big endian binary form with no leading zeroes.\n * @notice TODO: This should be optimized with assembly to save gas costs.\n * @param _x The integer to encode.\n * @return _binary RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory _binary\n )\n {\n bytes memory b = abi.encodePacked(_x);\n\n uint256 i = 0;\n for (; i < 32; i++) {\n if (b[i] != 0) {\n break;\n }\n }\n\n bytes memory res = new bytes(32 - i);\n for (uint256 j = 0; j < res.length; j++) {\n res[j] = b[i++];\n }\n\n return res;\n }\n\n /**\n * Copies a piece of memory to another location.\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\n * @param _dest Destination location.\n * @param _src Source location.\n * @param _len Length of memory to copy.\n */\n function _memcpy(\n uint256 _dest,\n uint256 _src,\n uint256 _len\n )\n private\n pure\n {\n uint256 dest = _dest;\n uint256 src = _src;\n uint256 len = _len;\n\n for(; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n uint256 mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n /**\n * Flattens a list of byte strings into one byte string.\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\n * @param _list List of byte strings to flatten.\n * @return _flattened The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory _flattened\n )\n {\n if (_list.length == 0) {\n return new bytes(0);\n }\n\n uint256 len;\n uint256 i = 0;\n for (; i < _list.length; i++) {\n len += _list[i].length;\n }\n\n bytes memory flattened = new bytes(len);\n uint256 flattenedPtr;\n assembly { flattenedPtr := add(flattened, 0x20) }\n\n for(i = 0; i < _list.length; i++) {\n bytes memory item = _list[i];\n\n uint256 listPtr;\n assembly { listPtr := add(item, 0x20)}\n\n _memcpy(flattenedPtr, listPtr, item.length);\n flattenedPtr += _list[i].length;\n }\n\n return flattened;\n }\n}" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_BytesUtils\n */\nlibrary Lib_BytesUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n function concat(\n bytes memory _preBytes,\n bytes memory _postBytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory tempBytes;\n\n assembly {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // Store the length of the first bytes array at the beginning of\n // the memory for tempBytes.\n let length := mload(_preBytes)\n mstore(tempBytes, length)\n\n // Maintain a memory counter for the current write location in the\n // temp bytes array by adding the 32 bytes for the array length to\n // the starting location.\n let mc := add(tempBytes, 0x20)\n // Stop copying when the memory counter reaches the length of the\n // first bytes array.\n let end := add(mc, length)\n\n for {\n // Initialize a copy counter to the start of the _preBytes data,\n // 32 bytes into its memory.\n let cc := add(_preBytes, 0x20)\n } lt(mc, end) {\n // Increase both counters by 32 bytes each iteration.\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // Write the _preBytes data into the tempBytes memory 32 bytes\n // at a time.\n mstore(mc, mload(cc))\n }\n\n // Add the length of _postBytes to the current length of tempBytes\n // and store it as the new length in the first 32 bytes of the\n // tempBytes memory.\n length := mload(_postBytes)\n mstore(tempBytes, add(length, mload(tempBytes)))\n\n // Move the memory counter back from a multiple of 0x20 to the\n // actual end of the _preBytes data.\n mc := end\n // Stop copying when the memory counter reaches the new combined\n // length of the arrays.\n end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n // Update the free-memory pointer by padding our last write location\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n // next 32 byte block, then round down to the nearest multiple of\n // 32. If the sum of the length of the two arrays is zero then add\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\n mstore(0x40, and(\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n not(31) // Round down to the nearest 32 bytes.\n ))\n }\n\n return tempBytes;\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (bytes memory)\n {\n require(_length + 31 >= _length, \"slice_overflow\");\n require(_start + _length >= _start, \"slice_overflow\");\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n\n //zero out the 32 bytes slice we are about to return\n //we need to do it because Solidity does not garbage collect\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (bytes memory)\n {\n if (_bytes.length - _start == 0) {\n return bytes('');\n }\n\n return slice(_bytes, _start, _bytes.length - _start);\n }\n\n function toBytes32PadLeft(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes32)\n {\n bytes32 ret;\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\n assembly {\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\n }\n return ret;\n }\n\n function toBytes32(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes32)\n {\n if (_bytes.length < 32) {\n bytes32 ret;\n assembly {\n ret := mload(add(_bytes, 32))\n }\n return ret;\n }\n\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\n }\n\n function toUint256(\n bytes memory _bytes\n )\n internal\n pure\n returns (uint256)\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\n require(_start + 3 >= _start, \"toUint24_overflow\");\n require(_bytes.length >= _start + 3 , \"toUint24_outOfBounds\");\n uint24 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x3), _start))\n }\n\n return tempUint;\n }\n\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\n require(_start + 1 >= _start, \"toUint8_overflow\");\n require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\n uint8 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x1), _start))\n }\n\n return tempUint;\n }\n\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n require(_start + 20 >= _start, \"toAddress_overflow\");\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n\n function toNibbles(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory nibbles = new bytes(_bytes.length * 2);\n\n for (uint256 i = 0; i < _bytes.length; i++) {\n nibbles[i * 2] = _bytes[i] >> 4;\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\n }\n\n return nibbles;\n }\n\n function fromNibbles(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory ret = new bytes(_bytes.length / 2);\n\n for (uint256 i = 0; i < ret.length; i++) {\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\n }\n\n return ret;\n }\n\n function equal(\n bytes memory _bytes,\n bytes memory _other\n )\n internal\n pure\n returns (bool)\n {\n return keccak256(_bytes) == keccak256(_other);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Byte32Utils\n */\nlibrary Lib_Bytes32Utils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool _out\n )\n {\n return _in != 0;\n }\n\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32 _out\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address _out\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32 _out\n )\n {\n return bytes32(uint256(_in));\n }\n\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory out;\n\n assembly {\n // Figure out how many leading zero bytes to remove.\n let shift := 0\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\n shift := add(shift, 1)\n }\n\n // Reserve some space for our output and fix the free memory pointer.\n out := mload(0x40)\n mstore(0x40, add(out, 0x40))\n\n // Shift the value and store it into the output bytes.\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\n\n // Store the new size (with leading zero bytes removed) in the output byte size.\n mstore(out, sub(32, shift))\n }\n\n return out;\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_SafeExecutionManagerWrapper\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \n * code using the standard solidity compiler, by routing all its operations through the Execution \n * Manager.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\nlibrary Lib_SafeExecutionManagerWrapper {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Performs a safe ovmCALL.\n * @param _gasLimit Gas limit for the call.\n * @param _target Address to call.\n * @param _calldata Data to send to the call.\n * @return _success Whether or not the call reverted.\n * @return _returndata Data returned by the call.\n */\n function safeCALL(\n uint256 _gasLimit,\n address _target,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCALL(uint256,address,bytes)\",\n _gasLimit,\n _target,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Performs a safe ovmDELEGATECALL.\n * @param _gasLimit Gas limit for the call.\n * @param _target Address to call.\n * @param _calldata Data to send to the call.\n * @return _success Whether or not the call reverted.\n * @return _returndata Data returned by the call.\n */\n function safeDELEGATECALL(\n uint256 _gasLimit,\n address _target,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmDELEGATECALL(uint256,address,bytes)\",\n _gasLimit,\n _target,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Performs a safe ovmCREATE call.\n * @param _gasLimit Gas limit for the creation.\n * @param _bytecode Code for the new contract.\n * @return _contract Address of the created contract.\n */\n function safeCREATE(\n uint256 _gasLimit,\n bytes memory _bytecode\n )\n internal\n returns (\n address _contract\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n _gasLimit,\n abi.encodeWithSignature(\n \"ovmCREATE(bytes)\",\n _bytecode\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmEXTCODESIZE call.\n * @param _contract Address of the contract to query the size of.\n * @return _EXTCODESIZE Size of the requested contract in bytes.\n */\n function safeEXTCODESIZE(\n address _contract\n )\n internal\n returns (\n uint256 _EXTCODESIZE\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmEXTCODESIZE(address)\",\n _contract\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmCHAINID call.\n * @return _CHAINID Result of calling ovmCHAINID.\n */\n function safeCHAINID()\n internal\n returns (\n uint256 _CHAINID\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCHAINID()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmCALLER call.\n * @return _CALLER Result of calling ovmCALLER.\n */\n function safeCALLER()\n internal\n returns (\n address _CALLER\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCALLER()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmADDRESS call.\n * @return _ADDRESS Result of calling ovmADDRESS.\n */\n function safeADDRESS()\n internal\n returns (\n address _ADDRESS\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmADDRESS()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmGETNONCE call.\n * @return _nonce Result of calling ovmGETNONCE.\n */\n function safeGETNONCE()\n internal\n returns (\n uint256 _nonce\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmGETNONCE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmSETNONCE call.\n * @param _nonce New account nonce.\n */\n function safeSETNONCE(\n uint256 _nonce\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSETNONCE(uint256)\",\n _nonce\n )\n );\n }\n\n /**\n * Performs a safe ovmCREATEEOA call.\n * @param _messageHash Message hash which was signed by EOA\n * @param _v v value of signature (0 or 1)\n * @param _r r value of signature\n * @param _s s value of signature\n */\n function safeCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\",\n _messageHash,\n _v,\n _r,\n _s\n )\n );\n }\n\n /**\n * Performs a safe REVERT.\n * @param _reason String revert reason to pass along with the REVERT.\n */\n function safeREVERT(\n string memory _reason\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmREVERT(bytes)\",\n bytes(_reason)\n )\n );\n }\n\n /**\n * Performs a safe \"require\".\n * @param _condition Boolean condition that must be true or will revert.\n * @param _reason String revert reason to pass along with the REVERT.\n */\n function safeREQUIRE(\n bool _condition,\n string memory _reason\n )\n internal\n {\n if (!_condition) {\n safeREVERT(\n _reason\n );\n }\n }\n\n /**\n * Performs a safe ovmSLOAD call.\n */\n function safeSLOAD(\n bytes32 _key\n )\n internal\n returns (\n bytes32\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSLOAD(bytes32)\",\n _key\n )\n );\n\n return abi.decode(returndata, (bytes32));\n }\n\n /**\n * Performs a safe ovmSSTORE call.\n */\n function safeSSTORE(\n bytes32 _key,\n bytes32 _value\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSSTORE(bytes32,bytes32)\",\n _key,\n _value\n )\n );\n }\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Performs an ovm interaction and the necessary safety checks.\n * @param _gasLimit Gas limit for the interaction.\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\n * @return _returndata Data sent back by the OVM_ExecutionManager.\n */\n function _safeExecutionManagerInteraction(\n uint256 _gasLimit,\n bytes memory _calldata\n )\n private\n returns (\n bytes memory _returndata\n )\n {\n address ovmExecutionManager = msg.sender;\n (\n bool success,\n bytes memory returndata\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\n\n if (success == false) {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n } else if (returndata.length == 1) {\n assembly {\n return(0, 1)\n }\n } else {\n return returndata;\n }\n }\n\n function _safeExecutionManagerInteraction(\n bytes memory _calldata\n )\n private\n returns (\n bytes memory _returndata\n )\n {\n return _safeExecutionManagerInteraction(\n gasleft(),\n _calldata\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\nimport { Lib_SafeMathWrapper } from \"../../libraries/wrappers/Lib_SafeMathWrapper.sol\";\n\n/**\n * @title OVM_ECDSAContractAccount\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \n * providing eth_sign and EIP155 formatted transaction encodings.\n *\n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EOA transaction.\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\n\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\n // recovered address of the user who signed this message. This is how we manage to shim\n // account abstraction even though the user isn't a contract.\n // Need to make sure that the transaction nonce is right and bump it if so.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_ECDSAUtils.recover(\n _transaction,\n isEthSign,\n _v,\n _r,\n _s\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\n \"Signature provided for EOA transaction execution is invalid.\"\n );\n\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\n\n // Need to make sure that the transaction chainId is correct.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\n \"Transaction chainId does not match expected OVM chainId.\"\n );\n\n // Need to make sure that the transaction nonce is right.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // TEMPORARY: Disable gas checks for minnet.\n // // Need to make sure that the gas is sufficient to execute the transaction.\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\n // \"Gas is not sufficient to execute the transaction.\"\n // );\n\n // Transfer fee to relayer.\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\n gasleft(),\n ETH_ERC20_ADDRESS,\n abi.encodeWithSignature(\"transfer(address,uint256)\", relayer, fee)\n );\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n success == true,\n \"Fee was not transferred to relayer.\"\n );\n\n // Contract creations are signalled by sending a transaction to the zero address.\n if (decodedTx.to == address(0)) {\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\n decodedTx.gasLimit,\n decodedTx.data\n );\n\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\n // initialization. Always return `true` for our success value here.\n return (true, abi.encode(created));\n } else {\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\n // cases, but since this is a contract we'd end up bumping the nonce twice.\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\n\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n decodedTx.gasLimit,\n decodedTx.to,\n decodedTx.data\n );\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_ECDSAUtils\n */\nlibrary Lib_ECDSAUtils {\n\n /**************************************\n * Internal Functions: ECDSA Recovery *\n **************************************/\n\n /**\n * Recovers a signed address given a message and signature.\n * @param _message Message that was originally signed.\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _sender Signer address.\n */\n function recover(\n bytes memory _message,\n bool _isEthSignedMessage,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n pure\n returns (\n address _sender\n )\n {\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\n\n return ecrecover(\n messageHash,\n _v + 27,\n _r,\n _s\n );\n }\n\n function getMessageHash(\n bytes memory _message,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (bytes32) {\n if (_isEthSignedMessage) {\n return getEthSignedMessageHash(_message);\n }\n return getNativeMessageHash(_message);\n }\n\n\n /*************************************\n * Private Functions: ECDSA Recovery *\n *************************************/\n\n /**\n * Gets the native message hash (simple keccak256) for a message.\n * @param _message Message to hash.\n * @return _messageHash Native message hash.\n */\n function getNativeMessageHash(\n bytes memory _message\n )\n private\n pure\n returns (\n bytes32 _messageHash\n )\n {\n return keccak256(_message);\n }\n\n /**\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\n * @param _message Message to hash.\n * @return _messageHash Prefixed message hash.\n */\n function getEthSignedMessageHash(\n bytes memory _message\n )\n private\n pure\n returns (\n bytes32 _messageHash\n )\n {\n bytes memory prefix = \"\\x19Ethereum Signed Message:\\n32\";\n bytes32 messageHash = keccak256(_message);\n return keccak256(abi.encodePacked(prefix, messageHash));\n }\n}" + }, + "contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\n// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_SafeExecutionManagerWrapper } from \"./Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title Lib_SafeMathWrapper\n */\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\n\nlibrary Lib_SafeMathWrapper {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal returns (uint256) {\n uint256 c = a + b;\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \"Lib_SafeMathWrapper: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal returns (uint256) {\n return sub(a, b, \"Lib_SafeMathWrapper: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \"Lib_SafeMathWrapper: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal returns (uint256) {\n return div(a, b, \"Lib_SafeMathWrapper: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal returns (uint256) {\n return mod(a, b, \"Lib_SafeMathWrapper: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\n return a % b;\n }\n}" + }, + "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_SafetyChecker } from \"../../iOVM/execution/iOVM_SafetyChecker.sol\";\n\n/* Contract Imports */\nimport { OVM_ECDSAContractAccount } from \"../accounts/OVM_ECDSAContractAccount.sol\";\nimport { OVM_ProxyEOA } from \"../accounts/OVM_ProxyEOA.sol\";\nimport { OVM_DeployerWhitelist } from \"../precompiles/OVM_DeployerWhitelist.sol\";\n\n/**\n * @title OVM_ExecutionManager\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\n * Layer 2.\n * The EM's run() function is the first function called during the execution of any\n * transaction on L2.\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\n * OVM operation, which will read state from the State Manager contract.\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\n * context-dependent operations.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_SafetyChecker internal ovmSafetyChecker;\n iOVM_StateManager internal ovmStateManager;\n\n\n /*******************************\n * Execution Context Variables *\n *******************************/\n\n GasMeterConfig internal gasMeterConfig;\n GlobalContext internal globalContext;\n TransactionContext internal transactionContext;\n MessageContext internal messageContext;\n TransactionRecord internal transactionRecord;\n MessageRecord internal messageRecord;\n\n\n /**************************\n * Gas Metering Constants *\n **************************/\n\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager,\n GasMeterConfig memory _gasMeterConfig,\n GlobalContext memory _globalContext\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\n * @param _cost Desired gas cost for the function after the refund.\n */\n modifier netGasCost(\n uint256 _cost\n ) {\n uint256 gasProvided = gasleft();\n _;\n uint256 gasUsed = gasProvided - gasleft();\n\n // We want to refund everything *except* the specified cost.\n if (_cost < gasUsed) {\n transactionRecord.ovmGasRefund += gasUsed - _cost;\n }\n }\n\n /**\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\n */\n modifier fixedGasDiscount(\n uint256 _discount\n ) {\n uint256 gasProvided = gasleft();\n _;\n uint256 gasUsed = gasProvided - gasleft();\n\n // We want to refund the specified _discount, unless this risks underflow.\n if (_discount < gasUsed) {\n transactionRecord.ovmGasRefund += _discount;\n } else {\n // refund all we can without risking underflow.\n transactionRecord.ovmGasRefund += gasUsed;\n }\n }\n\n /**\n * Makes sure we're not inside a static context.\n */\n modifier notStatic() {\n if (messageContext.isStatic == true) {\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\n }\n _;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n /**\n * Starts the execution of a transaction via the OVM_ExecutionManager.\n * @param _transaction Transaction data to be executed.\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\n */\n function run(\n Lib_OVMCodec.Transaction memory _transaction,\n address _ovmStateManager\n )\n override\n public\n {\n require(transactionContext.ovmNUMBER == 0, \"Only be callable at the start of a transaction\");\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\n // address around in calldata).\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\n\n // Make sure this function can't be called by anyone except the owner of the\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\n // this would make the `run` itself invalid.\n require(\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\n ovmStateManager.isAuthenticated(msg.sender),\n \"Only authenticated addresses in ovmStateManager can call this function\"\n );\n\n // Initialize the execution context, must be initialized before we perform any gas metering\n // or we'll throw a nuisance gas error.\n _initContext(_transaction);\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Check whether we need to start a new epoch, do so if necessary.\n // _checkNeedsNewEpoch(_transaction.timestamp);\n\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\n // reverts for INVALID_STATE_ACCESS.\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return;\n }\n\n // Check gas right before the call to get total gas consumed by OVM transaction.\n uint256 gasProvided = gasleft();\n\n // Run the transaction, make sure to meter the gas usage.\n ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n _transaction.data\n );\n uint256 gasUsed = gasProvided - gasleft();\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\n }\n\n\n /******************************\n * Opcodes: Execution Context *\n ******************************/\n\n /**\n * @notice Overrides CALLER.\n * @return _CALLER Address of the CALLER within the current message context.\n */\n function ovmCALLER()\n override\n public\n view\n returns (\n address _CALLER\n )\n {\n return messageContext.ovmCALLER;\n }\n\n /**\n * @notice Overrides ADDRESS.\n * @return _ADDRESS Active ADDRESS within the current message context.\n */\n function ovmADDRESS()\n override\n public\n view\n returns (\n address _ADDRESS\n )\n {\n return messageContext.ovmADDRESS;\n }\n\n /**\n * @notice Overrides TIMESTAMP.\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\n */\n function ovmTIMESTAMP()\n override\n public\n view\n returns (\n uint256 _TIMESTAMP\n )\n {\n return transactionContext.ovmTIMESTAMP;\n }\n\n /**\n * @notice Overrides NUMBER.\n * @return _NUMBER Value of the NUMBER within the transaction context.\n */\n function ovmNUMBER()\n override\n public\n view\n returns (\n uint256 _NUMBER\n )\n {\n return transactionContext.ovmNUMBER;\n }\n\n /**\n * @notice Overrides GASLIMIT.\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\n */\n function ovmGASLIMIT()\n override\n public\n view\n returns (\n uint256 _GASLIMIT\n )\n {\n return transactionContext.ovmGASLIMIT;\n }\n\n /**\n * @notice Overrides CHAINID.\n * @return _CHAINID Value of the chain's CHAINID within the global context.\n */\n function ovmCHAINID()\n override\n public\n view\n returns (\n uint256 _CHAINID\n )\n {\n return globalContext.ovmCHAINID;\n }\n\n /*********************************\n * Opcodes: L2 Execution Context *\n *********************************/\n\n /**\n * @notice Specifies from which L1 rollup queue this transaction originated from.\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n public\n view\n returns (\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n {\n return transactionContext.ovmL1QUEUEORIGIN;\n }\n\n /**\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\n */\n function ovmL1TXORIGIN()\n override\n public\n view\n returns (\n address _l1TxOrigin\n )\n {\n return transactionContext.ovmL1TXORIGIN;\n }\n\n /********************\n * Opcodes: Halting *\n ********************/\n\n /**\n * @notice Overrides REVERT.\n * @param _data Bytes data to pass along with the REVERT.\n */\n function ovmREVERT(\n bytes memory _data\n )\n override\n public\n {\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\n }\n\n\n /******************************\n * Opcodes: Contract Creation *\n ******************************/\n\n /**\n * @notice Overrides CREATE.\n * @param _bytecode Code to be used to CREATE a new contract.\n * @return _contract Address of the created contract.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address _contract\n )\n {\n // Creator is always the current ADDRESS.\n address creator = ovmADDRESS();\n\n // Check that the deployer is whitelisted, or\n // that arbitrary contract deployment has been enabled.\n _checkDeployerAllowed(creator);\n\n // Generate the correct CREATE address.\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\n creator,\n _getAccountNonce(creator)\n );\n\n return _createContract(\n contractAddress,\n _bytecode\n );\n }\n\n /**\n * @notice Overrides CREATE2.\n * @param _bytecode Code to be used to CREATE2 a new contract.\n * @param _salt Value used to determine the contract's address.\n * @return _contract Address of the created contract.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address _contract\n )\n {\n // Creator is always the current ADDRESS.\n address creator = ovmADDRESS();\n\n // Check that the deployer is whitelisted, or\n // that arbitrary contract deployment has been enabled.\n _checkDeployerAllowed(creator);\n\n // Generate the correct CREATE2 address.\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\n creator,\n _bytecode,\n _salt\n );\n\n return _createContract(\n contractAddress,\n _bytecode\n );\n }\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n /**\n * Retrieves the nonce of the current ovmADDRESS.\n * @return _nonce Nonce of the current contract.\n */\n function ovmGETNONCE()\n override\n public\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Sets the nonce of the current ovmADDRESS.\n * @param _nonce New nonce for the current contract.\n */\n function ovmSETNONCE(\n uint256 _nonce\n )\n override\n public\n notStatic\n {\n _setAccountNonce(ovmADDRESS(), _nonce);\n }\n\n /**\n * Creates a new EOA contract account, for account abstraction.\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\n * because the contract we're creating is trusted (no need to do safety checking or to\n * handle unexpected reverts). Doesn't need to return an address because the address is\n * assumed to be the user's actual address.\n * @param _messageHash Hash of a message signed by some user, for verification.\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n */\n function ovmCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n notStatic\n {\n // Recover the EOA address from the message hash and signature parameters. Since we do the\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\n // function were to return the wrong address (rather than explicitly returning the zero\n // address), the rest of the transaction would simply fail (since there's no EOA account to\n // actually execute the transaction).\n address eoa = ecrecover(\n _messageHash,\n _v + 27,\n _r,\n _s\n );\n\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\n // have this function return a `success` boolean, but this is just easier.\n if (eoa == address(0)) {\n ovmREVERT(bytes(\"Signature provided for EOA contract creation is invalid.\"));\n }\n\n // If the user already has an EOA account, then there's no need to perform this operation.\n if (_hasEmptyAccount(eoa) == false) {\n return;\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(eoa);\n\n // Temporarily set the current address so it's easier to access on L2.\n address prevADDRESS = messageContext.ovmADDRESS;\n messageContext.ovmADDRESS = eoa;\n\n // Now actually create the account and get its bytecode. We're not worried about reverts\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\n\n // Reset the address now that we're done deploying.\n messageContext.ovmADDRESS = prevADDRESS;\n\n // Commit the account with its final values.\n _commitPendingAccount(\n eoa,\n address(proxyEOA),\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\n );\n\n _setAccountNonce(eoa, 0);\n }\n\n\n /*********************************\n * Opcodes: Contract Interaction *\n *********************************/\n\n /**\n * @notice Overrides CALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmCALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(100000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // CALL updates the CALLER and ADDRESS.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n /**\n * @notice Overrides STATICCALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmSTATICCALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(80000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n nextMessageContext.isStatic = true;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n /**\n * @notice Overrides DELEGATECALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmDELEGATECALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(40000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // DELEGATECALL does not change anything about the message context.\n MessageContext memory nextMessageContext = messageContext;\n bool isStaticEntrypoint = false;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n\n /************************************\n * Opcodes: Contract Storage Access *\n ************************************/\n\n /**\n * @notice Overrides SLOAD.\n * @param _key 32 byte key of the storage slot to load.\n * @return _value 32 byte value of the requested storage slot.\n */\n function ovmSLOAD(\n bytes32 _key\n )\n override\n public\n netGasCost(40000)\n returns (\n bytes32 _value\n )\n {\n // We always SLOAD from the storage of ADDRESS.\n address contractAddress = ovmADDRESS();\n\n return _getContractStorage(\n contractAddress,\n _key\n );\n }\n\n /**\n * @notice Overrides SSTORE.\n * @param _key 32 byte key of the storage slot to set.\n * @param _value 32 byte value for the storage slot.\n */\n function ovmSSTORE(\n bytes32 _key,\n bytes32 _value\n )\n override\n public\n notStatic\n netGasCost(60000)\n {\n // We always SSTORE to the storage of ADDRESS.\n address contractAddress = ovmADDRESS();\n\n _putContractStorage(\n contractAddress,\n _key,\n _value\n );\n }\n\n\n /*********************************\n * Opcodes: Contract Code Access *\n *********************************/\n\n /**\n * @notice Overrides EXTCODECOPY.\n * @param _contract Address of the contract to copy code from.\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\n * @param _length Total number of bytes to copy from the contract's code.\n * @return _code Bytes of code copied from the requested contract.\n */\n function ovmEXTCODECOPY(\n address _contract,\n uint256 _offset,\n uint256 _length\n )\n override\n public\n returns (\n bytes memory _code\n )\n {\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\n // return data. By blocking reads of one byte, we're able to use the condition that an\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\n // an error without an explicit revert. If users were able to read a single byte, they\n // could forcibly trigger behavior that should only be available to this contract.\n uint256 length = _length == 1 ? 2 : _length;\n\n return Lib_EthUtils.getCode(\n _getAccountEthAddress(_contract),\n _offset,\n length\n );\n }\n\n /**\n * @notice Overrides EXTCODESIZE.\n * @param _contract Address of the contract to query the size of.\n * @return _EXTCODESIZE Size of the requested contract in bytes.\n */\n function ovmEXTCODESIZE(\n address _contract\n )\n override\n public\n returns (\n uint256 _EXTCODESIZE\n )\n {\n return Lib_EthUtils.getCodeSize(\n _getAccountEthAddress(_contract)\n );\n }\n\n /**\n * @notice Overrides EXTCODEHASH.\n * @param _contract Address of the contract to query the hash of.\n * @return _EXTCODEHASH Hash of the requested contract.\n */\n function ovmEXTCODEHASH(\n address _contract\n )\n override\n public\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\n );\n }\n\n\n /**************************************\n * Public Functions: Execution Safety *\n **************************************/\n\n /**\n * Performs the logic to create a contract and revert under various potential conditions.\n * @dev This function is implemented as `public` because we need to be able to revert a\n * contract creation without losing information about exactly *why* the contract reverted.\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\n * flag and then revert to reset the flag. We're able to do this by making an external\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\n * information before reverting.\n * @param _address Address of the contract to associate with the one being created.\n * @param _bytecode Code to be used to create the new contract.\n */\n function safeCREATE(\n address _address,\n bytes memory _bytecode\n )\n override\n public\n {\n // Since this function is public, anyone can attempt to directly call it. We need to make\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\n // call this function.\n if (msg.sender != address(this)) {\n return;\n }\n\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\n // some existing contract. On L1, users will prove that no contract exists at the address\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\n // value that represents \"known to be an empty account.\"\n if (_hasEmptyAccount(_address) == false) {\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\n // complexity because we need to ensure that contract creation *never* reverts by itself.\n // We cover this partially by storing a revert flag and returning (instead of reverting)\n // when we know that we're inside a contract's creation code.\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\n\n // Contract creation returns the zero address when it fails, which should only be possible\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\n // explicitly handle this case here.\n if (ethAddress == address(0)) {\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\n }\n\n // Here we pull out the revert flag that would've been set during creation code. Now that\n // we're out of creation code again, we can just revert normally while passing the flag\n // through the revert data.\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\n _revertWithFlag(messageRecord.revertFlag);\n }\n\n // Again simply checking that the deployed code is safe too. Contracts can generate\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\n }\n\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\n // associating the desired address with the newly created contract's code hash and address.\n _commitPendingAccount(\n _address,\n ethAddress,\n Lib_EthUtils.getCodeHash(ethAddress)\n );\n }\n\n\n /***************************************\n * Public Functions: Execution Context *\n ***************************************/\n\n function getMaxTransactionGasLimit()\n external\n view\n override\n returns (\n uint256 _maxTransactionGasLimit\n )\n {\n return gasMeterConfig.maxTransactionGasLimit;\n }\n\n /********************************************\n * Public Functions: Deployment Witelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\n * @param _deployerAddress Address attempting to deploy a contract.\n */\n function _checkDeployerAllowed(\n address _deployerAddress\n )\n internal\n {\n // From an OVM semanitcs perspectibe, this will appear the identical to\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\n (bool success, bytes memory data) = ovmCALL(\n gasleft(),\n 0x4200000000000000000000000000000000000002,\n abi.encodeWithSignature(\"isDeployerAllowed(address)\", _deployerAddress)\n );\n bool isAllowed = abi.decode(data, (bool));\n\n if (!isAllowed || !success) {\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\n }\n }\n\n /********************************************\n * Internal Functions: Contract Interaction *\n ********************************************/\n\n /**\n * Creates a new contract and associates it with some contract address.\n * @param _contractAddress Address to associate the created contract with.\n * @param _bytecode Bytecode to be used to create the contract.\n * @return _created Final OVM contract address.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode\n )\n internal\n returns (\n address _created\n )\n {\n // We always update the nonce of the creating account, even if the creation fails.\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\n\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _contractAddress;\n\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\n // `safeCREATE` reverts.\n (bool _success, ) = _handleExternalInteraction(\n nextMessageContext,\n gasleft(),\n address(this),\n abi.encodeWithSignature(\n \"safeCREATE(address,bytes)\",\n _contractAddress,\n _bytecode\n )\n );\n\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\n // some parent EVM message.\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return _success ? _contractAddress : address(0);\n }\n\n /**\n * Calls the deployed contract associated with a given address.\n * @param _nextMessageContext Message context to be used for the call.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _contract OVM address to be called.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function _callContract(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _contract,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\n if (\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\n ) {\n return (true, hex'');\n }\n\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\n address codeContractAddress =\n uint(_contract) < 100\n ? _contract\n : _getAccountEthAddress(_contract);\n\n return _handleExternalInteraction(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata\n );\n }\n\n /**\n * Handles the logic of making an external call and parsing revert information.\n * @param _nextMessageContext Message context to be used for the call.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _target Address of the contract to call.\n * @param _data Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function _handleExternalInteraction(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _target,\n bytes memory _data\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // We need to switch over to our next message context for the duration of this call.\n MessageContext memory prevMessageContext = messageContext;\n _switchMessageContext(prevMessageContext, _nextMessageContext);\n\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\n // factor.\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\n\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\n // behavior can be controlled. In particular, we enforce that flags are passed through\n // revert data as to retrieve execution metadata that would normally be reverted out of\n // existence.\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\n\n // Switch back to the original message context now that we're out of the call.\n _switchMessageContext(_nextMessageContext, prevMessageContext);\n\n // Assuming there were no reverts, the message record should be accurate here. We'll update\n // this value in the case of a revert.\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\n\n // Reverts at this point are completely OK, but we need to make a few updates based on the\n // information passed through the revert.\n if (success == false) {\n (\n RevertFlag flag,\n uint256 nuisanceGasLeftPostRevert,\n uint256 ovmGasRefund,\n bytes memory returndataFromFlag\n ) = _decodeRevertData(returndata);\n\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\n // halt any further transaction execution that could impact the execution result.\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\n _revertWithFlag(flag);\n }\n\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\n // is to record the gas refund reported by the call (enforced by safety checking).\n if (\n flag == RevertFlag.INTENTIONAL_REVERT\n || flag == RevertFlag.UNSAFE_BYTECODE\n || flag == RevertFlag.STATIC_VIOLATION\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\n ) {\n transactionRecord.ovmGasRefund = ovmGasRefund;\n }\n\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\n // flag, *not* the full encoded flag. All other revert types return no data.\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\n returndata = returndataFromFlag;\n } else {\n returndata = hex'';\n }\n\n // Reverts mean we need to use up whatever \"nuisance gas\" was used by the call.\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\n // to zero. OUT_OF_GAS is a \"pseudo\" flag given that messages return no data when they\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\n // will simply pass up the remaining nuisance gas.\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\n }\n\n // We need to reset the nuisance gas back to its original value minus the amount used here.\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\n\n return (\n success,\n returndata\n );\n }\n\n\n /******************************************\n * Internal Functions: State Manipulation *\n ******************************************/\n\n /**\n * Checks whether an account exists within the OVM_StateManager.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the account exists.\n */\n function _hasAccount(\n address _address\n )\n internal\n returns (\n bool _exists\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.hasAccount(_address);\n }\n\n /**\n * Checks whether a known empty account exists within the OVM_StateManager.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the account empty exists.\n */\n function _hasEmptyAccount(\n address _address\n )\n internal\n returns (\n bool _exists\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.hasEmptyAccount(_address);\n }\n\n /**\n * Sets the nonce of an account.\n * @param _address Address of the account to modify.\n * @param _nonce New account nonce.\n */\n function _setAccountNonce(\n address _address,\n uint256 _nonce\n )\n internal\n {\n _checkAccountChange(_address);\n ovmStateManager.setAccountNonce(_address, _nonce);\n }\n\n /**\n * Gets the nonce of an account.\n * @param _address Address of the account to access.\n * @return _nonce Nonce of the account.\n */\n function _getAccountNonce(\n address _address\n )\n internal\n returns (\n uint256 _nonce\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.getAccountNonce(_address);\n }\n\n /**\n * Retrieves the Ethereum address of an account.\n * @param _address Address of the account to access.\n * @return _ethAddress Corresponding Ethereum address.\n */\n function _getAccountEthAddress(\n address _address\n )\n internal\n returns (\n address _ethAddress\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.getAccountEthAddress(_address);\n }\n\n /**\n * Creates the default account object for the given address.\n * @param _address Address of the account create.\n */\n function _initPendingAccount(\n address _address\n )\n internal\n {\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\n // actually consider an account \"changed\" until it's inserted into the state (in this case\n // by `_commitPendingAccount`).\n _checkAccountLoad(_address);\n ovmStateManager.initPendingAccount(_address);\n }\n\n /**\n * Stores additional relevant data for a new account, thereby \"committing\" it to the state.\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\n * creation.\n * @param _address Address of the account to commit.\n * @param _ethAddress Address of the associated deployed contract.\n * @param _codeHash Hash of the code stored at the address.\n */\n function _commitPendingAccount(\n address _address,\n address _ethAddress,\n bytes32 _codeHash\n )\n internal\n {\n _checkAccountChange(_address);\n ovmStateManager.commitPendingAccount(\n _address,\n _ethAddress,\n _codeHash\n );\n }\n\n /**\n * Retrieves the value of a storage slot.\n * @param _contract Address of the contract to query.\n * @param _key 32 byte key of the storage slot.\n * @return _value 32 byte storage slot value.\n */\n function _getContractStorage(\n address _contract,\n bytes32 _key\n )\n internal\n returns (\n bytes32 _value\n )\n {\n _checkContractStorageLoad(_contract, _key);\n return ovmStateManager.getContractStorage(_contract, _key);\n }\n\n /**\n * Sets the value of a storage slot.\n * @param _contract Address of the contract to modify.\n * @param _key 32 byte key of the storage slot.\n * @param _value 32 byte storage slot value.\n */\n function _putContractStorage(\n address _contract,\n bytes32 _key,\n bytes32 _value\n )\n internal\n {\n // We don't set storage if the value didn't change. Although this acts as a convenient\n // optimization, it's also necessary to avoid the case in which a contract with no storage\n // attempts to store the value \"0\" at any key. Putting this value (and therefore requiring\n // that the value be committed into the storage trie after execution) would incorrectly\n // modify the storage root.\n if (_getContractStorage(_contract, _key) == _value) {\n return;\n }\n\n _checkContractStorageChange(_contract, _key);\n ovmStateManager.putContractStorage(_contract, _key, _value);\n }\n\n /**\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\n * nuisance gas if the account hasn't been loaded before.\n * @param _address Address of the account to load.\n */\n function _checkAccountLoad(\n address _address\n )\n internal\n {\n // See `_checkContractStorageLoad` for more information.\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // See `_checkContractStorageLoad` for more information.\n if (ovmStateManager.hasAccount(_address) == false) {\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\n }\n\n // Check whether the account has been loaded before and mark it as loaded if not. We need\n // this because \"nuisance gas\" only applies to the first time that an account is loaded.\n (\n bool _wasAccountAlreadyLoaded\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\n\n // If we hadn't already loaded the account, then we'll need to charge \"nuisance gas\" based\n // on the size of the contract code.\n if (_wasAccountAlreadyLoaded == false) {\n _useNuisanceGas(\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\n );\n }\n }\n\n /**\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\n * nuisance gas if the account hasn't been changed before.\n * @param _address Address of the account to change.\n */\n function _checkAccountChange(\n address _address\n )\n internal\n {\n // Start by checking for a load as we only want to charge nuisance gas proportional to\n // contract size once.\n _checkAccountLoad(_address);\n\n // Check whether the account has been changed before and mark it as changed if not. We need\n // this because \"nuisance gas\" only applies to the first time that an account is changed.\n (\n bool _wasAccountAlreadyChanged\n ) = ovmStateManager.testAndSetAccountChanged(_address);\n\n // If we hadn't already loaded the account, then we'll need to charge \"nuisance gas\" based\n // on the size of the contract code.\n if (_wasAccountAlreadyChanged == false) {\n ovmStateManager.incrementTotalUncommittedAccounts();\n _useNuisanceGas(\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\n );\n }\n }\n\n /**\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\n * nuisance gas if the slot hasn't been loaded before.\n * @param _contract Address of the account to load from.\n * @param _key 32 byte key to load.\n */\n function _checkContractStorageLoad(\n address _contract,\n bytes32 _key\n )\n internal\n {\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\n // on L1 but not on L2. A contract could use this behavior to prevent the\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\n // allows us to also charge for the full message nuisance gas, because you deserve that for\n // trying to break the contract in this way.\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // We need to make sure that the transaction isn't trying to access storage that hasn't\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\n // We know that we have enough gas to do this check because of the above test.\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\n }\n\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\n // this because \"nuisance gas\" only applies to the first time that a slot is loaded.\n (\n bool _wasContractStorageAlreadyLoaded\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\n\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\n // \"nuisance gas\".\n if (_wasContractStorageAlreadyLoaded == false) {\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\n }\n }\n\n /**\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\n * nuisance gas if the slot hasn't been changed before.\n * @param _contract Address of the account to change.\n * @param _key 32 byte key to change.\n */\n function _checkContractStorageChange(\n address _contract,\n bytes32 _key\n )\n internal\n {\n // Start by checking for load to make sure we have the storage slot and that we charge the\n // \"nuisance gas\" necessary to prove the storage slot state.\n _checkContractStorageLoad(_contract, _key);\n\n // Check whether the slot has been changed before and mark it as changed if not. We need\n // this because \"nuisance gas\" only applies to the first time that a slot is changed.\n (\n bool _wasContractStorageAlreadyChanged\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\n\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\n // \"nuisance gas\".\n if (_wasContractStorageAlreadyChanged == false) {\n // Changing a storage slot means that we're also going to have to change the\n // corresponding account, so do an account change check.\n _checkAccountChange(_contract);\n\n ovmStateManager.incrementTotalUncommittedContractStorage();\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\n }\n }\n\n\n /************************************\n * Internal Functions: Revert Logic *\n ************************************/\n\n /**\n * Simple encoding for revert data.\n * @param _flag Flag to revert with.\n * @param _data Additional user-provided revert data.\n * @return _revertdata Encoded revert data.\n */\n function _encodeRevertData(\n RevertFlag _flag,\n bytes memory _data\n )\n internal\n view\n returns (\n bytes memory _revertdata\n )\n {\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\n if (\n _flag == RevertFlag.OUT_OF_GAS\n || _flag == RevertFlag.CREATE_EXCEPTION\n ) {\n return bytes('');\n }\n\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\n return abi.encode(\n _flag,\n 0,\n 0,\n bytes('')\n );\n }\n\n // Just ABI encode the rest of the parameters.\n return abi.encode(\n _flag,\n messageRecord.nuisanceGasLeft,\n transactionRecord.ovmGasRefund,\n _data\n );\n }\n\n /**\n * Simple decoding for revert data.\n * @param _revertdata Revert data to decode.\n * @return _flag Flag used to revert.\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\n * @return _ovmGasRefund Amount of gas refunded during the message.\n * @return _data Additional user-provided revert data.\n */\n function _decodeRevertData(\n bytes memory _revertdata\n )\n internal\n pure\n returns (\n RevertFlag _flag,\n uint256 _nuisanceGasLeft,\n uint256 _ovmGasRefund,\n bytes memory _data\n )\n {\n // A length of zero means the call ran out of gas, just return empty data.\n if (_revertdata.length == 0) {\n return (\n RevertFlag.OUT_OF_GAS,\n 0,\n 0,\n bytes('')\n );\n }\n\n // ABI decode the incoming data.\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\n }\n\n /**\n * Causes a message to revert or abort.\n * @param _flag Flag to revert with.\n * @param _data Additional user-provided data.\n */\n function _revertWithFlag(\n RevertFlag _flag,\n bytes memory _data\n )\n internal\n {\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\n // thinking there was a failure.\n bool isCreation;\n assembly {\n isCreation := eq(extcodesize(caller()), 0)\n }\n\n if (isCreation) {\n messageRecord.revertFlag = _flag;\n\n assembly {\n return(0, 1)\n }\n }\n\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\n // revert normally.\n bytes memory revertdata = _encodeRevertData(\n _flag,\n _data\n );\n\n assembly {\n revert(add(revertdata, 0x20), mload(revertdata))\n }\n }\n\n /**\n * Causes a message to revert or abort.\n * @param _flag Flag to revert with.\n */\n function _revertWithFlag(\n RevertFlag _flag\n )\n internal\n {\n _revertWithFlag(_flag, bytes(''));\n }\n\n\n /******************************************\n * Internal Functions: Nuisance Gas Logic *\n ******************************************/\n\n /**\n * Computes the nuisance gas limit from the gas limit.\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\n * this implementation is perfectly fine, but we may change this formula later.\n * @param _gasLimit Gas limit to compute from.\n * @return _nuisanceGasLimit Computed nuisance gas limit.\n */\n function _getNuisanceGasLimit(\n uint256 _gasLimit\n )\n internal\n view\n returns (\n uint256 _nuisanceGasLimit\n )\n {\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\n }\n\n /**\n * Uses a certain amount of nuisance gas.\n * @param _amount Amount of nuisance gas to use.\n */\n function _useNuisanceGas(\n uint256 _amount\n )\n internal\n {\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\n // refund to be given at the end of the transaction.\n if (messageRecord.nuisanceGasLeft < _amount) {\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\n }\n\n messageRecord.nuisanceGasLeft -= _amount;\n }\n\n\n /************************************\n * Internal Functions: Gas Metering *\n ************************************/\n\n /**\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\n * @param _timestamp Transaction timestamp.\n */\n function _checkNeedsNewEpoch(\n uint256 _timestamp\n )\n internal\n {\n if (\n _timestamp >= (\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\n + gasMeterConfig.secondsPerEpoch\n )\n ) {\n _putGasMetadata(\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\n _timestamp\n );\n\n _putGasMetadata(\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\n _getGasMetadata(\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\n )\n );\n\n _putGasMetadata(\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\n _getGasMetadata(\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\n )\n );\n }\n }\n\n /**\n * Validates the gas limit for a given transaction.\n * @param _gasLimit Gas limit provided by the transaction.\n * @param _queueOrigin Queue from which the transaction originated.\n * @return _valid Whether or not the gas limit is valid.\n */\n function _isValidGasLimit(\n uint256 _gasLimit,\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n internal\n returns (\n bool _valid\n )\n {\n // Always have to be below the maximum gas limit.\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\n return false;\n }\n\n // Always have to be above the minimum gas limit.\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\n return false;\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\n return true;\n // GasMetadataKey cumulativeGasKey;\n // GasMetadataKey prevEpochGasKey;\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\n // } else {\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\n // }\n\n // return (\n // (\n // _getGasMetadata(cumulativeGasKey)\n // - _getGasMetadata(prevEpochGasKey)\n // + _gasLimit\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\n // );\n }\n\n /**\n * Updates the cumulative gas after a transaction.\n * @param _gasUsed Gas used by the transaction.\n * @param _queueOrigin Queue from which the transaction originated.\n */\n function _updateCumulativeGas(\n uint256 _gasUsed,\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n internal\n {\n GasMetadataKey cumulativeGasKey;\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\n } else {\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\n }\n\n _putGasMetadata(\n cumulativeGasKey,\n (\n _getGasMetadata(cumulativeGasKey)\n + gasMeterConfig.minTransactionGasLimit\n + _gasUsed\n - transactionRecord.ovmGasRefund\n )\n );\n }\n\n /**\n * Retrieves the value of a gas metadata key.\n * @param _key Gas metadata key to retrieve.\n * @return _value Value stored at the given key.\n */\n function _getGasMetadata(\n GasMetadataKey _key\n )\n internal\n returns (\n uint256 _value\n )\n {\n return uint256(_getContractStorage(\n GAS_METADATA_ADDRESS,\n bytes32(uint256(_key))\n ));\n }\n\n /**\n * Sets the value of a gas metadata key.\n * @param _key Gas metadata key to set.\n * @param _value Value to store at the given key.\n */\n function _putGasMetadata(\n GasMetadataKey _key,\n uint256 _value\n )\n internal\n {\n _putContractStorage(\n GAS_METADATA_ADDRESS,\n bytes32(uint256(_key)),\n bytes32(uint256(_value))\n );\n }\n\n\n /*****************************************\n * Internal Functions: Execution Context *\n *****************************************/\n\n /**\n * Swaps over to a new message context.\n * @param _prevMessageContext Context we're switching from.\n * @param _nextMessageContext Context we're switching to.\n */\n function _switchMessageContext(\n MessageContext memory _prevMessageContext,\n MessageContext memory _nextMessageContext\n )\n internal\n {\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\n }\n\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\n }\n\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\n messageContext.isStatic = _nextMessageContext.isStatic;\n }\n }\n\n /**\n * Initializes the execution context.\n * @param _transaction OVM transaction being executed.\n */\n function _initContext(\n Lib_OVMCodec.Transaction memory _transaction\n )\n internal\n {\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\n transactionContext.ovmNUMBER = _transaction.blockNumber;\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\n\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\n }\n\n /**\n * Resets the transaction and message context.\n */\n function _resetContext()\n internal\n {\n transactionContext.ovmL1TXORIGIN = address(0);\n transactionContext.ovmTIMESTAMP = 0;\n transactionContext.ovmNUMBER = 0;\n transactionContext.ovmGASLIMIT = 0;\n transactionContext.ovmTXGASLIMIT = 0;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = 0;\n\n messageContext.ovmCALLER = address(0);\n messageContext.ovmADDRESS = address(0);\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = 0;\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\n }\n\n /*****************************\n * L2-only Helper Functions *\n *****************************/\n\n /**\n * Unreachable helper function for simulating eth_calls with an OVM message context.\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\n * @param _transaction the message transaction to simulate.\n * @param _from the OVM account the simulated call should be from.\n */\n function simulateMessage(\n Lib_OVMCodec.Transaction memory _transaction,\n address _from,\n iOVM_StateManager _ovmStateManager\n )\n external\n returns (\n bool,\n bytes memory\n )\n {\n // Prevent this call from having any effect unless in a custom-set VM frame\n require(msg.sender == address(0));\n\n ovmStateManager = _ovmStateManager;\n _initContext(_transaction);\n\n messageRecord.nuisanceGasLeft = uint(-1);\n messageContext.ovmADDRESS = _transaction.entrypoint;\n messageContext.ovmCALLER = _from;\n\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_AddressResolver\n */\ncontract Lib_AddressResolver {\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n Lib_AddressManager internal libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) public {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address _contract\n )\n {\n return libAddressManager.getAddress(_name);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\nimport { Lib_Bytes32Utils } from \"./Lib_Bytes32Utils.sol\";\n\n/**\n * @title Lib_EthUtils\n */\nlibrary Lib_EthUtils {\n\n /***********************************\n * Internal Functions: Code Access *\n ***********************************/\n\n /**\n * Gets the code for a given address.\n * @param _address Address to get code for.\n * @param _offset Offset to start reading from.\n * @param _length Number of bytes to read.\n * @return _code Code read from the contract.\n */\n function getCode(\n address _address,\n uint256 _offset,\n uint256 _length\n )\n internal\n view\n returns (\n bytes memory _code\n )\n {\n assembly {\n _code := mload(0x40)\n mstore(0x40, add(_code, add(_length, 0x20)))\n mstore(_code, _length)\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\n }\n\n return _code;\n }\n\n /**\n * Gets the full code for a given address.\n * @param _address Address to get code for.\n * @return _code Full code of the contract.\n */\n function getCode(\n address _address\n )\n internal\n view\n returns (\n bytes memory _code\n )\n {\n return getCode(\n _address,\n 0,\n getCodeSize(_address)\n );\n }\n\n /**\n * Gets the size of a contract's code in bytes.\n * @param _address Address to get code size for.\n * @return _codeSize Size of the contract's code in bytes.\n */\n function getCodeSize(\n address _address\n )\n internal\n view\n returns (\n uint256 _codeSize\n )\n {\n assembly {\n _codeSize := extcodesize(_address)\n }\n\n return _codeSize;\n }\n\n /**\n * Gets the hash of a contract's code.\n * @param _address Address to get a code hash for.\n * @return _codeHash Hash of the contract's code.\n */\n function getCodeHash(\n address _address\n )\n internal\n view\n returns (\n bytes32 _codeHash\n )\n {\n assembly {\n _codeHash := extcodehash(_address)\n }\n\n return _codeHash;\n }\n\n\n /*****************************************\n * Internal Functions: Contract Creation *\n *****************************************/\n\n /**\n * Creates a contract with some given initialization code.\n * @param _code Contract initialization code.\n * @return _created Address of the created contract.\n */\n function createContract(\n bytes memory _code\n )\n internal\n returns (\n address _created\n )\n {\n assembly {\n _created := create(\n 0,\n add(_code, 0x20),\n mload(_code)\n )\n }\n\n return _created;\n }\n\n /**\n * Computes the address that would be generated by CREATE.\n * @param _creator Address creating the contract.\n * @param _nonce Creator's nonce.\n * @return _address Address to be generated by CREATE.\n */\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n internal\n pure\n returns (\n address _address\n )\n {\n bytes[] memory encoded = new bytes[](2);\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\n\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\n }\n\n /**\n * Computes the address that would be generated by CREATE2.\n * @param _creator Address creating the contract.\n * @param _bytecode Bytecode of the contract to be created.\n * @param _salt 32 byte salt value mixed into the hash.\n * @return _address Address to be generated by CREATE2.\n */\n function getAddressForCREATE2(\n address _creator,\n bytes memory _bytecode,\n bytes32 _salt\n )\n internal\n pure\n returns (address _address)\n {\n bytes32 hashedData = keccak256(abi.encodePacked(\n byte(0xff),\n _creator,\n _salt,\n keccak256(_bytecode)\n ));\n\n return Lib_Bytes32Utils.toAddress(hashedData);\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\ninterface iOVM_ExecutionManager {\n /**********\n * Enums *\n *********/\n\n enum RevertFlag {\n DID_NOT_REVERT,\n OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\n CREATE_EXCEPTION,\n CREATOR_NOT_ALLOWED\n }\n\n enum GasMetadataKey {\n CURRENT_EPOCH_START_TIMESTAMP,\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\n CUMULATIVE_L1TOL2_QUEUE_GAS,\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\n PREV_EPOCH_L1TOL2_QUEUE_GAS\n }\n\n /***********\n * Structs *\n ***********/\n\n struct GasMeterConfig {\n uint256 minTransactionGasLimit;\n uint256 maxTransactionGasLimit;\n uint256 maxGasPerQueuePerEpoch;\n uint256 secondsPerEpoch;\n }\n\n struct GlobalContext {\n uint256 ovmCHAINID;\n }\n\n struct TransactionContext {\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\n uint256 ovmTIMESTAMP;\n uint256 ovmNUMBER;\n uint256 ovmGASLIMIT;\n uint256 ovmTXGASLIMIT;\n address ovmL1TXORIGIN;\n }\n\n struct TransactionRecord {\n uint256 ovmGasRefund;\n }\n\n struct MessageContext {\n address ovmCALLER;\n address ovmADDRESS;\n bool isStatic;\n }\n\n struct MessageRecord {\n uint256 nuisanceGasLeft;\n RevertFlag revertFlag;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external;\n\n\n /*******************\n * Context Opcodes *\n *******************/\n\n function ovmCALLER() external view returns (address _caller);\n function ovmADDRESS() external view returns (address _address);\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\n function ovmNUMBER() external view returns (uint256 _number);\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\n function ovmCHAINID() external view returns (uint256 _chainId);\n\n\n /**********************\n * L2 Context Opcodes *\n **********************/\n\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\n\n\n /*******************\n * Halting Opcodes *\n *******************/\n\n function ovmREVERT(bytes memory _data) external;\n\n\n /*****************************\n * Contract Creation Opcodes *\n *****************************/\n\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmSETNONCE(uint256 _nonce) external;\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\n\n\n /****************************\n * Contract Calling Opcodes *\n ****************************/\n\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n\n\n /****************************\n * Contract Storage Opcodes *\n ****************************/\n\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\n\n\n /*************************\n * Contract Code Opcodes *\n *************************/\n\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\n\n\n /**************************************\n * Public Functions: Execution Safety *\n **************************************/\n\n function safeCREATE(address _address, bytes memory _bytecode) external;\n\n /***************************************\n * Public Functions: Execution Context *\n ***************************************/\n\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateManager\n */\ninterface iOVM_StateManager {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum ItemState {\n ITEM_UNTOUCHED,\n ITEM_LOADED,\n ITEM_CHANGED,\n ITEM_COMMITTED\n }\n\n /***************************\n * Public Functions: Misc *\n ***************************/\n\n function isAuthenticated(address _address) external view returns (bool);\n\n /***************************\n * Public Functions: Setup *\n ***************************/\n\n function owner() external view returns (address _owner);\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\n function setExecutionManager(address _ovmExecutionManager) external;\n\n\n /************************************\n * Public Functions: Account Access *\n ************************************/\n\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\n function putEmptyAccount(address _address) external;\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\n function hasAccount(address _address) external view returns (bool _exists);\n function hasEmptyAccount(address _address) external view returns (bool _exists);\n function setAccountNonce(address _address, uint256 _nonce) external;\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\n function initPendingAccount(address _address) external;\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\n function incrementTotalUncommittedAccounts() external;\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\n function wasAccountChanged(address _address) external view returns (bool);\n function wasAccountCommitted(address _address) external view returns (bool);\n\n\n /************************************\n * Public Functions: Storage Access *\n ************************************/\n\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\n function incrementTotalUncommittedContractStorage() external;\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_SafetyChecker\n */\ninterface iOVM_SafetyChecker {\n\n /********************\n * Public Functions *\n ********************/\n\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\n}\n" + }, + "contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_ProxyEOA\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \n * 'account abstraction' on layer 2. \n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ProxyEOA {\n\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _implementation\n )\n public\n {\n _setImplementation(_implementation);\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\n gasleft(),\n getImplementation(),\n msg.data\n );\n\n if (success) {\n assembly {\n return(add(returndata, 0x20), mload(returndata))\n }\n } else {\n Lib_SafeExecutionManagerWrapper.safeREVERT(\n string(returndata)\n );\n }\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function upgrade(\n address _implementation\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\n \"EOAs can only upgrade their own EOA implementation\"\n );\n\n _setImplementation(_implementation);\n }\n\n function getImplementation()\n public\n returns (\n address _implementation\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n IMPLEMENTATION_KEY\n )\n )));\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n IMPLEMENTATION_KEY,\n bytes32(uint256(uint160(_implementation)))\n );\n }\n}" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\n\n/* Interface Imports */\nimport { iOVM_DeployerWhitelist } from \"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_DeployerWhitelist\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\n\n\n /**********************\n * Function Modifiers *\n **********************/\n \n /**\n * Blocks functions to anyone except the contract owner.\n */\n modifier onlyOwner() {\n address owner = Lib_Bytes32Utils.toAddress(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n KEY_OWNER\n )\n );\n\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\n \"Function can only be called by the owner of this contract.\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n \n /**\n * Initializes the whitelist.\n * @param _owner Address of the owner for this contract.\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\n */\n function initialize(\n address _owner,\n bool _allowArbitraryDeployment\n )\n override\n public\n {\n bool initialized = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\n );\n\n if (initialized == true) {\n return;\n }\n\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_INITIALIZED,\n Lib_Bytes32Utils.fromBool(true)\n );\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_OWNER,\n Lib_Bytes32Utils.fromAddress(_owner)\n );\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\n );\n }\n\n /**\n * Gets the owner of the whitelist.\n */\n function getOwner()\n override\n public\n returns(\n address\n )\n {\n return Lib_Bytes32Utils.toAddress(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n KEY_OWNER\n )\n );\n }\n\n /**\n * Adds or removes an address from the deployment whitelist.\n * @param _deployer Address to update permissions for.\n * @param _isWhitelisted Whether or not the address is whitelisted.\n */\n function setWhitelistedDeployer(\n address _deployer,\n bool _isWhitelisted\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n Lib_Bytes32Utils.fromAddress(_deployer),\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\n );\n }\n\n /**\n * Updates the owner of this contract.\n * @param _owner Address of the new owner.\n */\n function setOwner(\n address _owner\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_OWNER,\n Lib_Bytes32Utils.fromAddress(_owner)\n );\n }\n\n /**\n * Updates the arbitrary deployment flag.\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\n */\n function setAllowArbitraryDeployment(\n bool _allowArbitraryDeployment\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\n );\n }\n\n /**\n * Permanently enables arbitrary contract deployment and deletes the owner.\n */\n function enableArbitraryContractDeployment()\n override\n public\n onlyOwner\n {\n setAllowArbitraryDeployment(true);\n setOwner(address(0));\n }\n\n /**\n * Checks whether an address is allowed to deploy contracts.\n * @param _deployer Address to check.\n * @return _allowed Whether or not the address can deploy contracts.\n */\n function isDeployerAllowed(\n address _deployer\n )\n override\n public\n returns (\n bool _allowed\n )\n {\n bool initialized = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\n );\n\n if (initialized == false) {\n return true;\n }\n\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\n );\n\n if (allowArbitraryDeployment == true) {\n return true;\n }\n\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n Lib_Bytes32Utils.fromAddress(_deployer)\n )\n );\n\n return isWhitelisted; \n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { Ownable } from \"./Lib_Ownable.sol\";\n\n/**\n * @title Lib_AddressManager\n */\ncontract Lib_AddressManager is Ownable {\n\n /**********\n * Events *\n **********/\n\n event AddressSet(\n string _name,\n address _newAddress\n );\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n function setAddress(\n string memory _name,\n address _address\n )\n public\n onlyOwner\n {\n emit AddressSet(_name, _address);\n addresses[_getNameHash(_name)] = _address;\n }\n\n function getAddress(\n string memory _name\n )\n public\n view\n returns (address)\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Ownable\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\n */\nabstract contract Ownable {\n\n /*************\n * Variables *\n *************/\n\n address public owner;\n\n\n /**********\n * Events *\n **********/\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\n /***************\n * Constructor *\n ***************/\n\n constructor() internal {\n owner = msg.sender;\n emit OwnershipTransferred(address(0), owner);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n owner == msg.sender,\n \"Ownable: caller is not the owner\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function renounceOwnership()\n public\n virtual\n onlyOwner\n {\n emit OwnershipTransferred(owner, address(0));\n owner = address(0);\n }\n\n function transferOwnership(address _newOwner)\n public\n virtual\n onlyOwner\n {\n require(\n _newOwner != address(0),\n \"Ownable: new owner cannot be the zero address\"\n );\n\n emit OwnershipTransferred(owner, _newOwner);\n owner = _newOwner;\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_DeployerWhitelist\n */\ninterface iOVM_DeployerWhitelist {\n\n /********************\n * Public Functions *\n ********************/\n\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\n function getOwner() external returns (address _owner);\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\n function setOwner(address _newOwner) external;\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\n function enableArbitraryContractDeployment() external;\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\n}\n" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_SequencerEntrypoint.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_SequencerEntrypoint\n * @dev The Sequencer Entrypoint is a predeploy which, despite its name, can in fact be called by \n * any account. It accepts a more efficient compressed calldata format, which it decompresses and \n * encodes to the standard EIP155 transaction format.\n * This contract is the implementation referenced by the Proxy Sequencer Entrypoint, thus enabling\n * the Optimism team to upgrade the decompression of calldata from the Sequencer.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerEntrypoint {\n\n /*********\n * Enums *\n *********/\n \n enum TransactionType {\n NATIVE_ETH_TRANSACTION,\n ETH_SIGNED_MESSAGE\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n /**\n * Uses a custom \"compressed\" format to save on calldata gas:\n * calldata[00:01]: transaction type (0 == EIP 155, 2 == Eth Sign Message)\n * calldata[01:33]: signature \"r\" parameter\n * calldata[33:65]: signature \"s\" parameter\n * calldata[65:66]: signature \"v\" parameter\n * calldata[66:69]: transaction gas limit\n * calldata[69:72]: transaction gas price\n * calldata[72:75]: transaction nonce\n * calldata[75:95]: transaction target address\n * calldata[95:XX]: transaction data\n */\n fallback()\n external\n {\n TransactionType transactionType = _getTransactionType(Lib_BytesUtils.toUint8(msg.data, 0));\n\n bytes32 r = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 1, 32));\n bytes32 s = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 33, 32));\n uint8 v = Lib_BytesUtils.toUint8(msg.data, 65);\n\n // Remainder is the transaction to execute.\n bytes memory compressedTx = Lib_BytesUtils.slice(msg.data, 66);\n bool isEthSignedMessage = transactionType == TransactionType.ETH_SIGNED_MESSAGE;\n\n // Need to decompress and then re-encode the transaction based on the original encoding.\n bytes memory encodedTx = Lib_OVMCodec.encodeEIP155Transaction(\n Lib_OVMCodec.decompressEIP155Transaction(compressedTx),\n isEthSignedMessage\n );\n\n address target = Lib_ECDSAUtils.recover(\n encodedTx,\n isEthSignedMessage,\n uint8(v),\n r,\n s\n );\n\n if (Lib_SafeExecutionManagerWrapper.safeEXTCODESIZE(target) == 0) {\n // ProxyEOA has not yet been deployed for this EOA.\n bytes32 messageHash = Lib_ECDSAUtils.getMessageHash(encodedTx, isEthSignedMessage);\n Lib_SafeExecutionManagerWrapper.safeCREATEEOA(messageHash, uint8(v), r, s);\n }\n\n // ProxyEOA has been deployed for this EOA, continue to CALL.\n bytes memory callbytes = abi.encodeWithSignature(\n \"execute(bytes,uint8,uint8,bytes32,bytes32)\",\n encodedTx,\n isEthSignedMessage,\n uint8(v),\n r,\n s\n );\n\n Lib_SafeExecutionManagerWrapper.safeCALL(\n gasleft(),\n target,\n callbytes\n );\n }\n \n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Converts a uint256 into a TransactionType enum.\n * @param _transactionType Transaction type index.\n * @return Transaction type enum value.\n */\n function _getTransactionType(\n uint8 _transactionType\n )\n internal\n returns (\n TransactionType\n )\n {\n if (_transactionType == 0) {\n return TransactionType.NATIVE_ETH_TRANSACTION;\n } if (_transactionType == 2) {\n return TransactionType.ETH_SIGNED_MESSAGE;\n } else {\n Lib_SafeExecutionManagerWrapper.safeREVERT(\n \"Transaction type must be 0 or 2\"\n );\n }\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_ECDSAUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_ECDSAUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\";\n\n/**\n * @title TestLib_ECDSAUtils\n */\ncontract TestLib_ECDSAUtils {\n\n function recover(\n bytes memory _message,\n bool _isEthSignedMessage,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n public\n pure\n returns (\n address _sender\n )\n {\n return Lib_ECDSAUtils.recover(\n _message,\n _isEthSignedMessage,\n _v,\n _r,\n _s\n );\n }\n}\n" + }, + "contracts/test-libraries/codec/TestLib_OVMCodec.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title TestLib_OVMCodec\n */\ncontract TestLib_OVMCodec {\n\n function decodeEIP155Transaction(\n bytes memory _transaction,\n bool _isEthSignedMessage\n )\n public\n pure\n returns (\n Lib_OVMCodec.EIP155Transaction memory _decoded\n )\n {\n return Lib_OVMCodec.decodeEIP155Transaction(_transaction, _isEthSignedMessage);\n }\n\n function encodeTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n public\n pure\n returns (\n bytes memory _encoded\n )\n {\n return Lib_OVMCodec.encodeTransaction(_transaction);\n }\n\n function hashTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n public\n pure\n returns (\n bytes32 _hash\n )\n {\n return Lib_OVMCodec.hashTransaction(_transaction);\n }\n\n function decompressEIP155Transaction(\n bytes memory _transaction\n )\n public\n returns (\n Lib_OVMCodec.EIP155Transaction memory _decompressed\n )\n {\n return Lib_OVMCodec.decompressEIP155Transaction(_transaction);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitioner.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_RLPWriter } from \"../../libraries/rlp/Lib_RLPWriter.sol\";\nimport { Lib_RLPReader } from \"../../libraries/rlp/Lib_RLPReader.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_StateManagerFactory } from \"../../iOVM/execution/iOVM_StateManagerFactory.sol\";\n\n/* Contract Imports */\nimport { Abs_FraudContributor } from \"./Abs_FraudContributor.sol\";\n\n/**\n * @title OVM_StateTransitioner\n * @dev The State Transitioner coordinates the execution of a state transition during the evaluation of a\n * fraud proof. It feeds verified input to the Execution Manager's run(), and controls a State Manager (which is\n * uniquely created for each fraud proof).\n * Once a fraud proof has been initialized, this contract is provided with the pre-state root and verifies\n * that the OVM storage slots committed to the State Mangager are contained in that state\n * This contract controls the State Manager and Execution Manager, and uses them to calculate the\n * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by comparing\n * the calculated post-state root with the proposed post-state root.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum TransitionPhase {\n PRE_EXECUTION,\n POST_EXECUTION,\n COMPLETE\n }\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n iOVM_StateManager public ovmStateManager;\n\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n bytes32 internal preStateRoot;\n bytes32 internal postStateRoot;\n TransitionPhase public phase;\n uint256 internal stateTransitionIndex;\n bytes32 internal transactionHash;\n\n\n /*************\n * Constants *\n *************/\n\n bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n * @param _stateTransitionIndex Index of the state transition being verified.\n * @param _preStateRoot State root before the transition was executed.\n * @param _transactionHash Hash of the executed transaction.\n */\n constructor(\n address _libAddressManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n stateTransitionIndex = _stateTransitionIndex;\n preStateRoot = _preStateRoot;\n postStateRoot = _preStateRoot;\n transactionHash = _transactionHash;\n\n ovmStateManager = iOVM_StateManagerFactory(resolve(\"OVM_StateManagerFactory\")).create(address(this));\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Checks that a function is only run during a specific phase.\n * @param _phase Phase the function must run within.\n */\n modifier onlyDuringPhase(\n TransitionPhase _phase\n ) {\n require(\n phase == _phase,\n \"Function must be called during the correct phase.\"\n );\n _;\n }\n\n\n /**********************************\n * Public Functions: State Access *\n **********************************/\n\n /**\n * Retrieves the state root before execution.\n * @return _preStateRoot State root before execution.\n */\n function getPreStateRoot()\n override\n public\n view\n returns (\n bytes32 _preStateRoot\n )\n {\n return preStateRoot;\n }\n\n /**\n * Retrieves the state root after execution.\n * @return _postStateRoot State root after execution.\n */\n function getPostStateRoot()\n override\n public\n view\n returns (\n bytes32 _postStateRoot\n )\n {\n return postStateRoot;\n }\n\n /**\n * Checks whether the transitioner is complete.\n * @return _complete Whether or not the transition process is finished.\n */\n function isComplete()\n override\n public\n view\n returns (\n bool _complete\n )\n {\n return phase == TransitionPhase.COMPLETE;\n }\n \n\n /***********************************\n * Public Functions: Pre-Execution *\n ***********************************/\n\n /**\n * Allows a user to prove the initial state of a contract.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _ethContractAddress Address of the corresponding contract on L1.\n * @param _stateTrieWitness Proof of the account state.\n */\n function proveContractState(\n address _ovmContractAddress,\n address _ethContractAddress,\n bytes memory _stateTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n // Exit quickly to avoid unnecessary work.\n require(\n (\n ovmStateManager.hasAccount(_ovmContractAddress) == false\n && ovmStateManager.hasEmptyAccount(_ovmContractAddress) == false\n ),\n \"Account state has already been proven.\"\n );\n\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\n (\n bool exists,\n bytes memory encodedAccount\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(_ovmContractAddress),\n _stateTrieWitness,\n preStateRoot\n );\n\n if (exists == true) {\n // Account exists, this was an inclusion proof.\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedAccount\n );\n\n address ethContractAddress = _ethContractAddress;\n if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) {\n // Use a known empty contract to prevent an attack in which a user provides a\n // contract address here and then later deploys code to it.\n ethContractAddress = 0x0000000000000000000000000000000000000000;\n } else {\n // Otherwise, make sure that the code at the provided eth address matches the hash\n // of the code stored on L2.\n require(\n Lib_EthUtils.getCodeHash(ethContractAddress) == account.codeHash,\n \"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash.\"\n );\n }\n\n ovmStateManager.putAccount(\n _ovmContractAddress,\n Lib_OVMCodec.Account({\n nonce: account.nonce,\n balance: account.balance,\n storageRoot: account.storageRoot,\n codeHash: account.codeHash,\n ethAddress: ethContractAddress,\n isFresh: false\n })\n );\n } else {\n // Account does not exist, this was an exclusion proof.\n ovmStateManager.putEmptyAccount(_ovmContractAddress);\n }\n }\n\n /**\n * Allows a user to prove the initial state of a contract storage slot.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _key Claimed account slot key.\n * @param _storageTrieWitness Proof of the storage slot.\n */\n function proveStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes memory _storageTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n // Exit quickly to avoid unnecessary work.\n require(\n ovmStateManager.hasContractStorage(_ovmContractAddress, _key) == false,\n \"Storage slot has already been proven.\"\n );\n\n require(\n ovmStateManager.hasAccount(_ovmContractAddress) == true,\n \"Contract must be verified before proving a storage slot.\"\n );\n\n bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress);\n bytes32 value;\n\n if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) {\n // Storage trie was empty, so the user is always allowed to insert zero-byte values.\n value = bytes32(0);\n } else {\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\n (\n bool exists,\n bytes memory encodedValue\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(_key),\n _storageTrieWitness,\n storageRoot\n );\n\n if (exists == true) {\n // Inclusion proof.\n // Stored values are RLP encoded, with leading zeros removed.\n value = Lib_BytesUtils.toBytes32PadLeft(\n Lib_RLPReader.readBytes(encodedValue)\n );\n } else {\n // Exclusion proof, can only be zero bytes.\n value = bytes32(0);\n }\n }\n\n ovmStateManager.putContractStorage(\n _ovmContractAddress,\n _key,\n value\n );\n }\n\n\n /*******************************\n * Public Functions: Execution *\n *******************************/\n\n /**\n * Executes the state transition.\n * @param _transaction OVM transaction to execute.\n */\n function applyTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n Lib_OVMCodec.hashTransaction(_transaction) == transactionHash,\n \"Invalid transaction provided.\"\n );\n\n // We require gas to complete the logic here in run() before/after execution,\n // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism)\n // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first \n // going into EM, then going into the code contract).\n require(\n gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, // 1032/1000 = 1.032 = (64/63)^2 rounded up\n \"Not enough gas to execute transaction deterministically.\"\n );\n\n iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve(\"OVM_ExecutionManager\"));\n\n // We call `setExecutionManager` right before `run` (and not earlier) just in case the\n // OVM_ExecutionManager address was updated between the time when this contract was created\n // and when `applyTransaction` was called.\n ovmStateManager.setExecutionManager(address(ovmExecutionManager));\n\n // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction`\n // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line\n // if that's the case.\n ovmExecutionManager.run(_transaction, address(ovmStateManager));\n\n phase = TransitionPhase.POST_EXECUTION;\n }\n\n\n /************************************\n * Public Functions: Post-Execution *\n ************************************/\n\n /**\n * Allows a user to commit the final state of a contract.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _stateTrieWitness Proof of the account state.\n */\n function commitContractState(\n address _ovmContractAddress,\n bytes memory _stateTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\n \"All storage must be committed before committing account states.\"\n );\n\n require (\n ovmStateManager.commitAccount(_ovmContractAddress) == true,\n \"Account state wasn't changed or has already been committed.\"\n );\n\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\n\n postStateRoot = Lib_SecureMerkleTrie.update(\n abi.encodePacked(_ovmContractAddress),\n Lib_OVMCodec.encodeEVMAccount(\n Lib_OVMCodec.toEVMAccount(account)\n ),\n _stateTrieWitness,\n postStateRoot\n );\n\n // Emit an event to help clients figure out the proof ordering.\n emit AccountCommitted(\n _ovmContractAddress\n );\n }\n\n /**\n * Allows a user to commit the final state of a contract storage slot.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _key Claimed account slot key.\n * @param _storageTrieWitness Proof of the storage slot.\n */\n function commitStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes memory _storageTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n ovmStateManager.commitContractStorage(_ovmContractAddress, _key) == true,\n \"Storage slot value wasn't changed or has already been committed.\"\n );\n\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\n bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key);\n\n account.storageRoot = Lib_SecureMerkleTrie.update(\n abi.encodePacked(_key),\n Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(value)\n ),\n _storageTrieWitness,\n account.storageRoot\n );\n\n ovmStateManager.putAccount(_ovmContractAddress, account);\n\n // Emit an event to help clients figure out the proof ordering.\n emit ContractStorageCommitted(\n _ovmContractAddress,\n _key\n );\n }\n\n\n /**********************************\n * Public Functions: Finalization *\n **********************************/\n\n /**\n * Finalizes the transition process.\n */\n function completeTransition()\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n {\n require(\n ovmStateManager.getTotalUncommittedAccounts() == 0,\n \"All accounts must be committed before completing a transition.\"\n );\n\n require(\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\n \"All storage must be committed before completing a transition.\"\n );\n\n phase = TransitionPhase.COMPLETE;\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"./Lib_MerkleTrie.sol\";\n\n/**\n * @title Lib_SecureMerkleTrie\n */\nlibrary Lib_SecureMerkleTrie {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Verifies a proof that a given key/value pair is present in the\n * Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _value Value of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\n * traditional Merkle trees, this proof is executed top-down and consists\n * of a list of RLP-encoded nodes that make a path down to the target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\n */\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\n }\n\n /**\n * @notice Verifies a proof that a given key is *not* present in\n * the Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\n */\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\n }\n\n /**\n * @notice Updates a Merkle trie and returns a new root hash.\n * @param _key Key of the node to update, as a hex string.\n * @param _value Value of the node to update, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node. If the key exists, we can simply update the value.\n * Otherwise, we need to modify the trie to handle the new k/v pair.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _updatedRoot Root hash of the newly constructed trie.\n */\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\n }\n\n /**\n * @notice Retrieves the value associated with a given key.\n * @param _key Key to search for, as hex bytes.\n * @param _proof Merkle trie inclusion proof for the key.\n * @param _root Known root of the Merkle trie.\n * @return _exists Whether or not the key exists.\n * @return _value Value of the key if it exists.\n */\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _exists,\n bytes memory _value\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.get(key, _proof, _root);\n }\n\n /**\n * Computes the root hash for a trie with a single node.\n * @param _key Key for the single node.\n * @param _value Value for the single node.\n * @return _updatedRoot Hash of the trie.\n */\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Computes the secure counterpart to a key.\n * @param _key Key to get a secure key from.\n * @return _secureKey Secure version of the key.\n */\n function _getSecureKey(\n bytes memory _key\n )\n private\n pure\n returns (\n bytes memory _secureKey\n )\n {\n return abi.encodePacked(keccak256(_key));\n }\n}" + }, + "contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateTransitioner\n */\ninterface iOVM_StateTransitioner {\n\n /**********\n * Events *\n **********/\n\n event AccountCommitted(\n address _address\n );\n\n event ContractStorageCommitted(\n address _address,\n bytes32 _key\n );\n\n\n /**********************************\n * Public Functions: State Access *\n **********************************/\n\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\n function isComplete() external view returns (bool _complete);\n\n\n /***********************************\n * Public Functions: Pre-Execution *\n ***********************************/\n\n function proveContractState(\n address _ovmContractAddress,\n address _ethContractAddress,\n bytes calldata _stateTrieWitness\n ) external;\n\n function proveStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes calldata _storageTrieWitness\n ) external;\n\n\n /*******************************\n * Public Functions: Execution *\n *******************************/\n\n function applyTransaction(\n Lib_OVMCodec.Transaction calldata _transaction\n ) external;\n\n\n /************************************\n * Public Functions: Post-Execution *\n ************************************/\n\n function commitContractState(\n address _ovmContractAddress,\n bytes calldata _stateTrieWitness\n ) external;\n\n function commitStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes calldata _storageTrieWitness\n ) external;\n\n\n /**********************************\n * Public Functions: Finalization *\n **********************************/\n\n function completeTransition() external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\ninterface ERC20 {\n function transfer(address, uint256) external returns (bool);\n function transferFrom(address, address, uint256) external returns (bool);\n}\n\n/// All the errors which may be encountered on the bond manager\nlibrary Errors {\n string constant ERC20_ERR = \"BondManager: Could not post bond\";\n string constant ALREADY_FINALIZED = \"BondManager: Fraud proof for this pre-state root has already been finalized\";\n string constant SLASHED = \"BondManager: Cannot finalize withdrawal, you probably got slashed\";\n string constant WRONG_STATE = \"BondManager: Wrong bond state for proposer\";\n string constant CANNOT_CLAIM = \"BondManager: Cannot claim yet. Dispute must be finalized first\";\n\n string constant WITHDRAWAL_PENDING = \"BondManager: Withdrawal already pending\";\n string constant TOO_EARLY = \"BondManager: Too early to finalize your withdrawal\";\n\n string constant ONLY_TRANSITIONER = \"BondManager: Only the transitioner for this pre-state root may call this function\";\n string constant ONLY_FRAUD_VERIFIER = \"BondManager: Only the fraud verifier may call this function\";\n string constant ONLY_STATE_COMMITMENT_CHAIN = \"BondManager: Only the state commitment chain may call this function\";\n string constant WAIT_FOR_DISPUTES = \"BondManager: Wait for other potential disputes\";\n}\n\n/**\n * @title iOVM_BondManager\n */\ninterface iOVM_BondManager {\n\n /*******************\n * Data Structures *\n *******************/\n\n /// The lifecycle of a proposer's bond\n enum State {\n // Before depositing or after getting slashed, a user is uncollateralized\n NOT_COLLATERALIZED,\n // After depositing, a user is collateralized\n COLLATERALIZED,\n // After a user has initiated a withdrawal\n WITHDRAWING\n }\n\n /// A bond posted by a proposer\n struct Bond {\n // The user's state\n State state;\n // The timestamp at which a proposer issued their withdrawal request\n uint32 withdrawalTimestamp;\n // The time when the first disputed was initiated for this bond\n uint256 firstDisputeAt;\n // The earliest observed state root for this bond which has had fraud\n bytes32 earliestDisputedStateRoot;\n // The state root's timestamp\n uint256 earliestTimestamp;\n }\n\n // Per pre-state root, store the number of state provisions that were made\n // and how many of these calls were made by each user. Payouts will then be\n // claimed by users proportionally for that dispute.\n struct Rewards {\n // Flag to check if rewards for a fraud proof are claimable\n bool canClaim;\n // Total number of `recordGasSpent` calls made\n uint256 total;\n // The gas spent by each user to provide witness data. The sum of all\n // values inside this map MUST be equal to the value of `total`\n mapping(address => uint256) gasSpent;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function recordGasSpent(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n address _who,\n uint256 _gasSpent\n ) external;\n\n function finalize(\n bytes32 _preStateRoot,\n address _publisher,\n uint256 _timestamp\n ) external;\n\n function deposit() external;\n\n function startWithdrawal() external;\n\n function finalizeWithdrawal() external;\n\n function claim(\n address _who\n ) external;\n\n function isCollateralized(\n address _who\n ) external view returns (bool);\n\n function getGasSpent(\n bytes32 _preStateRoot,\n address _who\n ) external view returns (uint256);\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { iOVM_StateManager } from \"./iOVM_StateManager.sol\";\n\n/**\n * @title iOVM_StateManagerFactory\n */\ninterface iOVM_StateManagerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n function create(\n address _owner\n )\n external\n returns (\n iOVM_StateManager _ovmStateManager\n );\n}\n" + }, + "contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/// Minimal contract to be inherited by contracts consumed by users that provide\n/// data for fraud proofs\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\n /// Decorate your functions with this modifier to store how much total gas was\n /// consumed by the sender, to reward users fairly\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\n uint256 startGas = gasleft();\n _;\n uint256 gasSpent = startGas - gasleft();\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\nimport { Lib_RLPReader } from \"../rlp/Lib_RLPReader.sol\";\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\n\n/**\n * @title Lib_MerkleTrie\n */\nlibrary Lib_MerkleTrie {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum NodeType {\n BranchNode,\n ExtensionNode,\n LeafNode\n }\n\n struct TrieNode {\n bytes encoded;\n Lib_RLPReader.RLPItem[] decoded;\n }\n\n\n /**********************\n * Contract Constants *\n **********************/\n\n // TREE_RADIX determines the number of elements per branch node.\n uint256 constant TREE_RADIX = 16;\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\n\n // Prefixes are prepended to the `path` within a leaf or extension node and\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\n // determined by the number of nibbles within the unprefixed `path`. If the\n // number of nibbles if even, we need to insert an extra padding nibble so\n // the resulting prefixed `path` has an even number of nibbles.\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\n uint8 constant PREFIX_EXTENSION_ODD = 1;\n uint8 constant PREFIX_LEAF_EVEN = 2;\n uint8 constant PREFIX_LEAF_ODD = 3;\n\n // Just a utility constant. RLP represents `NULL` as 0x80.\n bytes1 constant RLP_NULL = bytes1(0x80);\n bytes constant RLP_NULL_BYTES = hex'80';\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Verifies a proof that a given key/value pair is present in the\n * Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _value Value of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\n * traditional Merkle trees, this proof is executed top-down and consists\n * of a list of RLP-encoded nodes that make a path down to the target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\n */\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n (\n bool exists,\n bytes memory value\n ) = get(_key, _proof, _root);\n\n return (\n exists && Lib_BytesUtils.equal(_value, value)\n );\n }\n\n /**\n * @notice Verifies a proof that a given key is *not* present in\n * the Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\n */\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n (\n bool exists,\n ) = get(_key, _proof, _root);\n\n return exists == false;\n }\n\n /**\n * @notice Updates a Merkle trie and returns a new root hash.\n * @param _key Key of the node to update, as a hex string.\n * @param _value Value of the node to update, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node. If the key exists, we can simply update the value.\n * Otherwise, we need to modify the trie to handle the new k/v pair.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _updatedRoot Root hash of the newly constructed trie.\n */\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n // Special case when inserting the very first node.\n if (_root == KECCAK256_RLP_NULL_BYTES) {\n return getSingleNodeRootHash(_key, _value);\n }\n\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\n\n return _getUpdatedTrieRoot(newPath, _key);\n }\n\n /**\n * @notice Retrieves the value associated with a given key.\n * @param _key Key to search for, as hex bytes.\n * @param _proof Merkle trie inclusion proof for the key.\n * @param _root Known root of the Merkle trie.\n * @return _exists Whether or not the key exists.\n * @return _value Value of the key if it exists.\n */\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _exists,\n bytes memory _value\n )\n {\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\n\n bool exists = keyRemainder.length == 0;\n\n require(\n exists || isFinalNode,\n \"Provided proof is invalid.\"\n );\n\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\n\n return (\n exists,\n value\n );\n }\n\n /**\n * Computes the root hash for a trie with a single node.\n * @param _key Key for the single node.\n * @param _value Value for the single node.\n * @return _updatedRoot Hash of the trie.\n */\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n return keccak256(_makeLeafNode(\n Lib_BytesUtils.toNibbles(_key),\n _value\n ).encoded);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * @notice Walks through a proof using a provided key.\n * @param _proof Inclusion proof to walk through.\n * @param _key Key to use for the walk.\n * @param _root Known root of the trie.\n * @return _pathLength Length of the final path\n * @return _keyRemainder Portion of the key remaining after the walk.\n * @return _isFinalNode Whether or not we've hit a dead end.\n */\n function _walkNodePath(\n TrieNode[] memory _proof,\n bytes memory _key,\n bytes32 _root\n )\n private\n pure\n returns (\n uint256 _pathLength,\n bytes memory _keyRemainder,\n bool _isFinalNode\n )\n {\n uint256 pathLength = 0;\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\n\n bytes32 currentNodeID = _root;\n uint256 currentKeyIndex = 0;\n uint256 currentKeyIncrement = 0;\n TrieNode memory currentNode;\n\n // Proof is top-down, so we start at the first element (root).\n for (uint256 i = 0; i < _proof.length; i++) {\n currentNode = _proof[i];\n currentKeyIndex += currentKeyIncrement;\n\n // Keep track of the proof elements we actually need.\n // It's expensive to resize arrays, so this simply reduces gas costs.\n pathLength += 1;\n\n if (currentKeyIndex == 0) {\n // First proof element is always the root node.\n require(\n keccak256(currentNode.encoded) == currentNodeID,\n \"Invalid root hash\"\n );\n } else if (currentNode.encoded.length >= 32) {\n // Nodes 32 bytes or larger are hashed inside branch nodes.\n require(\n keccak256(currentNode.encoded) == currentNodeID,\n \"Invalid large internal hash\"\n );\n } else {\n // Nodes smaller than 31 bytes aren't hashed.\n require(\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\n \"Invalid internal node hash\"\n );\n }\n\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\n if (currentKeyIndex == key.length) {\n // We've hit the end of the key, meaning the value should be within this branch node.\n break;\n } else {\n // We're not at the end of the key yet.\n // Figure out what the next node ID should be and continue.\n uint8 branchKey = uint8(key[currentKeyIndex]);\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\n currentNodeID = _getNodeID(nextNode);\n currentKeyIncrement = 1;\n continue;\n }\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(currentNode);\n uint8 prefix = uint8(path[0]);\n uint8 offset = 2 - prefix % 2;\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n if (\n pathRemainder.length == sharedNibbleLength &&\n keyRemainder.length == sharedNibbleLength\n ) {\n // The key within this leaf matches our key exactly.\n // Increment the key index to reflect that we have no remainder.\n currentKeyIndex += sharedNibbleLength;\n }\n\n // We've hit a leaf node, so our next node should be NULL.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n if (sharedNibbleLength == 0) {\n // Our extension node doesn't share any part of our key.\n // We've hit the end of this path, updates will need to modify this extension.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else {\n // Our extension shares some nibbles.\n // Carry on to the next node.\n currentNodeID = _getNodeID(currentNode.decoded[1]);\n currentKeyIncrement = sharedNibbleLength;\n continue;\n }\n } else {\n revert(\"Received a node with an unknown prefix\");\n }\n } else {\n revert(\"Received an unparseable node.\");\n }\n }\n\n // If our node ID is NULL, then we're at a dead end.\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\n }\n\n /**\n * @notice Creates new nodes to support a k/v pair insertion into a given\n * Merkle trie path.\n * @param _path Path to the node nearest the k/v pair.\n * @param _pathLength Length of the path. Necessary because the provided\n * path may include additional nodes (e.g., it comes directly from a proof)\n * and we can't resize in-memory arrays without costly duplication.\n * @param _keyRemainder Portion of the initial key that must be inserted\n * into the trie.\n * @param _value Value to insert at the given key.\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\n */\n function _getNewPath(\n TrieNode[] memory _path,\n uint256 _pathLength,\n bytes memory _keyRemainder,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode[] memory _newPath\n )\n {\n bytes memory keyRemainder = _keyRemainder;\n\n // Most of our logic depends on the status of the last node in the path.\n TrieNode memory lastNode = _path[_pathLength - 1];\n NodeType lastNodeType = _getNodeType(lastNode);\n\n // Create an array for newly created nodes.\n // We need up to three new nodes, depending on the contents of the last node.\n // Since array resizing is expensive, we'll keep track of the size manually.\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\n TrieNode[] memory newNodes = new TrieNode[](3);\n uint256 totalNewNodes = 0;\n\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\n // We've found a leaf node with the given key.\n // Simply need to update the value of the node to match.\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\n totalNewNodes += 1;\n } else if (lastNodeType == NodeType.BranchNode) {\n if (keyRemainder.length == 0) {\n // We've found a branch node with the given key.\n // Simply need to update the value of the node to match.\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\n totalNewNodes += 1;\n } else {\n // We've found a branch node, but it doesn't contain our key.\n // Reinsert the old branch for now.\n newNodes[totalNewNodes] = lastNode;\n totalNewNodes += 1;\n // Create a new leaf node, slicing our remainder since the first byte points\n // to our branch node.\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\n totalNewNodes += 1;\n }\n } else {\n // Our last node is either an extension node or a leaf node with a different key.\n bytes memory lastNodeKey = _getNodeKey(lastNode);\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\n\n if (sharedNibbleLength != 0) {\n // We've got some shared nibbles between the last node and our key remainder.\n // We'll need to insert an extension node that covers these shared nibbles.\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\n totalNewNodes += 1;\n\n // Cut down the keys since we've just covered these shared nibbles.\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\n }\n\n // Create an empty branch to fill in.\n TrieNode memory newBranch = _makeEmptyBranchNode();\n\n if (lastNodeKey.length == 0) {\n // Key remainder was larger than the key for our last node.\n // The value within our last node is therefore going to be shifted into\n // a branch value slot.\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\n } else {\n // Last node key was larger than the key remainder.\n // We're going to modify some index of our branch.\n uint8 branchKey = uint8(lastNodeKey[0]);\n // Move on to the next nibble.\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\n\n if (lastNodeType == NodeType.LeafNode) {\n // We're dealing with a leaf node.\n // We'll modify the key and insert the old leaf node into the branch index.\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\n } else if (lastNodeKey.length != 0) {\n // We're dealing with a shrinking extension node.\n // We need to modify the node to decrease the size of the key.\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\n } else {\n // We're dealing with an unnecessary extension node.\n // We're going to delete the node entirely.\n // Simply insert its current value into the branch index.\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\n }\n }\n\n if (keyRemainder.length == 0) {\n // We've got nothing left in the key remainder.\n // Simply insert the value into the branch value slot.\n newBranch = _editBranchValue(newBranch, _value);\n // Push the branch into the list of new nodes.\n newNodes[totalNewNodes] = newBranch;\n totalNewNodes += 1;\n } else {\n // We've got some key remainder to work with.\n // We'll be inserting a leaf node into the trie.\n // First, move on to the next nibble.\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\n // Push the branch into the list of new nodes.\n newNodes[totalNewNodes] = newBranch;\n totalNewNodes += 1;\n // Push a new leaf node for our k/v pair.\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\n totalNewNodes += 1;\n }\n }\n\n // Finally, join the old path with our newly created nodes.\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\n }\n\n /**\n * @notice Computes the trie root from a given path.\n * @param _nodes Path to some k/v pair.\n * @param _key Key for the k/v pair.\n * @return _updatedRoot Root hash for the updated trie.\n */\n function _getUpdatedTrieRoot(\n TrieNode[] memory _nodes,\n bytes memory _key\n )\n private\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\n\n // Some variables to keep track of during iteration.\n TrieNode memory currentNode;\n NodeType currentNodeType;\n bytes memory previousNodeHash;\n\n // Run through the path backwards to rebuild our root hash.\n for (uint256 i = _nodes.length; i > 0; i--) {\n // Pick out the current node.\n currentNode = _nodes[i - 1];\n currentNodeType = _getNodeType(currentNode);\n\n if (currentNodeType == NodeType.LeafNode) {\n // Leaf nodes are already correctly encoded.\n // Shift the key over to account for the nodes key.\n bytes memory nodeKey = _getNodeKey(currentNode);\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\n } else if (currentNodeType == NodeType.ExtensionNode) {\n // Shift the key over to account for the nodes key.\n bytes memory nodeKey = _getNodeKey(currentNode);\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\n\n // If this node is the last element in the path, it'll be correctly encoded\n // and we can skip this part.\n if (previousNodeHash.length > 0) {\n // Re-encode the node based on the previous node.\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\n }\n } else if (currentNodeType == NodeType.BranchNode) {\n // If this node is the last element in the path, it'll be correctly encoded\n // and we can skip this part.\n if (previousNodeHash.length > 0) {\n // Re-encode the node based on the previous node.\n uint8 branchKey = uint8(key[key.length - 1]);\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\n }\n }\n\n // Compute the node hash for the next iteration.\n previousNodeHash = _getNodeHash(currentNode.encoded);\n }\n\n // Current node should be the root at this point.\n // Simply return the hash of its encoding.\n return keccak256(currentNode.encoded);\n }\n\n /**\n * @notice Parses an RLP-encoded proof into something more useful.\n * @param _proof RLP-encoded proof to parse.\n * @return _parsed Proof parsed into easily accessible structs.\n */\n function _parseProof(\n bytes memory _proof\n )\n private\n pure\n returns (\n TrieNode[] memory _parsed\n )\n {\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\n TrieNode[] memory proof = new TrieNode[](nodes.length);\n\n for (uint256 i = 0; i < nodes.length; i++) {\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\n proof[i] = TrieNode({\n encoded: encoded,\n decoded: Lib_RLPReader.readList(encoded)\n });\n }\n\n return proof;\n }\n\n /**\n * @notice Picks out the ID for a node. Node ID is referred to as the\n * \"hash\" within the specification, but nodes < 32 bytes are not actually\n * hashed.\n * @param _node Node to pull an ID for.\n * @return _nodeID ID for the node, depending on the size of its contents.\n */\n function _getNodeID(\n Lib_RLPReader.RLPItem memory _node\n )\n private\n pure\n returns (\n bytes32 _nodeID\n )\n {\n bytes memory nodeID;\n\n if (_node.length < 32) {\n // Nodes smaller than 32 bytes are RLP encoded.\n nodeID = Lib_RLPReader.readRawBytes(_node);\n } else {\n // Nodes 32 bytes or larger are hashed.\n nodeID = Lib_RLPReader.readBytes(_node);\n }\n\n return Lib_BytesUtils.toBytes32(nodeID);\n }\n\n /**\n * @notice Gets the path for a leaf or extension node.\n * @param _node Node to get a path for.\n * @return _path Node path, converted to an array of nibbles.\n */\n function _getNodePath(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _path\n )\n {\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\n }\n\n /**\n * @notice Gets the key for a leaf or extension node. Keys are essentially\n * just paths without any prefix.\n * @param _node Node to get a key for.\n * @return _key Node key, converted to an array of nibbles.\n */\n function _getNodeKey(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _key\n )\n {\n return _removeHexPrefix(_getNodePath(_node));\n }\n\n /**\n * @notice Gets the path for a node.\n * @param _node Node to get a value for.\n * @return _value Node value, as hex bytes.\n */\n function _getNodeValue(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _value\n )\n {\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\n }\n\n /**\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\n * are not hashed, all others are keccak256 hashed.\n * @param _encoded Encoded node to hash.\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\n */\n function _getNodeHash(\n bytes memory _encoded\n )\n private\n pure\n returns (\n bytes memory _hash\n )\n {\n if (_encoded.length < 32) {\n return _encoded;\n } else {\n return abi.encodePacked(keccak256(_encoded));\n }\n }\n\n /**\n * @notice Determines the type for a given node.\n * @param _node Node to determine a type for.\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\n */\n function _getNodeType(\n TrieNode memory _node\n )\n private\n pure\n returns (\n NodeType _type\n )\n {\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\n return NodeType.BranchNode;\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(_node);\n uint8 prefix = uint8(path[0]);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n return NodeType.LeafNode;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n return NodeType.ExtensionNode;\n }\n }\n\n revert(\"Invalid node type\");\n }\n\n /**\n * @notice Utility; determines the number of nibbles shared between two\n * nibble arrays.\n * @param _a First nibble array.\n * @param _b Second nibble array.\n * @return _shared Number of shared nibbles.\n */\n function _getSharedNibbleLength(\n bytes memory _a,\n bytes memory _b\n )\n private\n pure\n returns (\n uint256 _shared\n )\n {\n uint256 i = 0;\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\n i++;\n }\n return i;\n }\n\n /**\n * @notice Utility; converts an RLP-encoded node into our nice struct.\n * @param _raw RLP-encoded node to convert.\n * @return _node Node as a TrieNode struct.\n */\n function _makeNode(\n bytes[] memory _raw\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\n\n return TrieNode({\n encoded: encoded,\n decoded: Lib_RLPReader.readList(encoded)\n });\n }\n\n /**\n * @notice Utility; converts an RLP-decoded node into our nice struct.\n * @param _items RLP-decoded node to convert.\n * @return _node Node as a TrieNode struct.\n */\n function _makeNode(\n Lib_RLPReader.RLPItem[] memory _items\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](_items.length);\n for (uint256 i = 0; i < _items.length; i++) {\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\n }\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates a new extension node.\n * @param _key Key for the extension node, unprefixed.\n * @param _value Value for the extension node.\n * @return _node New extension node with the given k/v pair.\n */\n function _makeExtensionNode(\n bytes memory _key,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_key, false);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates a new leaf node.\n * @dev This function is essentially identical to `_makeExtensionNode`.\n * Although we could route both to a single method with a flag, it's\n * more gas efficient to keep them separate and duplicate the logic.\n * @param _key Key for the leaf node, unprefixed.\n * @param _value Value for the leaf node.\n * @return _node New leaf node with the given k/v pair.\n */\n function _makeLeafNode(\n bytes memory _key,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_key, true);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates an empty branch node.\n * @return _node Empty branch node as a TrieNode struct.\n */\n function _makeEmptyBranchNode()\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\n for (uint256 i = 0; i < raw.length; i++) {\n raw[i] = RLP_NULL_BYTES;\n }\n return _makeNode(raw);\n }\n\n /**\n * @notice Modifies the value slot for a given branch.\n * @param _branch Branch node to modify.\n * @param _value Value to insert into the branch.\n * @return _updatedNode Modified branch node.\n */\n function _editBranchValue(\n TrieNode memory _branch,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _updatedNode\n )\n {\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\n return _makeNode(_branch.decoded);\n }\n\n /**\n * @notice Modifies a slot at an index for a given branch.\n * @param _branch Branch node to modify.\n * @param _index Slot index to modify.\n * @param _value Value to insert into the slot.\n * @return _updatedNode Modified branch node.\n */\n function _editBranchIndex(\n TrieNode memory _branch,\n uint8 _index,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _updatedNode\n )\n {\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\n return _makeNode(_branch.decoded);\n }\n\n /**\n * @notice Utility; adds a prefix to a key.\n * @param _key Key to prefix.\n * @param _isLeaf Whether or not the key belongs to a leaf.\n * @return _prefixedKey Prefixed key.\n */\n function _addHexPrefix(\n bytes memory _key,\n bool _isLeaf\n )\n private\n pure\n returns (\n bytes memory _prefixedKey\n )\n {\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\n uint8 offset = uint8(_key.length % 2);\n bytes memory prefixed = new bytes(2 - offset);\n prefixed[0] = bytes1(prefix + offset);\n return Lib_BytesUtils.concat(prefixed, _key);\n }\n\n /**\n * @notice Utility; removes a prefix from a path.\n * @param _path Path to remove the prefix from.\n * @return _unprefixedKey Unprefixed key.\n */\n function _removeHexPrefix(\n bytes memory _path\n )\n private\n pure\n returns (\n bytes memory _unprefixedKey\n )\n {\n if (uint8(_path[0]) % 2 == 0) {\n return Lib_BytesUtils.slice(_path, 2);\n } else {\n return Lib_BytesUtils.slice(_path, 1);\n }\n }\n\n /**\n * @notice Utility; combines two node arrays. Array lengths are required\n * because the actual lengths may be longer than the filled lengths.\n * Array resizing is extremely costly and should be avoided.\n * @param _a First array to join.\n * @param _aLength Length of the first array.\n * @param _b Second array to join.\n * @param _bLength Length of the second array.\n * @return _joined Combined node array.\n */\n function _joinNodeArrays(\n TrieNode[] memory _a,\n uint256 _aLength,\n TrieNode[] memory _b,\n uint256 _bLength\n )\n private\n pure\n returns (\n TrieNode[] memory _joined\n )\n {\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\n\n // Copy elements from the first array.\n for (uint256 i = 0; i < _aLength; i++) {\n ret[i] = _a[i];\n }\n\n // Copy elements from the second array.\n for (uint256 i = 0; i < _bLength; i++) {\n ret[i + _aLength] = _b[i];\n }\n\n return ret;\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_StateTransitionerFactory } from \"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\";\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\n\n/* Contract Imports */\nimport { OVM_StateTransitioner } from \"./OVM_StateTransitioner.sol\";\n\n/**\n * @title OVM_StateTransitionerFactory\n * @dev The State Transitioner Factory is used by the Fraud Verifier to create a new State \n * Transitioner during the initialization of a fraud proof.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_AddressResolver {\n\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n /**\n * Creates a new OVM_StateTransitioner\n * @param _libAddressManager Address of the Address Manager.\n * @param _stateTransitionIndex Index of the state transition being verified.\n * @param _preStateRoot State root before the transition was executed.\n * @param _transactionHash Hash of the executed transaction.\n * @return _ovmStateTransitioner New OVM_StateTransitioner instance.\n */\n function create(\n address _libAddressManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n override\n public\n returns (\n iOVM_StateTransitioner _ovmStateTransitioner\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\n return new OVM_StateTransitioner(\n _libAddressManager,\n _stateTransitionIndex,\n _preStateRoot,\n _transactionHash\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { iOVM_StateTransitioner } from \"./iOVM_StateTransitioner.sol\";\n\n/**\n * @title iOVM_StateTransitionerFactory\n */\ninterface iOVM_StateTransitionerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n function create(\n address _proxyManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n external\n returns (\n iOVM_StateTransitioner _ovmStateTransitioner\n );\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"./iOVM_StateTransitioner.sol\";\n\n/**\n * @title iOVM_FraudVerifier\n */\ninterface iOVM_FraudVerifier {\n\n /**********\n * Events *\n **********/\n\n event FraudProofInitialized(\n bytes32 _preStateRoot,\n uint256 _preStateRootIndex,\n bytes32 _transactionHash,\n address _who\n );\n\n event FraudProofFinalized(\n bytes32 _preStateRoot,\n uint256 _preStateRootIndex,\n bytes32 _transactionHash,\n address _who\n );\n\n\n /***************************************\n * Public Functions: Transition Status *\n ***************************************/\n\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\n\n\n /****************************************\n * Public Functions: Fraud Verification *\n ****************************************/\n\n function initializeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\n Lib_OVMCodec.Transaction calldata _transaction,\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\n ) external;\n\n function finalizeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\n bytes32 _txHash,\n bytes32 _postStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\n ) external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_StateTransitionerFactory } from \"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\n\n/* Contract Imports */\nimport { Abs_FraudContributor } from \"./Abs_FraudContributor.sol\";\n\n\n\n/**\n * @title OVM_FraudVerifier\n * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. \n * If the fraud proof was successful it prunes any state batches from State Commitment Chain\n * which were published after the fraudulent state root.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier {\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n mapping (bytes32 => iOVM_StateTransitioner) internal transitioners;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /***************************************\n * Public Functions: Transition Status *\n ***************************************/\n\n /**\n * Retrieves the state transitioner for a given root.\n * @param _preStateRoot State root to query a transitioner for.\n * @return _transitioner Corresponding state transitioner contract.\n */\n function getStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n override\n public\n view\n returns (\n iOVM_StateTransitioner _transitioner\n )\n {\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\n }\n\n\n /****************************************\n * Public Functions: Fraud Verification *\n ****************************************/\n\n /**\n * Begins the fraud verification process.\n * @param _preStateRoot State root before the fraudulent transaction.\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\n * @param _transaction OVM transaction claimed to be fraudulent.\n * @param _txChainElement OVM transaction chain element.\n * @param _transactionBatchHeader Batch header for the provided transaction.\n * @param _transactionProof Inclusion proof for the provided transaction.\n */\n function initializeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _transactionProof\n )\n override\n public\n contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction))\n {\n bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction);\n\n if (_hasStateTransitioner(_preStateRoot, _txHash)) {\n return;\n }\n\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\"));\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _preStateRoot,\n _preStateRootBatchHeader,\n _preStateRootProof\n ),\n \"Invalid pre-state root inclusion proof.\"\n );\n\n require(\n ovmCanonicalTransactionChain.verifyTransaction(\n _transaction,\n _txChainElement,\n _transactionBatchHeader,\n _transactionProof\n ),\n \"Invalid transaction inclusion proof.\"\n );\n\n require (\n _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index,\n \"Pre-state root global index must equal to the transaction root global index.\"\n );\n\n _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);\n\n emit FraudProofInitialized(\n _preStateRoot,\n _preStateRootProof.index,\n _txHash,\n msg.sender\n );\n }\n\n /**\n * Finalizes the fraud verification process.\n * @param _preStateRoot State root before the fraudulent transaction.\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\n * @param _txHash The transaction for the state root\n * @param _postStateRoot State root after the fraudulent transaction.\n * @param _postStateRootBatchHeader Batch header for the provided post-state root.\n * @param _postStateRootProof Inclusion proof for the provided post-state root.\n */\n function finalizeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\n bytes32 _txHash,\n bytes32 _postStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof\n )\n override\n public\n contributesToFraudProof(_preStateRoot, _txHash)\n {\n iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\"OVM_BondManager\"));\n\n require(\n transitioner.isComplete() == true,\n \"State transition process must be completed prior to finalization.\"\n );\n\n require (\n _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,\n \"Post-state root global index must equal to the pre state root global index plus one.\"\n );\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _preStateRoot,\n _preStateRootBatchHeader,\n _preStateRootProof\n ),\n \"Invalid pre-state root inclusion proof.\"\n );\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _postStateRoot,\n _postStateRootBatchHeader,\n _postStateRootProof\n ),\n \"Invalid post-state root inclusion proof.\"\n );\n\n // If the post state root did not match, then there was fraud and we should delete the batch\n require(\n _postStateRoot != transitioner.getPostStateRoot(),\n \"State transition has not been proven fraudulent.\"\n );\n \n _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);\n\n // TEMPORARY: Remove the transitioner; for minnet.\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000);\n\n emit FraudProofFinalized(\n _preStateRoot,\n _preStateRootProof.index,\n _txHash,\n msg.sender\n );\n }\n\n\n /************************************\n * Internal Functions: Verification *\n ************************************/\n\n /**\n * Checks whether a transitioner already exists for a given pre-state root.\n * @param _preStateRoot Pre-state root to check.\n * @return _exists Whether or not we already have a transitioner for the root.\n */\n function _hasStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n internal\n view\n returns (\n bool _exists\n )\n {\n return address(getStateTransitioner(_preStateRoot, _txHash)) != address(0);\n }\n\n /**\n * Deploys a new state transitioner.\n * @param _preStateRoot Pre-state root to initialize the transitioner with.\n * @param _txHash Hash of the transaction this transitioner will execute.\n * @param _stateTransitionIndex Index of the transaction in the chain.\n */\n function _deployTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n uint256 _stateTransitionIndex\n )\n internal\n {\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitionerFactory(\n resolve(\"OVM_StateTransitionerFactory\")\n ).create(\n address(libAddressManager),\n _stateTransitionIndex,\n _preStateRoot,\n _txHash\n );\n }\n\n /**\n * Removes a state transition from the state commitment chain.\n * @param _postStateRootBatchHeader Header for the post-state root.\n * @param _preStateRoot Pre-state root hash.\n */\n function _cancelStateTransition(\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\n bytes32 _preStateRoot\n )\n internal\n {\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\"OVM_BondManager\"));\n\n // Delete the state batch.\n ovmStateCommitmentChain.deleteStateBatch(\n _postStateRootBatchHeader\n );\n\n // Get the timestamp and publisher for that block.\n (uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));\n\n // Slash the bonds at the bond manager.\n ovmBondManager.finalize(\n _preStateRoot,\n publisher,\n timestamp\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateCommitmentChain\n */\ninterface iOVM_StateCommitmentChain {\n\n /**********\n * Events *\n **********/\n\n event StateBatchAppended(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot,\n uint256 _batchSize,\n uint256 _prevTotalElements,\n bytes _extraData\n );\n\n event StateBatchDeleted(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n external\n view\n returns (\n uint256 _totalElements\n );\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n external\n view\n returns (\n uint256 _totalBatches\n );\n\n /**\n * Retrieves the timestamp of the last batch submitted by the sequencer.\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\n */\n function getLastSequencerTimestamp()\n external\n view\n returns (\n uint256 _lastSequencerTimestamp\n );\n\n /**\n * Appends a batch of state roots to the chain.\n * @param _batch Batch of state roots.\n * @param _shouldStartAtElement Index of the element at which this batch should start.\n */\n function appendStateBatch(\n bytes32[] calldata _batch,\n uint256 _shouldStartAtElement\n )\n external;\n\n /**\n * Deletes all state roots after (and including) a given batch.\n * @param _batchHeader Header of the batch to start deleting from.\n */\n function deleteStateBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n external;\n\n /**\n * Verifies a batch inclusion proof.\n * @param _element Hash of the element to verify a proof for.\n * @param _batchHeader Header of the batch in which the element was included.\n * @param _proof Merkle inclusion proof for the element.\n */\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n external\n view\n returns (\n bool _verified\n );\n\n /**\n * Checks whether a given batch is still inside its fraud proof window.\n * @param _batchHeader Header of the batch to check.\n * @return _inside Whether or not the batch is inside the fraud proof window.\n */\n function insideFraudProofWindow(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n external\n view\n returns (\n bool _inside\n );\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_ChainStorageContainer } from \"./iOVM_ChainStorageContainer.sol\";\n\n/**\n * @title iOVM_CanonicalTransactionChain\n */\ninterface iOVM_CanonicalTransactionChain {\n\n /**********\n * Events *\n **********/\n\n event TransactionEnqueued(\n address _l1TxOrigin,\n address _target,\n uint256 _gasLimit,\n bytes _data,\n uint256 _queueIndex,\n uint256 _timestamp\n );\n\n event QueueBatchAppended(\n uint256 _startingQueueIndex,\n uint256 _numQueueElements,\n uint256 _totalElements\n );\n\n event SequencerBatchAppended(\n uint256 _startingQueueIndex,\n uint256 _numQueueElements,\n uint256 _totalElements\n );\n\n event TransactionBatchAppended(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot,\n uint256 _batchSize,\n uint256 _prevTotalElements,\n bytes _extraData\n );\n\n\n /***********\n * Structs *\n ***********/\n\n struct BatchContext {\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 timestamp;\n uint256 blockNumber;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n external\n view\n returns (\n iOVM_ChainStorageContainer\n );\n\n /**\n * Accesses the queue storage container.\n * @return Reference to the queue storage container.\n */\n function queue()\n external\n view\n returns (\n iOVM_ChainStorageContainer\n );\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n external\n view\n returns (\n uint256 _totalElements\n );\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n external\n view\n returns (\n uint256 _totalBatches\n );\n\n /**\n * Returns the index of the next element to be enqueued.\n * @return Index for the next queue element.\n */\n function getNextQueueIndex()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Gets the queue element at a particular index.\n * @param _index Index of the queue element to access.\n * @return _element Queue element at the given index.\n */\n function getQueueElement(\n uint256 _index\n )\n external\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n );\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Get the number of queue elements which have not yet been included.\n * @return Number of pending queue elements.\n */\n function getNumPendingQueueElements()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Retrieves the length of the queue, including\n * both pending and canonical transactions.\n * @return Length of the queue.\n */\n function getQueueLength()\n external\n view\n returns (\n uint40\n );\n\n\n /**\n * Adds a transaction to the queue.\n * @param _target Target contract to send the transaction to.\n * @param _gasLimit Gas limit for the given transaction.\n * @param _data Transaction data.\n */\n function enqueue(\n address _target,\n uint256 _gasLimit,\n bytes memory _data\n )\n external;\n\n /**\n * Appends a given number of queued transactions as a single batch.\n * @param _numQueuedTransactions Number of transactions to append.\n */\n function appendQueueBatch(\n uint256 _numQueuedTransactions\n )\n external;\n\n /**\n * Allows the sequencer to append a batch of transactions.\n * @dev This function uses a custom encoding scheme for efficiency reasons.\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\n * .param _contexts Array of batch contexts.\n * .param _transactionDataFields Array of raw transaction data.\n */\n function appendSequencerBatch(\n // uint40 _shouldStartAtElement,\n // uint24 _totalElementsToAppend,\n // BatchContext[] _contexts,\n // bytes[] _transactionDataFields\n )\n external;\n\n /**\n * Verifies whether a transaction is included in the chain.\n * @param _transaction Transaction to verify.\n * @param _txChainElement Transaction chain element corresponding to the transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\n * @return True if the transaction exists in the CTC, false if not.\n */\n function verifyTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n external\n view\n returns (\n bool\n );\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_ChainStorageContainer\n */\ninterface iOVM_ChainStorageContainer {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\n * 27 bytes to store arbitrary data.\n * @param _globalMetadata New global metadata to set.\n */\n function setGlobalMetadata(\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Retrieves the container's global metadata field.\n * @return Container global metadata field.\n */\n function getGlobalMetadata()\n external\n view\n returns (\n bytes27\n );\n\n /**\n * Retrieves the number of objects stored in the container.\n * @return Number of objects in the container.\n */\n function length()\n external\n view\n returns (\n uint256\n );\n\n /**\n * Pushes an object into the container.\n * @param _object A 32 byte value to insert into the container.\n */\n function push(\n bytes32 _object\n )\n external;\n\n /**\n * Pushes an object into the container. Function allows setting the global metadata since\n * we'll need to touch the \"length\" storage slot anyway, which also contains the global\n * metadata (it's an optimization).\n * @param _object A 32 byte value to insert into the container.\n * @param _globalMetadata New global metadata for the container.\n */\n function push(\n bytes32 _object,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Pushes two objects into the container at the same time. A useful optimization.\n * @param _objectA First 32 byte value to insert into the container.\n * @param _objectB Second 32 byte value to insert into the container.\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB\n )\n external;\n\n /**\n * Pushes two objects into the container at the same time. Also allows setting the global\n * metadata field.\n * @param _objectA First 32 byte value to insert into the container.\n * @param _objectB Second 32 byte value to insert into the container.\n * @param _globalMetadata New global metadata for the container.\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Retrieves an object from the container.\n * @param _index Index of the particular object to access.\n * @return 32 byte object value.\n */\n function get(\n uint256 _index\n )\n external\n view\n returns (\n bytes32\n );\n\n /**\n * Removes all objects after and including a given index.\n * @param _index Object index to delete from.\n */\n function deleteElementsAfterInclusive(\n uint256 _index\n )\n external;\n\n /**\n * Removes all objects after and including a given index. Also allows setting the global\n * metadata field.\n * @param _index Object index to delete from.\n * @param _globalMetadata New global metadata for the container.\n */\n function deleteElementsAfterInclusive(\n uint256 _index,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\n * any objects before and including the given index.\n */\n function setNextOverwritableIndex(\n uint256 _index\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_BondManager, Errors, ERC20 } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\n\n/**\n * @title OVM_BondManager\n * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded \n * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a\n * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, \n * and the Verifier's gas costs are refunded.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\n\n /****************************\n * Constants and Parameters *\n ****************************/\n\n /// The period to find the earliest fraud proof for a publisher\n uint256 public constant multiFraudProofPeriod = 7 days;\n\n /// The dispute period\n uint256 public constant disputePeriodSeconds = 7 days;\n\n /// The minimum collateral a sequencer must post\n uint256 public constant requiredCollateral = 1 ether;\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n /// The bond token\n ERC20 immutable public token;\n\n\n /********************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n /// The bonds posted by each proposer\n mapping(address => Bond) public bonds;\n\n /// For each pre-state root, there's an array of witnessProviders that must be rewarded\n /// for posting witnesses\n mapping(bytes32 => Rewards) public witnessProviders;\n\n\n /***************\n * Constructor *\n ***************/\n\n /// Initializes with a ERC20 token to be used for the fidelity bonds\n /// and with the Address Manager\n constructor(\n ERC20 _token,\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n token = _token;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\n function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public {\n // The sender must be the transitioner that corresponds to the claimed pre-state root\n address transitioner = address(iOVM_FraudVerifier(resolve(\"OVM_FraudVerifier\")).getStateTransitioner(_preStateRoot, _txHash));\n require(transitioner == msg.sender, Errors.ONLY_TRANSITIONER);\n\n witnessProviders[_preStateRoot].total += gasSpent;\n witnessProviders[_preStateRoot].gasSpent[who] += gasSpent;\n }\n\n /// Slashes + distributes rewards or frees up the sequencer's bond, only called by\n /// `FraudVerifier.finalizeFraudVerification`\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {\n require(msg.sender == resolve(\"OVM_FraudVerifier\"), Errors.ONLY_FRAUD_VERIFIER);\n require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);\n\n // allow users to claim from that state root's\n // pool of collateral (effectively slashing the sequencer)\n witnessProviders[_preStateRoot].canClaim = true;\n\n Bond storage bond = bonds[publisher];\n if (bond.firstDisputeAt == 0) {\n bond.firstDisputeAt = block.timestamp;\n bond.earliestDisputedStateRoot = _preStateRoot;\n bond.earliestTimestamp = timestamp;\n } else if (\n // only update the disputed state root for the publisher if it's within\n // the dispute period _and_ if it's before the previous one\n block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod &&\n timestamp < bond.earliestTimestamp\n ) {\n bond.earliestDisputedStateRoot = _preStateRoot;\n bond.earliestTimestamp = timestamp;\n }\n\n // if the fraud proof's dispute period does not intersect with the \n // withdrawal's timestamp, then the user should not be slashed\n // e.g if a user at day 10 submits a withdrawal, and a fraud proof\n // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d)\n // is before the user started their withdrawal. on the contrary, if the user\n // had started their withdrawal at, say, day 6, they would be slashed\n if (\n bond.withdrawalTimestamp != 0 && \n uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds &&\n bond.state == State.WITHDRAWING\n ) {\n return;\n }\n\n // slash!\n bond.state = State.NOT_COLLATERALIZED;\n }\n\n /// Sequencers call this function to post collateral which will be used for\n /// the `appendBatch` call\n function deposit() override public {\n require(\n token.transferFrom(msg.sender, address(this), requiredCollateral),\n Errors.ERC20_ERR\n );\n\n // This cannot overflow\n bonds[msg.sender].state = State.COLLATERALIZED;\n }\n\n /// Starts the withdrawal for a publisher\n function startWithdrawal() override public {\n Bond storage bond = bonds[msg.sender];\n require(bond.withdrawalTimestamp == 0, Errors.WITHDRAWAL_PENDING);\n require(bond.state == State.COLLATERALIZED, Errors.WRONG_STATE);\n\n bond.state = State.WITHDRAWING;\n bond.withdrawalTimestamp = uint32(block.timestamp);\n }\n\n /// Finalizes a pending withdrawal from a publisher\n function finalizeWithdrawal() override public {\n Bond storage bond = bonds[msg.sender];\n\n require(\n block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, \n Errors.TOO_EARLY\n );\n require(bond.state == State.WITHDRAWING, Errors.SLASHED);\n \n // refunds!\n bond.state = State.NOT_COLLATERALIZED;\n bond.withdrawalTimestamp = 0;\n \n require(\n token.transfer(msg.sender, requiredCollateral),\n Errors.ERC20_ERR\n );\n }\n\n /// Claims the user's reward for the witnesses they provided for the earliest\n /// disputed state root of the designated publisher\n function claim(address who) override public {\n Bond storage bond = bonds[who];\n require(\n block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod,\n Errors.WAIT_FOR_DISPUTES\n );\n\n // reward the earliest state root for this publisher\n bytes32 _preStateRoot = bond.earliestDisputedStateRoot;\n Rewards storage rewards = witnessProviders[_preStateRoot];\n\n // only allow claiming if fraud was proven in `finalize`\n require(rewards.canClaim, Errors.CANNOT_CLAIM);\n\n // proportional allocation - only reward 50% (rest gets locked in the\n // contract forever\n uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total);\n\n // reset the user's spent gas so they cannot double claim\n rewards.gasSpent[msg.sender] = 0;\n\n // transfer\n require(token.transfer(msg.sender, amount), Errors.ERC20_ERR);\n }\n\n /// Checks if the user is collateralized\n function isCollateralized(address who) override public view returns (bool) {\n return bonds[who].state == State.COLLATERALIZED;\n }\n\n /// Gets how many witnesses the user has provided for the state root\n function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) {\n return witnessProviders[preStateRoot].gasSpent[who];\n }\n}\n" + }, + "contracts/test-helpers/Mock_FraudVerifier.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { OVM_BondManager } from \"./../optimistic-ethereum/OVM/verification/OVM_BondManager.sol\";\n\ncontract Mock_FraudVerifier {\n OVM_BondManager bondManager;\n\n mapping (bytes32 => address) transitioners;\n\n function setBondManager(OVM_BondManager _bondManager) public {\n bondManager = _bondManager;\n }\n\n function setStateTransitioner(bytes32 preStateRoot, bytes32 txHash, address addr) public {\n transitioners[keccak256(abi.encodePacked(preStateRoot, txHash))] = addr;\n }\n\n function getStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n public\n view\n returns (\n address\n )\n {\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\n }\n\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) public {\n bondManager.finalize(_preStateRoot, publisher, timestamp);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\n\n/* Interface Imports */\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/* External Imports */\nimport '@openzeppelin/contracts/math/SafeMath.sol';\n\n/**\n * @title OVM_StateCommitmentChain\n * @dev The State Commitment Chain (SCC) contract contains a list of proposed state roots which\n * Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). \n * Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique\n * state root calculated off-chain by applying the canonical transactions one by one.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResolver {\n\n /*************\n * Constants *\n *************/\n\n uint256 public FRAUD_PROOF_WINDOW;\n uint256 public SEQUENCER_PUBLISH_WINDOW;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager,\n uint256 _fraudProofWindow,\n uint256 _sequencerPublishWindow\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:SCC:batches\")\n );\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getTotalElements()\n override\n public\n view\n returns (\n uint256 _totalElements\n )\n {\n (uint40 totalElements, ) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getTotalBatches()\n override\n public\n view\n returns (\n uint256 _totalBatches\n )\n {\n return batches().length();\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getLastSequencerTimestamp()\n override\n public\n view\n returns (\n uint256 _lastSequencerTimestamp\n )\n {\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n return uint256(lastSequencerTimestamp);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function appendStateBatch(\n bytes32[] memory _batch,\n uint256 _shouldStartAtElement\n )\n override\n public\n {\n // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the\n // publication of batches by some other user.\n require(\n _shouldStartAtElement == getTotalElements(),\n \"Actual batch start index does not match expected start index.\"\n );\n\n // Proposers must have previously staked at the BondManager\n require(\n iOVM_BondManager(resolve(\"OVM_BondManager\")).isCollateralized(msg.sender),\n \"Proposer does not have enough collateral posted\"\n );\n\n require(\n _batch.length > 0,\n \"Cannot submit an empty state batch.\"\n );\n\n require(\n getTotalElements() + _batch.length <= iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\")).getTotalElements(),\n \"Number of state roots cannot exceed the number of canonical transactions.\"\n );\n\n // Pass the block's timestamp and the publisher of the data\n // to be used in the fraud proofs\n _appendBatch(\n _batch,\n abi.encode(block.timestamp, msg.sender)\n );\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function deleteStateBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n override\n public\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"State batches can only be deleted by the OVM_FraudVerifier.\"\n );\n\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n require(\n insideFraudProofWindow(_batchHeader),\n \"State batches can only be deleted within the fraud proof window.\"\n );\n\n _deleteBatch(_batchHeader);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n override\n public\n view\n returns (\n bool\n )\n {\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n require(\n Lib_MerkleTree.verify(\n _batchHeader.batchRoot,\n _element,\n _proof.index,\n _proof.siblings,\n _batchHeader.batchSize\n ),\n \"Invalid inclusion proof.\"\n );\n\n return true;\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function insideFraudProofWindow(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n override\n public\n view\n returns (\n bool _inside\n )\n {\n (uint256 timestamp,) = abi.decode(\n _batchHeader.extraData,\n (uint256, address)\n );\n\n require(\n timestamp != 0,\n \"Batch header timestamp cannot be zero\"\n );\n return SafeMath.add(timestamp, FRAUD_PROOF_WINDOW) > block.timestamp;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Parses the batch context from the extra data.\n * @return Total number of elements submitted.\n * @return Timestamp of the last batch submitted by the sequencer.\n */\n function _getBatchExtraData()\n internal\n view\n returns (\n uint40,\n uint40\n )\n {\n bytes27 extraData = batches().getGlobalMetadata();\n\n uint40 totalElements;\n uint40 lastSequencerTimestamp;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n lastSequencerTimestamp := shr(40, and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\n }\n\n return (\n totalElements,\n lastSequencerTimestamp\n );\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _lastSequencerTimestamp Timestamp of the last batch submitted by the sequencer.\n * @return Encoded batch context.\n */\n function _makeBatchExtraData(\n uint40 _totalElements,\n uint40 _lastSequencerTimestamp\n )\n internal\n pure\n returns (\n bytes27\n )\n {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _lastSequencerTimestamp))\n extraData := shl(40, extraData)\n }\n\n return extraData;\n }\n\n /**\n * Appends a batch to the chain.\n * @param _batch Elements within the batch.\n * @param _extraData Any extra data to append to the batch.\n */\n function _appendBatch(\n bytes32[] memory _batch,\n bytes memory _extraData\n )\n internal\n {\n address sequencer = resolve(\"OVM_Sequencer\");\n (uint40 totalElements, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n\n if (msg.sender == sequencer) {\n lastSequencerTimestamp = uint40(block.timestamp);\n } else {\n // We keep track of the last batch submitted by the sequencer so there's a window in\n // which only the sequencer can publish state roots. A window like this just reduces\n // the chance of \"system breaking\" state roots being published while we're still in\n // testing mode. This window should be removed or significantly reduced in the future.\n require(\n lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp,\n \"Cannot publish state roots within the sequencer publication window.\"\n );\n }\n\n Lib_OVMCodec.ChainBatchHeader memory batchHeader = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: getTotalBatches(),\n batchRoot: Lib_MerkleTree.getMerkleRoot(_batch),\n batchSize: _batch.length,\n prevTotalElements: totalElements,\n extraData: _extraData\n });\n\n emit StateBatchAppended(\n batchHeader.batchIndex,\n batchHeader.batchRoot,\n batchHeader.batchSize,\n batchHeader.prevTotalElements,\n batchHeader.extraData\n );\n\n batches().push(\n Lib_OVMCodec.hashBatchHeader(batchHeader),\n _makeBatchExtraData(\n uint40(batchHeader.prevTotalElements + batchHeader.batchSize),\n lastSequencerTimestamp\n )\n );\n }\n\n /**\n * Removes a batch and all subsequent batches from the chain.\n * @param _batchHeader Header of the batch to remove.\n */\n function _deleteBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n {\n require(\n _batchHeader.batchIndex < batches().length(),\n \"Invalid batch index.\"\n );\n\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n batches().deleteElementsAfterInclusive(\n _batchHeader.batchIndex,\n _makeBatchExtraData(\n uint40(_batchHeader.prevTotalElements),\n 0\n )\n );\n\n emit StateBatchDeleted(\n _batchHeader.batchIndex,\n _batchHeader.batchRoot\n );\n }\n\n /**\n * Checks that a batch header matches the stored hash for the given index.\n * @param _batchHeader Batch header to validate.\n * @return Whether or not the header matches the stored one.\n */\n function _isValidBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n view\n returns (\n bool\n )\n {\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_MerkleTree\n * @author River Keefer\n */\nlibrary Lib_MerkleTree {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\n * If you do not know the original length of elements for the tree you are verifying,\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\n * @param _elements Array of hashes from which to generate a merkle root.\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\n */\n function getMerkleRoot(\n bytes32[] memory _elements\n )\n internal\n view\n returns (\n bytes32\n )\n {\n require(\n _elements.length > 0,\n \"Lib_MerkleTree: Must provide at least one leaf hash.\"\n );\n\n if (_elements.length == 0) {\n return _elements[0];\n }\n\n uint256[16] memory defaults = [\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\n ];\n\n // Reserve memory space for our hashes.\n bytes memory buf = new bytes(64);\n\n // We'll need to keep track of left and right siblings.\n bytes32 leftSibling;\n bytes32 rightSibling;\n\n // Number of non-empty nodes at the current depth.\n uint256 rowSize = _elements.length;\n\n // Current depth, counting from 0 at the leaves\n uint256 depth = 0;\n\n // Common sub-expressions\n uint256 halfRowSize; // rowSize / 2\n bool rowSizeIsOdd; // rowSize % 2 == 1\n\n while (rowSize > 1) {\n halfRowSize = rowSize / 2;\n rowSizeIsOdd = rowSize % 2 == 1;\n\n for (uint256 i = 0; i < halfRowSize; i++) {\n leftSibling = _elements[(2 * i) ];\n rightSibling = _elements[(2 * i) + 1];\n assembly {\n mstore(add(buf, 32), leftSibling )\n mstore(add(buf, 64), rightSibling)\n }\n\n _elements[i] = keccak256(buf);\n }\n\n if (rowSizeIsOdd) {\n leftSibling = _elements[rowSize - 1];\n rightSibling = bytes32(defaults[depth]);\n assembly {\n mstore(add(buf, 32), leftSibling)\n mstore(add(buf, 64), rightSibling)\n }\n\n _elements[halfRowSize] = keccak256(buf);\n }\n\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\n depth++;\n }\n\n return _elements[0];\n }\n\n /**\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\n * of leaves generated is a known, correct input, and does not return true for indices \n * extending past that index (even if _siblings would be otherwise valid.)\n * @param _root The Merkle root to verify against.\n * @param _leaf The leaf hash to verify inclusion of.\n * @param _index The index in the tree of this leaf.\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \n * @param _totalLeaves The total number of leaves originally passed into.\n * @return Whether or not the merkle branch and leaf passes verification.\n */\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n )\n internal\n pure\n returns (\n bool\n )\n {\n require(\n _totalLeaves > 0,\n \"Lib_MerkleTree: Total leaves must be greater than zero.\"\n );\n\n require(\n _index < _totalLeaves,\n \"Lib_MerkleTree: Index out of bounds.\"\n );\n\n require(\n _siblings.length == _ceilLog2(_totalLeaves),\n \"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\"\n );\n\n bytes32 computedRoot = _leaf;\n\n for (uint256 i = 0; i < _siblings.length; i++) {\n if ((_index & 1) == 1) {\n computedRoot = keccak256(\n abi.encodePacked(\n _siblings[i],\n computedRoot\n )\n );\n } else {\n computedRoot = keccak256(\n abi.encodePacked(\n computedRoot,\n _siblings[i]\n )\n );\n }\n\n _index >>= 1;\n }\n\n return _root == computedRoot;\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Calculates the integer ceiling of the log base 2 of an input.\n * @param _in Unsigned input to calculate the log.\n * @return ceil(log_base_2(_in))\n */\n function _ceilLog2(\n uint256 _in\n )\n private\n pure\n returns (\n uint256\n )\n { \n require(\n _in > 0,\n \"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\"\n );\n\n if (_in == 1) {\n return 0;\n }\n\n // Find the highest set bit (will be floor(log_2)).\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\n uint256 val = _in;\n uint256 highest = 0;\n for (uint8 i = 128; i >= 1; i >>= 1) {\n if (val & (uint(1) << i) - 1 << i != 0) {\n highest += i;\n val >>= i;\n }\n }\n\n // Increment by one if this is not a perfect logarithm.\n if ((uint(1) << highest) != _in) {\n highest += 1;\n }\n\n return highest;\n }\n}\n" + }, + "@openzeppelin/contracts/math/SafeMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_RingBuffer } from \"../../libraries/utils/Lib_RingBuffer.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/**\n * @title OVM_ChainStorageContainer\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\n * transactions being finalized.\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\n * 1. Stores transaction batches for the Canonical Transaction Chain\n * 2. Stores queued transactions for the Canonical Transaction Chain\n * 3. Stores chain state batches for the State Commitment Chain\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\n\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_RingBuffer.RingBuffer internal buffer;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n * @param _owner Name of the contract that owns this container (will be resolved later).\n */\n constructor(\n address _libAddressManager,\n string memory _owner\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n owner = _owner;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n msg.sender == resolve(owner),\n \"OVM_ChainStorageContainer: Function can only be called by the owner.\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function setGlobalMetadata(\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n return buffer.setExtraData(_globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function getGlobalMetadata()\n override\n public\n view\n returns (\n bytes27\n )\n {\n return buffer.getExtraData();\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function length()\n override\n public\n view\n returns (\n uint256\n )\n {\n return uint256(buffer.getLength());\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push(\n bytes32 _object\n )\n override\n public\n onlyOwner\n {\n buffer.push(_object);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push(\n bytes32 _object,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.push(_object, _globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB\n )\n override\n public\n onlyOwner\n {\n buffer.push2(_objectA, _objectB);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.push2(_objectA, _objectB, _globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function get(\n uint256 _index\n )\n override\n public\n view\n returns (\n bytes32\n )\n {\n return buffer.get(uint40(_index));\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function deleteElementsAfterInclusive(\n uint256 _index\n )\n override\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(\n uint40(_index)\n );\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function deleteElementsAfterInclusive(\n uint256 _index,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(\n uint40(_index),\n _globalMetadata\n );\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function setNextOverwritableIndex(\n uint256 _index\n )\n override\n public\n onlyOwner\n {\n buffer.nextOverwritableIndex = _index;\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nlibrary Lib_RingBuffer {\n using Lib_RingBuffer for RingBuffer;\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n uint256 length;\n mapping (uint256 => bytes32) buf;\n }\n\n struct RingBuffer {\n bytes32 contextA;\n bytes32 contextB;\n Buffer bufferA;\n Buffer bufferB;\n uint256 nextOverwritableIndex;\n }\n\n struct RingBufferContext {\n // contextA\n uint40 globalIndex;\n bytes27 extraData;\n\n // contextB\n uint64 currBufferIndex;\n uint40 prevResetIndex;\n uint40 currResetIndex;\n }\n\n\n /*************\n * Constants *\n *************/\n\n uint256 constant MIN_CAPACITY = 16;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n * @param _extraData Optional global extra data.\n */\n function push(\n RingBuffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n\n // Set a minimum capacity.\n if (currBuffer.length == 0) {\n currBuffer.length = MIN_CAPACITY;\n }\n\n // Check if we need to expand the buffer.\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\n // We're going to overwrite the inactive buffer.\n // Bump the buffer index, reset the delete offset, and set our reset indices.\n ctx.currBufferIndex++;\n ctx.prevResetIndex = ctx.currResetIndex;\n ctx.currResetIndex = ctx.globalIndex;\n\n // Swap over to the next buffer.\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\n } else {\n // We're not overwriting yet, double the length of the current buffer.\n currBuffer.length *= 2;\n }\n }\n\n // Index to write to is the difference of the global and reset indices.\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\n currBuffer.buf[writeHead] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.globalIndex++;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n */\n function push(\n RingBuffer storage _self,\n bytes32 _value\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n \n _self.push(\n _value,\n ctx.extraData\n );\n }\n\n /**\n * Pushes a two elements to the buffer.\n * @param _self Buffer to access.\n * @param _valueA First value to push to the buffer.\n * @param _valueA Second value to push to the buffer.\n * @param _extraData Optional global extra data.\n */\n function push2(\n RingBuffer storage _self,\n bytes32 _valueA,\n bytes32 _valueB,\n bytes27 _extraData\n )\n internal\n {\n _self.push(_valueA, _extraData);\n _self.push(_valueB, _extraData);\n }\n\n /**\n * Pushes a two elements to the buffer.\n * @param _self Buffer to access.\n * @param _valueA First value to push to the buffer.\n * @param _valueA Second value to push to the buffer.\n */\n function push2(\n RingBuffer storage _self,\n bytes32 _valueA,\n bytes32 _valueB\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n\n _self.push2(\n _valueA,\n _valueB,\n ctx.extraData\n );\n }\n\n /**\n * Retrieves an element from the buffer.\n * @param _self Buffer to access.\n * @param _index Element index to retrieve.\n * @return Value of the element at the given index.\n */\n function get(\n RingBuffer storage _self,\n uint256 _index\n )\n internal\n view\n returns (\n bytes32 \n )\n {\n RingBufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.globalIndex,\n \"Index out of bounds.\"\n );\n\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\n\n if (_index >= ctx.currResetIndex) {\n // We're trying to load an element from the current buffer.\n // Relative index is just the difference from the reset index.\n uint256 relativeIndex = _index - ctx.currResetIndex;\n\n // Shouldn't happen but why not check.\n require(\n relativeIndex < currBuffer.length,\n \"Index out of bounds.\"\n );\n\n return currBuffer.buf[relativeIndex];\n } else {\n // We're trying to load an element from the previous buffer.\n // Relative index is the difference from the reset index in the other direction.\n uint256 relativeIndex = ctx.currResetIndex - _index;\n\n // Condition only fails in the case that we deleted and flipped buffers.\n require(\n ctx.currResetIndex > ctx.prevResetIndex,\n \"Index out of bounds.\"\n );\n\n // Make sure we're not trying to read beyond the array.\n require(\n relativeIndex <= prevBuffer.length,\n \"Index out of bounds.\"\n );\n\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\n }\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n * @param _extraData Optional global extra data.\n */\n function deleteElementsAfterInclusive(\n RingBuffer storage _self,\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\n \"Index out of bounds.\"\n );\n\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\n\n if (_index < ctx.currResetIndex) {\n // We're switching back to the previous buffer.\n // Reduce the buffer index, set the current reset index back to match the previous one.\n // We use the equality of these two values to prevent reading beyond this buffer.\n ctx.currBufferIndex--;\n ctx.currResetIndex = ctx.prevResetIndex;\n }\n\n // Set our global index and extra data, save the context.\n ctx.globalIndex = _index;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n */\n function deleteElementsAfterInclusive(\n RingBuffer storage _self,\n uint40 _index\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n _self.deleteElementsAfterInclusive(\n _index,\n ctx.extraData\n );\n }\n\n /**\n * Retrieves the current global index.\n * @param _self Buffer to access.\n * @return Current global index.\n */\n function getLength(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n uint40\n )\n {\n RingBufferContext memory ctx = _self.getContext();\n return ctx.globalIndex;\n }\n\n /**\n * Changes current global extra data.\n * @param _self Buffer to access.\n * @param _extraData New global extra data.\n */\n function setExtraData(\n RingBuffer storage _self,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Retrieves the current global extra data.\n * @param _self Buffer to access.\n * @return Current global extra data.\n */\n function getExtraData(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n bytes27\n )\n {\n RingBufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current ring buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current ring buffer context.\n */\n function setContext(\n RingBuffer storage _self,\n RingBufferContext memory _ctx\n )\n internal\n returns (\n bytes32\n )\n {\n bytes32 contextA;\n bytes32 contextB;\n\n uint40 globalIndex = _ctx.globalIndex;\n bytes27 extraData = _ctx.extraData;\n assembly {\n contextA := globalIndex\n contextA := or(contextA, extraData)\n }\n\n uint64 currBufferIndex = _ctx.currBufferIndex;\n uint40 prevResetIndex = _ctx.prevResetIndex;\n uint40 currResetIndex = _ctx.currResetIndex;\n assembly {\n contextB := currBufferIndex\n contextB := or(contextB, shl(64, prevResetIndex))\n contextB := or(contextB, shl(104, currResetIndex))\n }\n\n if (_self.contextA != contextA) {\n _self.contextA = contextA;\n }\n\n if (_self.contextB != contextB) {\n _self.contextB = contextB;\n }\n }\n\n /**\n * Retrieves the current ring buffer context.\n * @param _self Buffer to access.\n * @return Current ring buffer context.\n */\n function getContext(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n RingBufferContext memory\n )\n {\n bytes32 contextA = _self.contextA;\n bytes32 contextB = _self.contextB;\n\n uint40 globalIndex;\n bytes27 extraData;\n assembly {\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n }\n\n uint64 currBufferIndex;\n uint40 prevResetIndex;\n uint40 currResetIndex;\n assembly {\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\n }\n\n return RingBufferContext({\n globalIndex: globalIndex,\n extraData: extraData,\n currBufferIndex: currBufferIndex,\n prevResetIndex: prevResetIndex,\n currResetIndex: currResetIndex\n });\n }\n\n /**\n * Retrieves the a buffer from the ring buffer by index.\n * @param _self Buffer to access.\n * @param _which Index of the sub buffer to access.\n * @return Sub buffer for the index.\n */\n function getBuffer(\n RingBuffer storage _self,\n uint256 _which\n )\n internal\n view\n returns (\n Buffer storage\n )\n {\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_RingBuffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RingBuffer } from \"../../optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\";\n\n/**\n * @title TestLib_RingBuffer\n */\ncontract TestLib_RingBuffer {\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\n \n Lib_RingBuffer.RingBuffer internal buf;\n\n function push(\n bytes32 _value,\n bytes27 _extraData\n )\n public\n {\n buf.push(\n _value,\n _extraData\n );\n }\n\n function push2(\n bytes32 _valueA,\n bytes32 _valueB,\n bytes27 _extraData\n )\n public\n {\n buf.push2(\n _valueA,\n _valueB,\n _extraData\n );\n }\n\n function get(\n uint256 _index\n )\n public\n view\n returns (\n bytes32 \n )\n {\n return buf.get(_index);\n }\n\n function deleteElementsAfterInclusive(\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n return buf.deleteElementsAfterInclusive(\n _index,\n _extraData\n );\n }\n\n function getLength()\n internal\n view\n returns (\n uint40\n )\n {\n return buf.getLength();\n }\n\n function getExtraData()\n internal\n view\n returns (\n bytes27\n )\n {\n return buf.getExtraData();\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\nimport { Lib_Math } from \"../../libraries/utils/Lib_Math.sol\";\n\n/* Interface Imports */\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/* Contract Imports */\nimport { OVM_ExecutionManager } from \"../execution/OVM_ExecutionManager.sol\";\n\n\n/**\n * @title OVM_CanonicalTransactionChain\n * @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions\n * which must be applied to the rollup state. It defines the ordering of rollup transactions by\n * writing them to the 'CTC:batches' instance of the Chain Storage Container.\n * The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer\n * will eventually append it to the rollup state.\n * If the Sequencer does not include an enqueued transaction within the 'force inclusion period',\n * then any account may force it to be included by calling appendQueueBatch().\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_AddressResolver {\n\n /*************\n * Constants *\n *************/\n\n // L2 tx gas-related\n uint256 constant public MIN_ROLLUP_TX_GAS = 100000;\n uint256 constant public MAX_ROLLUP_TX_SIZE = 10000;\n uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 32;\n\n // Encoding-related (all in bytes)\n uint256 constant internal BATCH_CONTEXT_SIZE = 16;\n uint256 constant internal BATCH_CONTEXT_LENGTH_POS = 12;\n uint256 constant internal BATCH_CONTEXT_START_POS = 15;\n uint256 constant internal TX_DATA_HEADER_SIZE = 3;\n uint256 constant internal BYTES_TILL_TX_DATA = 65;\n\n\n /*************\n * Variables *\n *************/\n\n uint256 public forceInclusionPeriodSeconds;\n uint256 public forceInclusionPeriodBlocks;\n uint256 public maxTransactionGasLimit;\n\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager,\n uint256 _forceInclusionPeriodSeconds,\n uint256 _forceInclusionPeriodBlocks,\n uint256 _maxTransactionGasLimit\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds;\n forceInclusionPeriodBlocks = _forceInclusionPeriodBlocks;\n maxTransactionGasLimit = _maxTransactionGasLimit;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n override\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:CTC:batches\")\n );\n }\n\n /**\n * Accesses the queue storage container.\n * @return Reference to the queue storage container.\n */\n function queue()\n override\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:CTC:queue\")\n );\n }\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n override\n public\n view\n returns (\n uint256 _totalElements\n )\n {\n (uint40 totalElements,,,) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n override\n public\n view\n returns (\n uint256 _totalBatches\n )\n {\n return batches().length();\n }\n\n /**\n * Returns the index of the next element to be enqueued.\n * @return Index for the next queue element.\n */\n function getNextQueueIndex()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,uint40 nextQueueIndex,,) = _getBatchExtraData();\n return nextQueueIndex;\n }\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,,uint40 lastTimestamp,) = _getBatchExtraData();\n return lastTimestamp;\n }\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,,,uint40 lastBlockNumber) = _getBatchExtraData();\n return lastBlockNumber;\n }\n\n /**\n * Gets the queue element at a particular index.\n * @param _index Index of the queue element to access.\n * @return _element Queue element at the given index.\n */\n function getQueueElement(\n uint256 _index\n )\n override\n public\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n iOVM_ChainStorageContainer queue = queue();\n\n uint40 trueIndex = uint40(_index * 2);\n bytes32 queueRoot = queue.get(trueIndex);\n bytes32 timestampAndBlockNumber = queue.get(trueIndex + 1);\n\n uint40 elementTimestamp;\n uint40 elementBlockNumber;\n assembly {\n elementTimestamp := and(timestampAndBlockNumber, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n elementBlockNumber := shr(40, and(timestampAndBlockNumber, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\n }\n\n return Lib_OVMCodec.QueueElement({\n queueRoot: queueRoot,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Get the number of queue elements which have not yet been included.\n * @return Number of pending queue elements.\n */\n function getNumPendingQueueElements()\n override\n public\n view\n returns (\n uint40\n )\n {\n return getQueueLength() - getNextQueueIndex();\n }\n\n /**\n * Retrieves the length of the queue, including\n * both pending and canonical transactions.\n * @return Length of the queue.\n */\n function getQueueLength()\n override\n public\n view\n returns (\n uint40\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the real queue length we need\n // to divide by 2. See the usage of `push2(..)`.\n return uint40(queue().length() / 2);\n }\n\n /**\n * Adds a transaction to the queue.\n * @param _target Target L2 contract to send the transaction to.\n * @param _gasLimit Gas limit for the enqueued L2 transaction.\n * @param _data Transaction data.\n */\n function enqueue(\n address _target,\n uint256 _gasLimit,\n bytes memory _data\n )\n override\n public\n {\n require(\n _data.length <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n require(\n _gasLimit <= maxTransactionGasLimit,\n \"Transaction gas limit exceeds maximum for rollup transaction.\"\n );\n\n require(\n _gasLimit >= MIN_ROLLUP_TX_GAS,\n \"Transaction gas limit too low to enqueue.\"\n );\n\n // We need to consume some amount of L1 gas in order to rate limit transactions going into\n // L2. However, L2 is cheaper than L1 so we only need to burn some small proportion of the\n // provided L1 gas.\n uint256 gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;\n uint256 startingGas = gasleft();\n\n // Although this check is not necessary (burn below will run out of gas if not true), it\n // gives the user an explicit reason as to why the enqueue attempt failed.\n require(\n startingGas > gasToConsume,\n \"Insufficient gas for L2 rate limiting burn.\"\n );\n\n // Here we do some \"dumb\" work in order to burn gas, although we should probably replace\n // this with something like minting gas token later on.\n uint256 i;\n while(startingGas - gasleft() < gasToConsume) {\n i++;\n }\n\n bytes32 transactionHash = keccak256(\n abi.encode(\n msg.sender,\n _target,\n _gasLimit,\n _data\n )\n );\n\n bytes32 timestampAndBlockNumber;\n assembly {\n timestampAndBlockNumber := timestamp()\n timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))\n }\n\n iOVM_ChainStorageContainer queue = queue();\n\n queue.push2(\n transactionHash,\n timestampAndBlockNumber\n );\n\n uint256 queueIndex = queue.length() / 2;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex - 1,\n block.timestamp\n );\n }\n\n /**\n * Appends a given number of queued transactions as a single batch.\n * @param _numQueuedTransactions Number of transactions to append.\n */\n function appendQueueBatch(\n uint256 _numQueuedTransactions\n )\n override\n public\n {\n // Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n _numQueuedTransactions = Lib_Math.min(_numQueuedTransactions, getNumPendingQueueElements());\n require(\n _numQueuedTransactions > 0,\n \"Must append more than zero transactions.\"\n );\n\n bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);\n uint40 nextQueueIndex = getNextQueueIndex();\n\n for (uint256 i = 0; i < _numQueuedTransactions; i++) {\n if (msg.sender != resolve(\"OVM_Sequencer\")) {\n Lib_OVMCodec.QueueElement memory el = getQueueElement(nextQueueIndex);\n require(\n el.timestamp + forceInclusionPeriodSeconds < block.timestamp,\n \"Queue transactions cannot be submitted during the sequencer inclusion period.\"\n );\n }\n leaves[i] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n }\n\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\n\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n _numQueuedTransactions,\n _numQueuedTransactions,\n lastElement.timestamp,\n lastElement.blockNumber\n );\n\n emit QueueBatchAppended(\n nextQueueIndex - _numQueuedTransactions,\n _numQueuedTransactions,\n getTotalElements()\n );\n }\n\n /**\n * Allows the sequencer to append a batch of transactions.\n * @dev This function uses a custom encoding scheme for efficiency reasons.\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\n * .param _contexts Array of batch contexts.\n * .param _transactionDataFields Array of raw transaction data.\n */\n function appendSequencerBatch()\n override\n public\n {\n uint40 shouldStartAtElement;\n uint24 totalElementsToAppend;\n uint24 numContexts;\n assembly {\n shouldStartAtElement := shr(216, calldataload(4))\n totalElementsToAppend := shr(232, calldataload(9))\n numContexts := shr(232, calldataload(12))\n }\n\n require(\n shouldStartAtElement == getTotalElements(),\n \"Actual batch start index does not match expected start index.\"\n );\n\n require(\n msg.sender == resolve(\"OVM_Sequencer\"),\n \"Function can only be called by the Sequencer.\"\n );\n\n require(\n numContexts > 0,\n \"Must provide at least one batch context.\"\n );\n\n require(\n totalElementsToAppend > 0,\n \"Must append at least one element.\"\n );\n\n uint40 nextTransactionPtr = uint40(BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts);\n uint256 calldataSize;\n assembly {\n calldataSize := calldatasize()\n }\n\n require(\n calldataSize >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Get queue length for future comparison/\n uint40 queueLength = getQueueLength();\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n // We will sequentially append leaves which are pointers to the queue.\n // The initial queue index is what is currently in storage.\n uint40 nextQueueIndex = getNextQueueIndex();\n\n BatchContext memory curContext;\n\n for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n if (i == 0) {\n _validateFirstBatchContext(nextContext);\n }\n _validateNextBatchContext(curContext, nextContext, nextQueueIndex);\n\n curContext = nextContext;\n\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n\n leaves[leafIndex] = _getSequencerLeafHash(curContext, nextTransactionPtr, txDataLength);\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(nextQueueIndex < queueLength, \"Not enough queued transactions to append.\");\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(curContext);\n\n require(\n calldataSize == nextTransactionPtr,\n \"Not all sequencer transactions were processed.\"\n );\n\n require(\n leafIndex == totalElementsToAppend,\n \"Actual transaction index does not match expected total elements to append.\"\n );\n\n // Generate the required metadata that we need to append this batch\n uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions;\n uint40 timestamp;\n uint40 blockNumber;\n if (curContext.numSubsequentQueueTransactions == 0) {\n // The last element is a sequencer tx, therefore pull timestamp and block number from the last context.\n timestamp = uint40(curContext.timestamp);\n blockNumber = uint40(curContext.blockNumber);\n } else {\n // The last element is a queue tx, therefore pull timestamp and block number from the queue element.\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\n timestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n timestamp,\n blockNumber\n );\n\n emit SequencerBatchAppended(\n nextQueueIndex - numQueuedTransactions,\n numQueuedTransactions,\n getTotalElements()\n );\n }\n\n /**\n * Verifies whether a transaction is included in the chain.\n * @param _transaction Transaction to verify.\n * @param _txChainElement Transaction chain element corresponding to the transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\n * @return True if the transaction exists in the CTC, false if not.\n */\n function verifyTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n override\n public\n view\n returns (\n bool\n )\n {\n if (_txChainElement.isSequenced == true) {\n return _verifySequencerTransaction(\n _transaction,\n _txChainElement,\n _batchHeader,\n _inclusionProof\n );\n } else {\n return _verifyQueueTransaction(\n _transaction,\n _txChainElement.queueIndex,\n _batchHeader,\n _inclusionProof\n );\n }\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Returns the BatchContext located at a particular index.\n * @param _index The index of the BatchContext\n * @return The BatchContext at the specified index.\n */\n function _getBatchContext(\n uint256 _index\n )\n internal\n pure\n returns (\n BatchContext memory\n )\n {\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 ctxTimestamp;\n uint256 ctxBlockNumber;\n\n assembly {\n numSequencedTransactions := shr(232, calldataload(contextPtr))\n numSubsequentQueueTransactions := shr(232, calldataload(add(contextPtr, 3)))\n ctxTimestamp := shr(216, calldataload(add(contextPtr, 6)))\n ctxBlockNumber := shr(216, calldataload(add(contextPtr, 11)))\n }\n\n return BatchContext({\n numSequencedTransactions: numSequencedTransactions,\n numSubsequentQueueTransactions: numSubsequentQueueTransactions,\n timestamp: ctxTimestamp,\n blockNumber: ctxBlockNumber\n });\n }\n\n /**\n * Parses the batch context from the extra data.\n * @return Total number of elements submitted.\n * @return Index of the next queue element.\n */\n function _getBatchExtraData()\n internal\n view\n returns (\n uint40,\n uint40,\n uint40,\n uint40\n )\n {\n bytes27 extraData = batches().getGlobalMetadata();\n\n uint40 totalElements;\n uint40 nextQueueIndex;\n uint40 lastTimestamp;\n uint40 lastBlockNumber;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n nextQueueIndex := shr(40, and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000))\n lastTimestamp := shr(80, and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000))\n lastBlockNumber := shr(120, and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000))\n }\n\n return (\n totalElements,\n nextQueueIndex,\n lastTimestamp,\n lastBlockNumber\n );\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _nextQueueIndex Index of the next queue element.\n * @param _timestamp Timestamp for the last batch.\n * @param _blockNumber Block number of the last batch.\n * @return Encoded batch context.\n */\n function _makeBatchExtraData(\n uint40 _totalElements,\n uint40 _nextQueueIndex,\n uint40 _timestamp,\n uint40 _blockNumber\n )\n internal\n pure\n returns (\n bytes27\n )\n {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _nextQueueIndex))\n extraData := or(extraData, shl(80, _timestamp))\n extraData := or(extraData, shl(120, _blockNumber))\n extraData := shl(40, extraData)\n }\n\n return extraData;\n }\n\n /**\n * Retrieves the hash of a queue element.\n * @param _index Index of the queue element to retrieve a hash for.\n * @return Hash of the queue element.\n */\n function _getQueueLeafHash(\n uint256 _index\n )\n internal\n view\n returns (\n bytes32\n )\n {\n return _hashTransactionChainElement(\n Lib_OVMCodec.TransactionChainElement({\n isSequenced: false,\n queueIndex: _index,\n timestamp: 0,\n blockNumber: 0,\n txData: hex\"\"\n })\n );\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength()\n internal\n view\n returns (\n uint40\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the real queue length we need\n // to divide by 2. See the usage of `push2(..)`.\n return uint40(queue().length() / 2);\n }\n\n /**\n * Retrieves the hash of a sequencer element.\n * @param _context Batch context for the given element.\n * @param _nextTransactionPtr Pointer to the next transaction in the calldata.\n * @param _txDataLength Length of the transaction item.\n * @return Hash of the sequencer element.\n */\n function _getSequencerLeafHash(\n BatchContext memory _context,\n uint256 _nextTransactionPtr,\n uint256 _txDataLength\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(chainElement, 0x20)\n\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\n // This distinguishes sequencer ChainElements from queue ChainElements because\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\n // elements is always zero\n mstore8(chainElementStart, 1)\n\n mstore(add(chainElementStart, 1), ctxTimestamp)\n mstore(add(chainElementStart, 33), ctxBlockNumber)\n\n calldatacopy(add(chainElementStart, BYTES_TILL_TX_DATA), add(_nextTransactionPtr, 3), _txDataLength)\n\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, _txDataLength))\n }\n\n return leafHash;\n }\n\n /**\n * Retrieves the hash of a sequencer element.\n * @param _txChainElement The chain element which is hashed to calculate the leaf.\n * @return Hash of the sequencer element.\n */\n function _getSequencerLeafHash(\n Lib_OVMCodec.TransactionChainElement memory _txChainElement\n )\n internal\n view\n returns(\n bytes32\n )\n {\n bytes memory txData = _txChainElement.txData;\n uint256 txDataLength = _txChainElement.txData.length;\n\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + txDataLength);\n uint256 ctxTimestamp = _txChainElement.timestamp;\n uint256 ctxBlockNumber = _txChainElement.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(chainElement, 0x20)\n\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\n // This distinguishes sequencer ChainElements from queue ChainElements because\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\n // elements is always zero\n mstore8(chainElementStart, 1)\n\n mstore(add(chainElementStart, 1), ctxTimestamp)\n mstore(add(chainElementStart, 33), ctxBlockNumber)\n\n pop(staticcall(gas(), 0x04, add(txData, 0x20), txDataLength, add(chainElementStart, BYTES_TILL_TX_DATA), txDataLength))\n\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, txDataLength))\n }\n\n return leafHash;\n }\n\n /**\n * Inserts a batch into the chain of batches.\n * @param _transactionRoot Root of the transaction tree for this batch.\n * @param _batchSize Number of elements in the batch.\n * @param _numQueuedTransactions Number of queue transactions in the batch.\n * @param _timestamp The latest batch timestamp.\n * @param _blockNumber The latest batch blockNumber.\n */\n function _appendBatch(\n bytes32 _transactionRoot,\n uint256 _batchSize,\n uint256 _numQueuedTransactions,\n uint40 _timestamp,\n uint40 _blockNumber\n )\n internal\n {\n (uint40 totalElements, uint40 nextQueueIndex, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batches().length(),\n batchRoot: _transactionRoot,\n batchSize: _batchSize,\n prevTotalElements: totalElements,\n extraData: hex\"\"\n });\n\n emit TransactionBatchAppended(\n header.batchIndex,\n header.batchRoot,\n header.batchSize,\n header.prevTotalElements,\n header.extraData\n );\n\n bytes32 batchHeaderHash = Lib_OVMCodec.hashBatchHeader(header);\n bytes27 latestBatchContext = _makeBatchExtraData(\n totalElements + uint40(header.batchSize),\n nextQueueIndex + uint40(_numQueuedTransactions),\n _timestamp,\n _blockNumber\n );\n\n batches().push(batchHeaderHash, latestBatchContext);\n }\n\n /**\n * Checks that the first batch context in a sequencer submission is valid\n * @param _firstContext The batch context to validate.\n */\n function _validateFirstBatchContext(\n BatchContext memory _firstContext\n )\n internal\n view\n {\n // If there are existing elements, this batch must come later.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n require(_firstContext.blockNumber >= lastBlockNumber, \"Context block number is lower than last submitted.\");\n require(_firstContext.timestamp >= lastTimestamp, \"Context timestamp is lower than last submitted.\");\n }\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(_firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp, \"Context timestamp too far in the past.\");\n require(_firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number, \"Context block number too far in the past.\");\n }\n\n /**\n * Checks that a given batch context is valid based on its previous context, and the next queue elemtent.\n * @param _prevContext The previously validated batch context.\n * @param _nextContext The batch context to validate with this call.\n * @param _nextQueueIndex Index of the next queue element to process for the _nextContext's subsequentQueueElements.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex\n )\n internal\n view\n {\n // All sequencer transactions' times must increase from the previous ones.\n require(\n _nextContext.timestamp >= _prevContext.timestamp,\n \"Context timestamp values must monotonically increase.\"\n );\n\n require(\n _nextContext.blockNumber >= _prevContext.blockNumber,\n \"Context blockNumber values must monotonically increase.\"\n );\n\n // If there are some queue elements pending:\n if (getQueueLength() - _nextQueueIndex > 0) {\n Lib_OVMCodec.QueueElement memory nextQueueElement = getQueueElement(_nextQueueIndex);\n\n // If the force inclusion period has passed for an enqueued transaction, it MUST be the next chain element.\n require(\n block.timestamp < nextQueueElement.timestamp + forceInclusionPeriodSeconds,\n \"Previously enqueued batches have expired and must be appended before a new sequencer batch.\"\n );\n\n // Just like sequencer transaction times must be increasing relative to each other,\n // We also require that they be increasing relative to any interspersed queue elements.\n require(\n _nextContext.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _nextContext.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\n }\n }\n\n /**\n * Checks that the final batch context in a sequencer submission is valid.\n * @param _finalContext The batch context to validate.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext\n )\n internal\n view\n {\n // Batches cannot be added from the future, or subsequent enqueue() contexts would violate monotonicity.\n require(_finalContext.timestamp <= block.timestamp, \"Context timestamp is from the future.\");\n require(_finalContext.blockNumber <= block.number, \"Context block number is from the future.\");\n }\n\n /**\n * Hashes a transaction chain element.\n * @param _element Chain element to hash.\n * @return Hash of the chain element.\n */\n function _hashTransactionChainElement(\n Lib_OVMCodec.TransactionChainElement memory _element\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n abi.encode(\n _element.isSequenced,\n _element.queueIndex,\n _element.timestamp,\n _element.blockNumber,\n _element.txData\n )\n );\n }\n\n /**\n * Verifies a sequencer transaction, returning true if it was indeed included in the CTC\n * @param _transaction The transaction we are verifying inclusion of.\n * @param _txChainElement The chain element that the transaction is claimed to be a part of.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof An inclusion proof into the CTC at a particular index.\n * @return True if the transaction was included in the specified location, else false.\n */\n function _verifySequencerTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n internal\n view\n returns (\n bool\n )\n {\n OVM_ExecutionManager ovmExecutionManager = OVM_ExecutionManager(resolve(\"OVM_ExecutionManager\"));\n uint256 gasLimit = ovmExecutionManager.getMaxTransactionGasLimit();\n bytes32 leafHash = _getSequencerLeafHash(_txChainElement);\n\n require(\n _verifyElement(\n leafHash,\n _batchHeader,\n _inclusionProof\n ),\n \"Invalid Sequencer transaction inclusion proof.\"\n );\n\n require(\n _transaction.blockNumber == _txChainElement.blockNumber\n && _transaction.timestamp == _txChainElement.timestamp\n && _transaction.entrypoint == resolve(\"OVM_DecompressionPrecompileAddress\")\n && _transaction.gasLimit == gasLimit\n && _transaction.l1TxOrigin == address(0)\n && _transaction.l1QueueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE\n && keccak256(_transaction.data) == keccak256(_txChainElement.txData),\n \"Invalid Sequencer transaction.\"\n );\n\n return true;\n }\n\n /**\n * Verifies a queue transaction, returning true if it was indeed included in the CTC\n * @param _transaction The transaction we are verifying inclusion of.\n * @param _queueIndex The queueIndex of the queued transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof An inclusion proof into the CTC at a particular index (should point to queue tx).\n * @return True if the transaction was included in the specified location, else false.\n */\n function _verifyQueueTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n uint256 _queueIndex,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n internal\n view\n returns (\n bool\n )\n {\n bytes32 leafHash = _getQueueLeafHash(_queueIndex);\n\n require(\n _verifyElement(\n leafHash,\n _batchHeader,\n _inclusionProof\n ),\n \"Invalid Queue transaction inclusion proof.\"\n );\n\n bytes32 transactionHash = keccak256(\n abi.encode(\n _transaction.l1TxOrigin,\n _transaction.entrypoint,\n _transaction.gasLimit,\n _transaction.data\n )\n );\n\n Lib_OVMCodec.QueueElement memory el = getQueueElement(_queueIndex);\n require(\n el.queueRoot == transactionHash\n && el.timestamp == _transaction.timestamp\n && el.blockNumber == _transaction.blockNumber,\n \"Invalid Queue transaction.\"\n );\n\n return true;\n }\n\n /**\n * Verifies a batch inclusion proof.\n * @param _element Hash of the element to verify a proof for.\n * @param _batchHeader Header of the batch in which the element was included.\n * @param _proof Merkle inclusion proof for the element.\n */\n function _verifyElement(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n require(\n Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(uint32(_batchHeader.batchIndex)),\n \"Invalid batch header.\"\n );\n\n require(\n Lib_MerkleTree.verify(\n _batchHeader.batchRoot,\n _element,\n _proof.index,\n _proof.siblings,\n _batchHeader.batchSize\n ),\n \"Invalid inclusion proof.\"\n );\n\n return true;\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Math\n */\nlibrary Lib_Math {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Calculates the minumum of two numbers.\n * @param _x First number to compare.\n * @param _y Second number to compare.\n * @return Lesser of the two numbers.\n */\n function min(\n uint256 _x,\n uint256 _y\n )\n internal\n pure\n returns (\n uint256\n )\n {\n if (_x < _y) {\n return _x;\n }\n\n return _y;\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\n\n/* Contract Imports */\nimport { Abs_BaseCrossDomainMessenger } from \"./Abs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. \n * In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted \n * via this contract's replay function. \n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * Pass a default zero address to the address resolver. This will be updated when initialized.\n */\n constructor()\n public\n Lib_AddressResolver(address(0))\n {}\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n {\n require(address(libAddressManager) == address(0), \"L1CrossDomainMessenger already intialized.\");\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may successfully call a method.\n */\n modifier onlyRelayer() {\n address relayer = resolve(\"OVM_L2MessageRelayer\");\n if (relayer != address(0)) {\n require(\n msg.sender == relayer,\n \"Only OVM_L2MessageRelayer can relay L2-to-L1 messages.\"\n );\n }\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc iOVM_L1CrossDomainMessenger\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n )\n override\n public\n nonReentrant\n onlyRelayer()\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n _verifyXDomainMessage(\n xDomainCalldata,\n _proof\n ) == true,\n \"Provided message could not be verified.\"\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n xDomainMessageSender = _sender;\n (bool success, ) = _target.call(_message);\n\n // Mark the message as received if the call was successful. Ensures that a message can be\n // relayed multiple times in the case that the call reverted.\n if (success == true) {\n successfulMessages[xDomainCalldataHash] = true;\n emit RelayedMessage(xDomainCalldataHash);\n }\n\n // Store an identifier that can be used to prove that the given message was relayed by some\n // user. Gives us an easy way to pay relayers for their work.\n bytes32 relayId = keccak256(\n abi.encodePacked(\n xDomainCalldata,\n msg.sender,\n block.number\n )\n );\n relayedMessages[relayId] = true;\n }\n\n /**\n * Replays a cross domain message to the target messenger.\n * @inheritdoc iOVM_L1CrossDomainMessenger\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n sentMessages[keccak256(xDomainCalldata)] == true,\n \"Provided message has not already been sent.\"\n );\n\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Verifies that the given message is valid.\n * @param _xDomainCalldata Calldata to verify.\n * @param _proof Inclusion proof for the message.\n * @return Whether or not the provided message is valid.\n */\n function _verifyXDomainMessage(\n bytes memory _xDomainCalldata,\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n return (\n _verifyStateRootProof(_proof)\n && _verifyStorageProof(_xDomainCalldata, _proof)\n );\n }\n\n /**\n * Verifies that the state root within an inclusion proof is valid.\n * @param _proof Message inclusion proof.\n * @return Whether or not the provided proof is valid.\n */\n function _verifyStateRootProof(\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n\n return (\n ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) == false\n && ovmStateCommitmentChain.verifyStateCommitment(\n _proof.stateRoot,\n _proof.stateRootBatchHeader,\n _proof.stateRootProof\n )\n );\n }\n\n /**\n * Verifies that the storage proof within an inclusion proof is valid.\n * @param _xDomainCalldata Encoded message calldata.\n * @param _proof Message inclusion proof.\n * @return Whether or not the provided proof is valid.\n */\n function _verifyStorageProof(\n bytes memory _xDomainCalldata,\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n bytes32 storageKey = keccak256(\n abi.encodePacked(\n keccak256(\n abi.encodePacked(\n _xDomainCalldata,\n resolve(\"OVM_L2CrossDomainMessenger\")\n )\n ),\n uint256(0)\n )\n );\n\n (\n bool exists,\n bytes memory encodedMessagePassingAccount\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(0x4200000000000000000000000000000000000000),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing precompile has not been initialized or invalid proof provided.\"\n );\n\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedMessagePassingAccount\n );\n\n return Lib_SecureMerkleTrie.verifyInclusionProof(\n abi.encodePacked(storageKey),\n abi.encodePacked(uint8(1)),\n _proof.storageTrieWitness,\n account.storageRoot\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n override\n internal\n {\n iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\")).enqueue(\n resolve(\"OVM_L2CrossDomainMessenger\"),\n _gasLimit,\n _message\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/utils/Lib_ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract Lib_ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor () internal {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"./iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L1CrossDomainMessenger\n */\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /*******************\n * Data Structures *\n *******************/\n\n struct L2MessageInclusionProof {\n bytes32 stateRoot;\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\n bytes stateTrieWitness;\n bytes storageTrieWitness;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _proof Inclusion proof for the given message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) external;\n\n /**\n * Replays a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _sender Original sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _gasLimit Gas limit for the provided message.\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messenging/Abs_BaseCrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/* Library Imports */\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/**\n * @title Abs_BaseCrossDomainMessenger\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common functionality used in the\n * L1 and L2 Cross Domain Messengers. It can also serve as a template for developers wishing to implement a custom bridge \n * contract to suit their needs.\n *\n * Compiler used: defined by child contract\n * Runtime target: defined by child contract\n */\nabstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger, Lib_ReentrancyGuard {\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public relayedMessages;\n mapping (bytes32 => bool) public successfulMessages;\n mapping (bytes32 => bool) public sentMessages;\n uint256 public messageNonce;\n address override public xDomainMessageSender;\n\n /********************\n * Public Functions *\n ********************/\n\n constructor() Lib_ReentrancyGuard() internal {}\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n messageNonce += 1;\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\n emit SentMessage(xDomainCalldata);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Generates the correct cross domain calldata for a message.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @return ABI encoded cross domain calldata.\n */\n function _getXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"relayMessage(address,address,bytes,uint256)\",\n _target,\n _sender,\n _message,\n _messageNonce\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit Gas limit for the provided message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n virtual\n internal\n {\n revert(\"Implement me in child contracts!\");\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iAbs_BaseCrossDomainMessenger\n */\ninterface iAbs_BaseCrossDomainMessenger {\n\n /**********\n * Events *\n **********/\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n\n /**********************\n * Contract Variables *\n **********************/\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/precompiles/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol\";\n\n/* Contract Imports */\nimport { Abs_BaseCrossDomainMessenger } from \"./Abs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_L2CrossDomainMessenger\n * @dev The L2 Cross Domain Messenger contract sends messages from L2 to L1, and is the entry point\n * for L2 messages sent via the L1 Cross Domain Messenger.\n * \n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc iOVM_L2CrossDomainMessenger\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n )\n override\n nonReentrant\n public\n {\n require(\n _verifyXDomainMessage() == true,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n xDomainMessageSender = _sender;\n (bool success, ) = _target.call(_message);\n\n // Mark the message as received if the call was successful. Ensures that a message can be\n // relayed multiple times in the case that the call reverted.\n if (success == true) {\n successfulMessages[xDomainCalldataHash] = true;\n emit RelayedMessage(xDomainCalldataHash);\n }\n\n // Store an identifier that can be used to prove that the given message was relayed by some\n // user. Gives us an easy way to pay relayers for their work.\n bytes32 relayId = keccak256(\n abi.encodePacked(\n xDomainCalldata,\n msg.sender,\n block.number\n )\n );\n relayedMessages[relayId] = true;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Verifies that a received cross domain message is valid.\n * @return _valid Whether or not the message is valid.\n */\n function _verifyXDomainMessage()\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(resolve(\"OVM_L1MessageSender\")).getL1MessageSender() == resolve(\"OVM_L1CrossDomainMessenger\")\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit Gas limit for the provided message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n override\n internal\n {\n iOVM_L2ToL1MessagePasser(resolve(\"OVM_L2ToL1MessagePasser\")).passMessageToL1(_message);\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"./iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L2CrossDomainMessenger\n */\ninterface iOVM_L2CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_L1MessageSender.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_L1MessageSender\n */\ninterface iOVM_L1MessageSender {\n\n /********************\n * Public Functions *\n ********************/\n\n function getL1MessageSender() external view returns (address _l1MessageSender);\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(\n uint256 _nonce,\n address _sender,\n bytes _data\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_L2ToL1MessagePasser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_L2ToL1MessagePasser } from \"../../iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title OVM_L2ToL1MessagePasser\n * @dev The L2 to L1 Message Passer is a utility contract which facilitate an L1 proof of the \n * of a message on L2. The L1 Cross Domain Messenger performs this proof in its\n * _verifyStorageProof function, which verifies the existence of the transaction hash in this \n * contract's `sentMessages` mapping.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser {\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public sentMessages;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Passes a message to L1.\n * @param _message Message to pass to L1.\n */\n function passMessageToL1(\n bytes memory _message\n )\n override\n public\n {\n // Note: although this function is public, only messages sent from the OVM_L2CrossDomainMessenger \n // will be relayed by the OVM_L1CrossDomainMessenger. This is enforced by a check in \n // OVM_L1CrossDomainMessenger._verifyStorageProof().\n sentMessages[keccak256(\n abi.encodePacked(\n _message,\n msg.sender\n )\n )] = true;\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_L1MessageSender.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_L1MessageSender } from \"../../iOVM/precompiles/iOVM_L1MessageSender.sol\";\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\n\n/**\n * @title OVM_L1MessageSender\n * @dev The L1MessageSender is a predeploy contract running on L2. During the execution of cross \n * domain transaction from L1 to L2, it returns the address of the L1 account (either an EOA or\n * contract) which sent the message to L2 via the Canonical Transaction Chain's `enqueue()` \n * function.\n * \n * This contract exclusively serves as a getter for the ovmL1TXORIGIN operation. This is necessary \n * because there is no corresponding operation in the EVM which the the optimistic solidity compiler \n * can be replaced with a call to the ExecutionManager's ovmL1TXORIGIN() function.\n *\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_L1MessageSender is iOVM_L1MessageSender {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @return _l1MessageSender L1 message sender address (msg.sender).\n */\n function getL1MessageSender()\n override\n public\n view\n returns (\n address _l1MessageSender\n )\n {\n // Note that on L2 msg.sender (ie. evmCALLER) will always be the Execution Manager \n return iOVM_ExecutionManager(msg.sender).ovmL1TXORIGIN();\n }\n}\n" + }, + "contracts/optimistic-ethereum/mockOVM/bridge/mockOVM_CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Contract Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title mockOVM_CrossDomainMessenger\n */\ncontract mockOVM_CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /***********\n * Structs *\n ***********/\n\n struct ReceivedMessage {\n uint256 timestamp;\n address target;\n address sender;\n bytes message;\n uint256 messageNonce;\n uint32 gasLimit;\n }\n\n\n /**********************\n * Contract Variables *\n **********************/\n\n ReceivedMessage[] internal fullReceivedMessages;\n address internal targetMessengerAddress;\n uint256 internal lastRelayedMessage;\n uint256 internal delay;\n uint256 public messageNonce;\n address override public xDomainMessageSender;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _delay Time in seconds before a message can be relayed.\n */\n constructor(\n uint256 _delay\n )\n public\n {\n delay = _delay;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the target messenger address.\n * @dev Currently, this function is public and therefore allows anyone to modify the target\n * messenger for a given xdomain messenger contract. Obviously this shouldn't be allowed,\n * but we still need to determine an adequate mechanism for updating this address.\n * @param _targetMessengerAddress New messenger address.\n */\n function setTargetMessengerAddress(\n address _targetMessengerAddress\n )\n public\n {\n targetMessengerAddress = _targetMessengerAddress;\n }\n\n /**\n * Sends a message to another mock xdomain messenger.\n * @param _target Target for the message.\n * @param _message Message to send.\n * @param _gasLimit Amount of gas to send with the call.\n */\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n mockOVM_CrossDomainMessenger targetMessenger = mockOVM_CrossDomainMessenger(\n targetMessengerAddress\n );\n\n // Just send it over!\n targetMessenger.receiveMessage(ReceivedMessage({\n timestamp: block.timestamp,\n target: _target,\n sender: msg.sender,\n message: _message,\n messageNonce: messageNonce,\n gasLimit: _gasLimit\n }));\n\n messageNonce += 1;\n }\n\n /**\n * Receives a message to be sent later.\n * @param _message Message to send later.\n */\n function receiveMessage(\n ReceivedMessage memory _message\n )\n public\n {\n fullReceivedMessages.push(_message);\n }\n\n /**\n * Checks whether we have messages to relay.\n * @param _exists Whether or not we have more messages to relay.\n */\n function hasNextMessage()\n public\n view\n returns (\n bool _exists\n )\n {\n return fullReceivedMessages.length > lastRelayedMessage;\n }\n\n /**\n * Relays the last received message not yet relayed.\n */\n function relayNextMessage()\n public\n {\n require(hasNextMessage(), \"No pending messages to relay\");\n ReceivedMessage memory nextMessage = fullReceivedMessages[lastRelayedMessage];\n require(nextMessage.timestamp + delay < block.timestamp, \"Message is not ready to be relayed. The delay period is not up yet!\");\n\n xDomainMessageSender = nextMessage.sender;\n (bool success,) = nextMessage.target.call{gas: nextMessage.gasLimit}(nextMessage.message);\n require(success, \"Cross-domain message call reverted. Did you set your gas limit high enough?\");\n lastRelayedMessage += 1;\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n * Runtime target: defined by inheriting contract\n */\ncontract OVM_CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n uint32 public constant DEFAULT_FINALIZE_DEPOSIT_L2_GAS = 700000;\n uint32 public constant DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS = 100000;\n\n /***************\n * Constructor *\n ***************/ \n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * @notice Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(\n address _sourceDomainAccount\n ) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n \n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Gets the messenger, usually from storage. This function is exposed in case a child contract needs to override.\n * @return The address of the cross-domain messenger contract which should be used. \n */\n function getCrossDomainMessenger()\n internal\n virtual\n returns(\n iAbs_BaseCrossDomainMessenger\n )\n {\n return iAbs_BaseCrossDomainMessenger(messenger);\n }\n\n /**\n * @notice Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _data The data to send to the target (usually calldata to a function with `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n bytes memory _data,\n uint32 _gasLimit\n ) internal {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_L1ERC20Gateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\n\n/* Contract Imports */\nimport { UniswapV2ERC20 } from \"../../../libraries/standards/UniswapV2ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title OVM_L2DepositedERC20\n * @dev The L2 Deposited ERC20 is an ERC20 implementation which represents L1 assets deposited into L2.\n * This contract mints new tokens when it hears about deposits into the L1 ERC20 gateway.\n * This contract also burns the tokens intended for withdrawal, informing the L1 gateway to release L1 funds.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2DepositedERC20 is iOVM_L2DepositedERC20, UniswapV2ERC20, OVM_CrossDomainEnabled {\n \n /*******************\n * Contract Events *\n *******************/\n\n event Initialized(iOVM_L1ERC20Gateway _l1ERC20Gateway);\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_L1ERC20Gateway l1ERC20Gateway;\n\n /********************************\n * Constructor & Initialization *\n ********************************/\n\n /**\n * @param _l2CrossDomainMessenger L1 Messenger address being used for cross-chain communications.\n * @param _decimals L2 ERC20 decimals\n * @param _name L2 ERC20 name\n * @param _symbol L2 ERC20 symbol\n */\n constructor(\n address _l2CrossDomainMessenger,\n uint8 _decimals,\n string memory _name,\n string memory _symbol\n )\n public\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n UniswapV2ERC20(_decimals, _name, _symbol)\n {}\n\n /**\n * @dev Initialize this gateway with the L1 gateway address\n * The assumed flow is that this contract is deployed on L2, then the L1 \n * gateway is dpeloyed, and its address passed here to init.\n *\n * @param _l1ERC20Gateway Address of the corresponding L1 gateway deployed to the main chain\n */\n function init(\n iOVM_L1ERC20Gateway _l1ERC20Gateway\n )\n public\n {\n require(address(l1ERC20Gateway) == address(0), \"Contract has already been initialized\");\n\n l1ERC20Gateway = _l1ERC20Gateway;\n \n emit Initialized(l1ERC20Gateway);\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyInitialized() {\n require(address(l1ERC20Gateway) != address(0), \"Contract has not yet been initialized\");\n _;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @dev initiate a withdraw of some ERC20 to the caller's account on L1\n * @param _amount Amount of the ERC20 to withdraw\n */\n function withdraw(\n uint _amount\n )\n external\n override\n onlyInitialized()\n {\n _initiateWithdrawal(msg.sender, _amount);\n }\n\n /**\n * @dev initiate a withdraw of some ERC20 to a recipient's account on L1\n * @param _to L1 adress to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function withdrawTo(address _to, uint _amount) external override onlyInitialized() {\n _initiateWithdrawal(_to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 ERC20 Gateway of the deposit.\n *\n * @param _to Account to give the withdrawal to on L1\n * @param _amount Amount of the ERC20 to withdraw\n */\n function _initiateWithdrawal(address _to, uint _amount) internal {\n // burn L2 funds so they can't be used more on L2\n _burn(msg.sender, _amount);\n\n // Construct calldata for l1ERC20Gateway.finalizeWithdrawal(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L1ERC20Gateway.finalizeWithdrawal.selector,\n _to,\n _amount\n );\n\n // Send message up to L1 gateway\n sendCrossDomainMessage(\n address(l1ERC20Gateway),\n data,\n DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS\n );\n\n emit WithdrawalInitiated(msg.sender, _to, _amount);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this \n * L2 ERC20 token. \n * This call will fail if it did not originate from a corresponding deposit in OVM_L1ERC20Gateway. \n *\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeDeposit(address _to, uint _amount) external override onlyInitialized()\n onlyFromCrossDomainAccount(address(l1ERC20Gateway))\n {\n _mint(_to, _amount);\n emit DepositFinalized(_to, _amount);\n }\n}" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { IUniswapV2ERC20 } from \"../../../libraries/standards/IUniswapV2ERC20.sol\";\n\n/**\n * @title iOVM_L2DepositedERC20\n */\ninterface iOVM_L2DepositedERC20 is IUniswapV2ERC20 {\n\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n\n event DepositFinalized(\n address indexed _to,\n uint256 _amount\n ); \n\n\n /********************\n * Public Functions *\n ********************/\n\n function withdraw(\n uint _amount\n )\n external;\n\n function withdrawTo(\n address _to,\n uint _amount\n )\n external;\n\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeDeposit(\n address _to,\n uint _amount\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ERC20Gateway\n */\ninterface iOVM_L1ERC20Gateway {\n\n /**********\n * Events *\n **********/\n\n event DepositInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n \n event WithdrawalFinalized(\n address indexed _to,\n uint256 _amount\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function deposit(\n uint _amount\n )\n external;\n\n function depositTo(\n address _to,\n uint _amount\n )\n external;\n\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol": { + "content": "pragma solidity >=0.5.16 <0.8.0;\n\nimport './IUniswapV2ERC20.sol';\nimport './UniSafeMath.sol';\n\ncontract UniswapV2ERC20 is IUniswapV2ERC20 {\n using UniSafeMath for uint;\n\n string public override name;\n string public override symbol;\n uint8 public override immutable decimals;\n uint public override totalSupply;\n mapping(address => uint) public override balanceOf;\n mapping(address => mapping(address => uint)) public override allowance;\n\n bytes32 public override DOMAIN_SEPARATOR;\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n mapping(address => uint) public override nonces;\n\n constructor(\n uint8 _decimals,\n string memory _name,\n string memory _symbol\n ) public {\n decimals = _decimals;\n name = _name;\n symbol = _symbol;\n\n uint chainId;\n assembly {\n chainId := chainid()\n }\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),\n keccak256(bytes(name)),\n keccak256(bytes('1')),\n chainId,\n address(this)\n )\n );\n }\n\n function _mint(address to, uint value) internal {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _burn(address from, uint value) internal {\n balanceOf[from] = balanceOf[from].sub(value);\n totalSupply = totalSupply.sub(value);\n emit Transfer(from, address(0), value);\n }\n\n function _approve(address owner, address spender, uint value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint value) external override returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint value) external override returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint value) external override returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {\n require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');\n bytes32 digest = keccak256(\n abi.encodePacked(\n '\\x19\\x01',\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');\n _approve(owner, spender, value);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol": { + "content": "pragma solidity >=0.5.16 <0.8.0;\n\ninterface IUniswapV2ERC20 {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n}\n" + }, + "contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol": { + "content": "pragma solidity >=0.5.16 <0.8.0;\n\n// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)\n\nlibrary UniSafeMath {\n function add(uint x, uint y) internal pure returns (uint z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint x, uint y) internal pure returns (uint z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint x, uint y) internal pure returns (uint z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_ETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1ERC20Gateway } from \"../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\n\n/* Contract Imports */\nimport { OVM_L2DepositedERC20 } from \"../bridge/tokens/OVM_L2DepositedERC20.sol\";\n\n/**\n * @title OVM_ETH\n * @dev The ETH predeploy provides an ERC20 interface for ETH deposited to Layer 2. Note that \n * unlike on Layer 1, Layer 2 accounts do not have a balance field.\n * \n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ETH is OVM_L2DepositedERC20 {\n constructor(\n address _l2CrossDomainMessenger,\n address _l1ETHGateway\n ) \n OVM_L2DepositedERC20(\n _l2CrossDomainMessenger,\n 18, // WETH decimals\n \"ovmWETH\",\n \"oWETH\"\n )\n public \n {\n init(iOVM_L1ERC20Gateway(_l1ETHGateway));\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm \npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1ERC20Gateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/precompiles/iOVM_ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title OVM_L1ERC20Gateway\n * @dev The L1 ERC20 Gateway is a contract which stores deposited L1 funds that are in use on L2.\n * It synchronizes a corresponding L2 ERC20 Gateway, informing it of deposits, and listening to it \n * for newly finalized withdrawals.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ERC20Gateway is iOVM_L1ERC20Gateway, OVM_CrossDomainEnabled {\n \n /********************************\n * External Contract References *\n ********************************/\n \n iOVM_ERC20 public l1ERC20;\n address public l2DepositedERC20;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1ERC20 L1 ERC20 address this contract stores deposits for\n * @param _l2DepositedERC20 L2 Gateway address on the chain being deposited into\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n iOVM_ERC20 _l1ERC20,\n address _l2DepositedERC20,\n address _l1messenger \n )\n OVM_CrossDomainEnabled(_l1messenger)\n {\n l1ERC20 = _l1ERC20;\n l2DepositedERC20 = _l2DepositedERC20;\n }\n\n /**************\n * Depositing *\n **************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2\n * @param _amount Amount of the ERC20 to deposit\n */\n function deposit(\n uint _amount\n )\n external\n override\n {\n _initiateDeposit(msg.sender, msg.sender, _amount);\n }\n\n /**\n * @dev deposit an amount of ERC20 to a recipients's balance on L2\n * @param _to L2 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to deposit\n */\n function depositTo(\n address _to,\n uint _amount\n )\n external\n override\n {\n _initiateDeposit(msg.sender, _to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 Deposited ERC20 contract of the deposit.\n *\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n * @param _amount Amount of the ERC20 to deposit.\n */\n function _initiateDeposit(\n address _from,\n address _to,\n uint _amount\n )\n internal\n {\n // Hold on to the newly deposited funds\n l1ERC20.transferFrom(\n _from,\n address(this),\n _amount\n );\n\n // Construct calldata for l2DepositedERC20.finalizeDeposit(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L2DepositedERC20.finalizeDeposit.selector,\n _to,\n _amount\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2DepositedERC20,\n data,\n DEFAULT_FINALIZE_DEPOSIT_L2_GAS\n );\n\n emit DepositInitiated(_from, _to, _amount);\n }\n\n /*************************************\n * Cross-chain Function: Withdrawing *\n *************************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the \n * L1 ERC20 token. \n * This call will fail if the initialized withdrawal from L2 has not been finalized. \n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external\n override \n onlyFromCrossDomainAccount(l2DepositedERC20)\n {\n l1ERC20.transfer(_to, _amount);\n\n emit WithdrawalFinalized(_to, _amount);\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_ERC20\n */\ninterface iOVM_ERC20 {\n /* This is a slight change to the ERC20 base standard.\n function totalSupply() constant returns (uint256 supply);\n is replaced with:\n uint256 public totalSupply;\n This automatically creates a getter function for the totalSupply.\n This is moved to the base contract since public getter functions are not\n currently recognised as an implementation of the matching abstract\n function by the compiler.\n */\n /// total amount of tokens\n function totalSupply() external view returns (uint256);\n\n /// @param _owner The address from which the balance will be retrieved\n /// @return balance The balance\n function balanceOf(address _owner) external view returns (uint256 balance);\n\n /// @notice send `_value` token to `_to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return success Whether the transfer was successful or not\n function transfer(address _to, uint256 _value) external returns (bool success);\n\n /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return success Whether the transfer was successful or not\n function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);\n\n /// @notice `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of tokens to be approved for transfer\n /// @return success Whether the approval was successful or not\n function approve(address _spender, uint256 _value) external returns (bool success);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return remaining Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender) external view returns (uint256 remaining);\n\n // solhint-disable-next-line no-simple-event-func-name\n event Transfer(address indexed _from, address indexed _to, uint256 _value);\n event Approval(address indexed _owner, address indexed _spender, uint256 _value);\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1ETHGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ETHGateway.sol\";\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/precompiles/iOVM_ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title OVM_L1ETHGateway\n * @dev The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_AddressResolver {\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2ERC20Gateway;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address manager for this OE deployment\n */\n constructor(\n address _libAddressManager,\n address _l2ERC20Gateway\n )\n OVM_CrossDomainEnabled(address(0)) // overridden in constructor code\n Lib_AddressResolver(_libAddressManager)\n {\n l2ERC20Gateway = _l2ERC20Gateway;\n messenger = resolve(\"Proxy__OVM_L1CrossDomainMessenger\"); // overrides OVM_CrossDomainEnabled constructor setting because resolve() is not yet accessible\n }\n\n /**************\n * Depositing *\n **************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2\n */\n function deposit() \n external\n override\n payable\n {\n _initiateDeposit(msg.sender, msg.sender);\n }\n\n /**\n * @dev deposit an amount of ERC20 to a recipients's balance on L2\n * @param _to L2 address to credit the withdrawal to\n */\n function depositTo(\n address _to\n )\n external\n override\n payable\n {\n _initiateDeposit(msg.sender, _to);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 ERC20 Gateway of the deposit.\n *\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n */\n function _initiateDeposit(\n address _from,\n address _to\n )\n internal\n {\n // Construct calldata for l2ERC20Gateway.finalizeDeposit(_to, _amount)\n bytes memory data =\n abi.encodeWithSelector(\n iOVM_L2DepositedERC20.finalizeDeposit.selector,\n _to,\n msg.value\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2ERC20Gateway,\n data,\n DEFAULT_FINALIZE_DEPOSIT_L2_GAS\n );\n\n emit DepositInitiated(_from, _to, msg.value);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint256 _amount\n )\n external\n override\n onlyFromCrossDomainAccount(l2ERC20Gateway)\n {\n _safeTransferETH(_to, _amount);\n\n emit WithdrawalFinalized(_to, _amount);\n }\n\n /**********************************\n * Internal Functions: Accounting *\n **********************************/\n\n /**\n * @dev Internal accounting function for moving around L1 ETH.\n *\n * @param _to L1 address to transfer ETH to\n * @param _value Amount of ETH to send to\n */\n function _safeTransferETH(\n address _to,\n uint256 _value\n )\n internal\n {\n (bool success, ) = _to.call{value: _value}(new bytes(0));\n require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n }\n\n /**\n * @dev Prevent users from sending ETH directly to this contract without calling deposit\n */\n receive()\n external\n payable\n {\n revert(\"Deposits must be initiated via deposit() or depositTo()\");\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ETHGateway\n */\ninterface iOVM_L1ETHGateway {\n\n /**********\n * Events *\n **********/\n\n event DepositInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n\n event WithdrawalFinalized(\n address indexed _to,\n uint256 _amount\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function deposit()\n external\n payable;\n\n function depositTo(\n address _to\n )\n external\n payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external;\n}\n" + }, + "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\n\n\n/**\n * @title OVM_L1MultiMessageRelayer\n * @dev The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the \n * relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain\n * Message Sender.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1MultiMessageRelayer is iOVM_L1MultiMessageRelayer, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n constructor(\n address _libAddressManager\n ) \n Lib_AddressResolver(_libAddressManager)\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyBatchRelayer() {\n require(\n msg.sender == resolve(\"OVM_L2BatchMessageRelayer\"),\n \"OVM_L1MultiMessageRelayer: Function can only be called by the OVM_L2BatchMessageRelayer\"\n );\n _;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @notice Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\n * @param _messages An array of L2 to L1 messages\n */\n function batchRelayMessages(L2ToL1Message[] calldata _messages) \n override\n external\n onlyBatchRelayer \n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(resolve(\"Proxy__OVM_L1CrossDomainMessenger\"));\n for (uint256 i = 0; i < _messages.length; i++) {\n L2ToL1Message memory message = _messages[i];\n messenger.relayMessage(\n message.target,\n message.sender,\n message.message,\n message.messageNonce,\n message.proof\n );\n }\n }\n}\n" + }, + "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\ninterface iOVM_L1MultiMessageRelayer {\n\n struct L2ToL1Message {\n address target;\n address sender;\n bytes message;\n uint256 messageNonce;\n iOVM_L1CrossDomainMessenger.L2MessageInclusionProof proof;\n }\n\n function batchRelayMessages(L2ToL1Message[] calldata _messages) external; \n}\n" + }, + "contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_SecureMerkleTrie } from \"../../optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\";\n\n/**\n * @title TestLib_SecureMerkleTrie\n */\ncontract TestLib_SecureMerkleTrie {\n\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_SecureMerkleTrie.verifyInclusionProof(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_SecureMerkleTrie.verifyExclusionProof(\n _key,\n _proof,\n _root\n );\n }\n\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_SecureMerkleTrie.update(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool,\n bytes memory\n )\n {\n return Lib_SecureMerkleTrie.get(\n _key,\n _proof,\n _root\n );\n }\n\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_SecureMerkleTrie.getSingleNodeRootHash(\n _key,\n _value\n );\n }\n}\n" + }, + "contracts/test-libraries/trie/TestLib_MerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"../../optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\";\n\n/**\n * @title TestLib_MerkleTrie\n */\ncontract TestLib_MerkleTrie {\n\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTrie.verifyInclusionProof(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTrie.verifyExclusionProof(\n _key,\n _proof,\n _root\n );\n }\n\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_MerkleTrie.update(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool,\n bytes memory\n )\n {\n return Lib_MerkleTrie.get(\n _key,\n _proof,\n _root\n );\n }\n\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_MerkleTrie.getSingleNodeRootHash(\n _key,\n _value\n );\n }\n}\n" + }, + "contracts/test-libraries/rlp/TestLib_RLPWriter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../../optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_RLPWriter\n */\ncontract TestLib_RLPWriter {\n\n function writeBytes(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeBytes(_in);\n }\n\n function writeList(\n bytes[] memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeList(_in);\n }\n\n function writeString(\n string memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeString(_in);\n }\n\n function writeAddress(\n address _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeAddress(_in);\n }\n\n function writeUint(\n uint256 _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeUint(_in);\n }\n\n function writeBool(\n bool _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeBool(_in);\n }\n\n function writeAddressWithTaintedMemory(\n address _in\n )\n public\n returns (\n bytes memory _out\n )\n {\n new TestERC20();\n return Lib_RLPWriter.writeAddress(_in);\n }\n}\n" + }, + "contracts/test-helpers/TestERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n// a test ERC20 token with an open mint function\ncontract TestERC20 {\n using SafeMath for uint;\n\n string public constant name = 'Test';\n string public constant symbol = 'TST';\n uint8 public constant decimals = 18;\n uint256 public totalSupply;\n mapping(address => uint) public balanceOf;\n mapping(address => mapping(address => uint)) public allowance;\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n constructor() public {}\n\n function mint(address to, uint256 value) public {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _approve(address owner, address spender, uint256 value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint256 value) external returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint256 value) external returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint256 value) external returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n}\n\nlibrary SafeMath {\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_BytesUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_BytesUtils\n */\ncontract TestLib_BytesUtils {\n\n function concat(\n bytes memory _preBytes,\n bytes memory _postBytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.concat(\n _preBytes,\n _postBytes\n );\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.slice(\n _bytes,\n _start,\n _length\n );\n }\n\n function toBytes32(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes32)\n {\n return Lib_BytesUtils.toBytes32(\n _bytes\n );\n }\n\n function toUint256(\n bytes memory _bytes\n )\n public\n pure\n returns (uint256)\n {\n return Lib_BytesUtils.toUint256(\n _bytes\n );\n }\n\n function toNibbles(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.toNibbles(\n _bytes\n );\n }\n\n function fromNibbles(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.fromNibbles(\n _bytes\n );\n }\n\n function equal(\n bytes memory _bytes,\n bytes memory _other\n )\n public\n pure\n returns (bool)\n {\n return Lib_BytesUtils.equal(\n _bytes,\n _other\n );\n }\n\n function sliceWithTaintedMemory(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n public\n returns (bytes memory)\n {\n new TestERC20();\n return Lib_BytesUtils.slice(\n _bytes,\n _start,\n _length\n );\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_EthUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EthUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\";\n\n/**\n * @title TestLib_EthUtils\n */\ncontract TestLib_EthUtils {\n\n function getCode(\n address _address,\n uint256 _offset,\n uint256 _length\n )\n public\n view\n returns (\n bytes memory _code\n )\n {\n return Lib_EthUtils.getCode(\n _address,\n _offset,\n _length\n );\n }\n\n function getCode(\n address _address\n )\n public\n view\n returns (\n bytes memory _code\n )\n {\n return Lib_EthUtils.getCode(\n _address\n );\n }\n\n function getCodeSize(\n address _address\n )\n public\n view\n returns (\n uint256 _codeSize\n )\n {\n return Lib_EthUtils.getCodeSize(\n _address\n );\n }\n\n function getCodeHash(\n address _address\n )\n public\n view\n returns (\n bytes32 _codeHash\n )\n {\n return Lib_EthUtils.getCodeHash(\n _address\n );\n }\n\n function createContract(\n bytes memory _code\n )\n public\n returns (\n address _created\n )\n {\n return Lib_EthUtils.createContract(\n _code\n );\n }\n\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n public\n pure\n returns (\n address _address\n )\n {\n return Lib_EthUtils.getAddressForCREATE(\n _creator,\n _nonce\n );\n }\n\n function getAddressForCREATE2(\n address _creator,\n bytes memory _bytecode,\n bytes32 _salt\n )\n public\n pure\n returns (address _address)\n {\n return Lib_EthUtils.getAddressForCREATE2(\n _creator,\n _bytecode,\n _salt\n );\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Bytes32Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\";\n\n/**\n * @title TestLib_Byte32Utils\n */\ncontract TestLib_Bytes32Utils {\n\n function toBool(\n bytes32 _in\n )\n public\n pure\n returns (\n bool _out\n )\n {\n return Lib_Bytes32Utils.toBool(_in);\n }\n\n function fromBool(\n bool _in\n )\n public\n pure\n returns (\n bytes32 _out\n )\n {\n return Lib_Bytes32Utils.fromBool(_in);\n }\n\n function toAddress(\n bytes32 _in\n )\n public\n pure\n returns (\n address _out\n )\n {\n return Lib_Bytes32Utils.toAddress(_in);\n }\n\n function fromAddress(\n address _in\n )\n public\n pure\n returns (\n bytes32 _out\n )\n {\n return Lib_Bytes32Utils.fromAddress(_in);\n }\n}\n" + }, + "contracts/test-libraries/rlp/TestLib_RLPReader.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../../optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\";\n\n/**\n * @title TestLib_RLPReader\n */\ncontract TestLib_RLPReader {\n\n function readList(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes[] memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_in);\n bytes[] memory out = new bytes[](decoded.length);\n for (uint256 i = 0; i < out.length; i++) {\n out[i] = Lib_RLPReader.readRawBytes(decoded[i]);\n }\n return out;\n }\n\n function readString(\n bytes memory _in\n )\n public\n pure\n returns (\n string memory\n )\n {\n return Lib_RLPReader.readString(_in);\n }\n\n function readBytes(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_RLPReader.readBytes(_in);\n }\n\n function readBytes32(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_RLPReader.readBytes32(_in);\n }\n\n function readUint256(\n bytes memory _in\n )\n public\n pure\n returns (\n uint256\n )\n {\n return Lib_RLPReader.readUint256(_in);\n }\n\n function readBool(\n bytes memory _in\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_RLPReader.readBool(_in);\n }\n\n function readAddress(\n bytes memory _in\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_RLPReader.readAddress(_in);\n }\n}\n" + }, + "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_ResolvedDelegateProxy\n */\ncontract Lib_ResolvedDelegateProxy {\n\n /*************\n * Variables *\n *************/\n\n\n // Using mappings to store fields to avoid overwriting storage slots in the\n // implementation contract. For example, instead of storing these fields at\n // storage slot `0` & `1`, they are stored at `keccak256(key + slot)`.\n // See: https://solidity.readthedocs.io/en/v0.7.0/internals/layout_in_storage.html\n // NOTE: Do not use this code in your own contract system. \n // There is a known flaw in this contract, and we will remove it from the repository\n // in the near future. Due to the very limited way that we are using it, this flaw is\n // not an issue in our system. \n mapping(address=>string) private implementationName;\n mapping(address=>Lib_AddressManager) private addressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n * @param _implementationName implementationName of the contract to proxy to.\n */\n constructor(\n address _libAddressManager,\n string memory _implementationName\n )\n public\n {\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\n implementationName[address(this)] = _implementationName;\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n address target = addressManager[address(this)].getAddress((implementationName[address(this)]));\n require(\n target != address(0),\n \"Target address must be initialized.\"\n );\n\n (bool success, bytes memory returndata) = target.delegatecall(msg.data);\n\n if (success == true) {\n assembly {\n return(add(returndata, 0x20), mload(returndata))\n }\n } else {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n }\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_MerkleTree.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_MerkleTree } from \"../../optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\";\n\n/**\n * @title TestLib_MerkleTree\n */\ncontract TestLib_MerkleTree {\n\n function getMerkleRoot(\n bytes32[] memory _elements\n )\n public\n view\n returns (\n bytes32\n )\n {\n return Lib_MerkleTree.getMerkleRoot(\n _elements\n );\n }\n\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTree.verify(\n _root,\n _leaf,\n _index,\n _siblings,\n _totalLeaves\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title mockOVM_BondManager\n */\ncontract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n function recordGasSpent(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n address _who,\n uint256 _gasSpent\n )\n override\n public\n {}\n\n function finalize(\n bytes32 _preStateRoot,\n address _publisher,\n uint256 _timestamp\n )\n override\n public\n {}\n\n function deposit()\n override\n public\n {}\n\n function startWithdrawal()\n override\n public\n {}\n\n function finalizeWithdrawal()\n override\n public\n {}\n\n function claim(\n address _who\n )\n override\n public\n {}\n\n function isCollateralized(\n address _who\n )\n override\n public\n view\n returns (\n bool\n )\n {\n // Only authenticate sequencer to submit state root batches.\n return _who == resolve(\"OVM_Sequencer\");\n }\n\n function getGasSpent(\n bytes32 _preStateRoot,\n address _who\n )\n override\n public\n view\n returns (\n uint256\n )\n {\n return 0;\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_StateManagerFactory } from \"../../iOVM/execution/iOVM_StateManagerFactory.sol\";\n\n/* Contract Imports */\nimport { OVM_StateManager } from \"./OVM_StateManager.sol\";\n\n/**\n * @title OVM_StateManagerFactory\n * @dev The State Manager Factory is called by a State Transitioner's init code, to create a new \n * State Manager for use in the Fraud Verification process.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateManagerFactory is iOVM_StateManagerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n /**\n * Creates a new OVM_StateManager\n * @param _owner Owner of the created contract.\n * @return _ovmStateManager New OVM_StateManager instance.\n */\n function create(\n address _owner\n )\n override\n public\n returns (\n iOVM_StateManager _ovmStateManager\n )\n {\n return new OVM_StateManager(_owner);\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/execution/OVM_StateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\n\n/**\n * @title OVM_StateManager\n * @dev The State Manager contract holds all storage values for contracts in the OVM. It can only be written to by the\n * the Execution Manager and State Transitioner. It runs on L1 during the setup and execution of a fraud proof.\n * The same logic runs on L2, but has been implemented as a precompile in the L2 go-ethereum client\n * (see https://github.com/ethereum-optimism/go-ethereum/blob/master/core/vm/ovm_state_manager.go).\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateManager is iOVM_StateManager {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bytes32 constant internal EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\n bytes32 constant internal EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n bytes32 constant internal STORAGE_XOR_VALUE = 0xFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEF;\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n address override public owner;\n address override public ovmExecutionManager;\n\n\n /****************************************\n * Contract Variables: Internal Storage *\n ****************************************/\n\n mapping (address => Lib_OVMCodec.Account) internal accounts;\n mapping (address => mapping (bytes32 => bytes32)) internal contractStorage;\n mapping (address => mapping (bytes32 => bool)) internal verifiedContractStorage;\n mapping (bytes32 => ItemState) internal itemStates;\n uint256 internal totalUncommittedAccounts;\n uint256 internal totalUncommittedContractStorage;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address of the owner of this contract.\n */\n constructor(\n address _owner\n )\n public\n {\n owner = _owner;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Simple authentication, this contract should only be accessible to the owner (which is expected to be the State Transitioner during `PRE_EXECUTION` \n * or the OVM_ExecutionManager during transaction execution.\n */\n modifier authenticated() {\n // owner is the State Transitioner\n require(\n msg.sender == owner || msg.sender == ovmExecutionManager,\n \"Function can only be called by authenticated addresses\"\n );\n _;\n }\n\n /***************************\n * Public Functions: Misc *\n ***************************/\n\n\n function isAuthenticated(\n address _address\n )\n override\n public\n view\n returns (bool)\n {\n return (_address == owner || _address == ovmExecutionManager);\n }\n\n /***************************\n * Public Functions: Setup *\n ***************************/\n\n /**\n * Sets the address of the OVM_ExecutionManager.\n * @param _ovmExecutionManager Address of the OVM_ExecutionManager.\n */\n function setExecutionManager(\n address _ovmExecutionManager\n )\n override\n public\n authenticated\n {\n ovmExecutionManager = _ovmExecutionManager;\n }\n\n\n /************************************\n * Public Functions: Account Access *\n ************************************/\n\n /**\n * Inserts an account into the state.\n * @param _address Address of the account to insert.\n * @param _account Account to insert for the given address.\n */\n function putAccount(\n address _address,\n Lib_OVMCodec.Account memory _account\n )\n override\n public\n authenticated\n {\n accounts[_address] = _account;\n }\n\n /**\n * Marks an account as empty.\n * @param _address Address of the account to mark.\n */\n function putEmptyAccount(\n address _address\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\n }\n\n /**\n * Retrieves an account from the state.\n * @param _address Address of the account to retrieve.\n * @return _account Account for the given address.\n */\n function getAccount(address _address)\n override\n public\n view\n returns (\n Lib_OVMCodec.Account memory _account\n )\n {\n return accounts[_address];\n }\n\n /**\n * Checks whether the state has a given account.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the state has the account.\n */\n function hasAccount(\n address _address\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return accounts[_address].codeHash != bytes32(0);\n }\n\n /**\n * Checks whether the state has a given known empty account.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the state has the empty account.\n */\n function hasEmptyAccount(\n address _address\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return (\n accounts[_address].codeHash == EMPTY_ACCOUNT_CODE_HASH\n && accounts[_address].nonce == 0\n );\n }\n\n /**\n * Sets the nonce of an account.\n * @param _address Address of the account to modify.\n * @param _nonce New account nonce.\n */\n function setAccountNonce(\n address _address,\n uint256 _nonce\n )\n override\n public\n authenticated\n {\n accounts[_address].nonce = _nonce;\n }\n\n /**\n * Gets the nonce of an account.\n * @param _address Address of the account to access.\n * @return _nonce Nonce of the account.\n */\n function getAccountNonce(\n address _address\n )\n override\n public\n view\n returns (\n uint256 _nonce\n )\n {\n return accounts[_address].nonce;\n }\n\n /**\n * Retrieves the Ethereum address of an account.\n * @param _address Address of the account to access.\n * @return _ethAddress Corresponding Ethereum address.\n */\n function getAccountEthAddress(\n address _address\n )\n override\n public\n view\n returns (\n address _ethAddress\n )\n {\n return accounts[_address].ethAddress;\n }\n\n /**\n * Retrieves the storage root of an account.\n * @param _address Address of the account to access.\n * @return _storageRoot Corresponding storage root.\n */\n function getAccountStorageRoot(\n address _address\n )\n override\n public\n view\n returns (\n bytes32 _storageRoot\n )\n {\n return accounts[_address].storageRoot;\n }\n\n /**\n * Initializes a pending account (during CREATE or CREATE2) with the default values.\n * @param _address Address of the account to initialize.\n */\n function initPendingAccount(\n address _address\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.nonce = 1;\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\n account.isFresh = true;\n }\n\n /**\n * Finalizes the creation of a pending account (during CREATE or CREATE2).\n * @param _address Address of the account to finalize.\n * @param _ethAddress Address of the account's associated contract on Ethereum.\n * @param _codeHash Hash of the account's code.\n */\n function commitPendingAccount(\n address _address,\n address _ethAddress,\n bytes32 _codeHash\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.ethAddress = _ethAddress;\n account.codeHash = _codeHash;\n }\n\n /**\n * Checks whether an account has already been retrieved, and marks it as retrieved if not.\n * @param _address Address of the account to check.\n * @return _wasAccountAlreadyLoaded Whether or not the account was already loaded.\n */\n function testAndSetAccountLoaded(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountAlreadyLoaded\n )\n {\n return _testAndSetItemState(\n _getItemHash(_address),\n ItemState.ITEM_LOADED\n );\n }\n\n /**\n * Checks whether an account has already been modified, and marks it as modified if not.\n * @param _address Address of the account to check.\n * @return _wasAccountAlreadyChanged Whether or not the account was already modified.\n */\n function testAndSetAccountChanged(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountAlreadyChanged\n )\n {\n return _testAndSetItemState(\n _getItemHash(_address),\n ItemState.ITEM_CHANGED\n );\n }\n\n /**\n * Attempts to mark an account as committed.\n * @param _address Address of the account to commit.\n * @return _wasAccountCommitted Whether or not the account was committed.\n */\n function commitAccount(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountCommitted\n )\n {\n bytes32 item = _getItemHash(_address);\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\n return false;\n }\n\n itemStates[item] = ItemState.ITEM_COMMITTED;\n totalUncommittedAccounts -= 1;\n\n return true;\n }\n\n /**\n * Increments the total number of uncommitted accounts.\n */\n function incrementTotalUncommittedAccounts()\n override\n public\n authenticated\n {\n totalUncommittedAccounts += 1;\n }\n\n /**\n * Gets the total number of uncommitted accounts.\n * @return _total Total uncommitted accounts.\n */\n function getTotalUncommittedAccounts()\n override\n public\n view\n returns (\n uint256 _total\n )\n {\n return totalUncommittedAccounts;\n }\n\n /**\n * Checks whether a given account was changed during execution.\n * @param _address Address to check.\n * @return Whether or not the account was changed.\n */\n function wasAccountChanged(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_address);\n return itemStates[item] >= ItemState.ITEM_CHANGED;\n }\n\n /**\n * Checks whether a given account was committed after execution.\n * @param _address Address to check.\n * @return Whether or not the account was committed.\n */\n function wasAccountCommitted(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_address);\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\n }\n\n\n /************************************\n * Public Functions: Storage Access *\n ************************************/\n\n /**\n * Changes a contract storage slot value.\n * @param _contract Address of the contract to modify.\n * @param _key 32 byte storage slot key.\n * @param _value 32 byte storage slot value.\n */\n function putContractStorage(\n address _contract,\n bytes32 _key,\n bytes32 _value\n )\n override\n public\n authenticated\n {\n // A hilarious optimization. `SSTORE`ing a value of `bytes32(0)` is common enough that it's\n // worth populating this with a non-zero value in advance (during the fraud proof\n // initialization phase) to cut the execution-time cost down to 5000 gas.\n contractStorage[_contract][_key] = _value ^ STORAGE_XOR_VALUE;\n\n // Only used when initially populating the contract storage. OVM_ExecutionManager will\n // perform a `hasContractStorage` INVALID_STATE_ACCESS check before putting any contract\n // storage because writing to zero when the actual value is nonzero causes a gas\n // discrepancy. Could be moved into a new `putVerifiedContractStorage` function, or\n // something along those lines.\n if (verifiedContractStorage[_contract][_key] == false) {\n verifiedContractStorage[_contract][_key] = true;\n }\n }\n\n /**\n * Retrieves a contract storage slot value.\n * @param _contract Address of the contract to access.\n * @param _key 32 byte storage slot key.\n * @return _value 32 byte storage slot value.\n */\n function getContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bytes32 _value\n )\n {\n // Storage XOR system doesn't work for newly created contracts that haven't set this\n // storage slot value yet.\n if (\n verifiedContractStorage[_contract][_key] == false\n && accounts[_contract].isFresh\n ) {\n return bytes32(0);\n }\n\n // See `putContractStorage` for more information about the XOR here.\n return contractStorage[_contract][_key] ^ STORAGE_XOR_VALUE;\n }\n\n /**\n * Checks whether a contract storage slot exists in the state.\n * @param _contract Address of the contract to access.\n * @param _key 32 byte storage slot key.\n * @return _exists Whether or not the key was set in the state.\n */\n function hasContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return verifiedContractStorage[_contract][_key] || accounts[_contract].isFresh;\n }\n\n /**\n * Checks whether a storage slot has already been retrieved, and marks it as retrieved if not.\n * @param _contract Address of the contract to check.\n * @param _key 32 byte storage slot key.\n * @return _wasContractStorageAlreadyLoaded Whether or not the slot was already loaded.\n */\n function testAndSetContractStorageLoaded(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageAlreadyLoaded\n )\n {\n return _testAndSetItemState(\n _getItemHash(_contract, _key),\n ItemState.ITEM_LOADED\n );\n }\n\n /**\n * Checks whether a storage slot has already been modified, and marks it as modified if not.\n * @param _contract Address of the contract to check.\n * @param _key 32 byte storage slot key.\n * @return _wasContractStorageAlreadyChanged Whether or not the slot was already modified.\n */\n function testAndSetContractStorageChanged(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageAlreadyChanged\n )\n {\n return _testAndSetItemState(\n _getItemHash(_contract, _key),\n ItemState.ITEM_CHANGED\n );\n }\n\n /**\n * Attempts to mark a storage slot as committed.\n * @param _contract Address of the account to commit.\n * @param _key 32 byte slot key to commit.\n * @return _wasContractStorageCommitted Whether or not the slot was committed.\n */\n function commitContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageCommitted\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\n return false;\n }\n\n itemStates[item] = ItemState.ITEM_COMMITTED;\n totalUncommittedContractStorage -= 1;\n\n return true;\n }\n\n /**\n * Increments the total number of uncommitted storage slots.\n */\n function incrementTotalUncommittedContractStorage()\n override\n public\n authenticated\n {\n totalUncommittedContractStorage += 1;\n }\n\n /**\n * Gets the total number of uncommitted storage slots.\n * @return _total Total uncommitted storage slots.\n */\n function getTotalUncommittedContractStorage()\n override\n public\n view\n returns (\n uint256 _total\n )\n {\n return totalUncommittedContractStorage;\n }\n\n /**\n * Checks whether a given storage slot was changed during execution.\n * @param _contract Address to check.\n * @param _key Key of the storage slot to check.\n * @return Whether or not the storage slot was changed.\n */\n function wasContractStorageChanged(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n return itemStates[item] >= ItemState.ITEM_CHANGED;\n }\n\n /**\n * Checks whether a given storage slot was committed after execution.\n * @param _contract Address to check.\n * @param _key Key of the storage slot to check.\n * @return Whether or not the storage slot was committed.\n */\n function wasContractStorageCommitted(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Generates a unique hash for an address.\n * @param _address Address to generate a hash for.\n * @return Unique hash for the given address.\n */\n function _getItemHash(\n address _address\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_address));\n }\n\n /**\n * Generates a unique hash for an address/key pair.\n * @param _contract Address to generate a hash for.\n * @param _key Key to generate a hash for.\n * @return Unique hash for the given pair.\n */\n function _getItemHash(\n address _contract,\n bytes32 _key\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(\n _contract,\n _key\n ));\n }\n\n /**\n * Checks whether an item is in a particular state (ITEM_LOADED or ITEM_CHANGED) and sets the\n * item to the provided state if not.\n * @param _item 32 byte item ID to check.\n * @param _minItemState Minimum state that must be satisfied by the item.\n * @return _wasItemState Whether or not the item was already in the state.\n */\n function _testAndSetItemState(\n bytes32 _item,\n ItemState _minItemState\n )\n internal\n returns (\n bool _wasItemState\n )\n {\n bool wasItemState = itemStates[_item] >= _minItemState;\n\n if (wasItemState == false) {\n itemStates[_item] = _minItemState;\n }\n\n return wasItemState;\n }\n}\n" + }, + "contracts/optimistic-ethereum/mockOVM/accounts/mockOVM_ECDSAContractAccount.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title mockOVM_ECDSAContractAccount\n */\ncontract mockOVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EOA transaction.\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\n\n // Need to make sure that the transaction nonce is right.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // Contract creations are signalled by sending a transaction to the zero address.\n if (decodedTx.to == address(0)) {\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\n decodedTx.gasLimit,\n decodedTx.data\n );\n\n // If the created address is the ZERO_ADDRESS then we know the deployment failed, though not why\n return (created != address(0), abi.encode(created));\n } else {\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\n // cases, but since this is a contract we'd end up bumping the nonce twice.\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\n\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n decodedTx.gasLimit,\n decodedTx.to,\n decodedTx.data\n );\n }\n }\n\n function qall(\n uint256 _gasLimit,\n address _to,\n bytes memory _data\n )\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n _gasLimit,\n _to,\n _data\n );\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/precompiles/OVM_ProxySequencerEntrypoint.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_ProxySequencerEntrypoint \n * @dev The Proxy Sequencer Entrypoint is a predeployed proxy to the implementation of the \n * Sequencer Entrypoint. This will enable the Optimism team to upgrade the Sequencer Entrypoint \n * contract.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ProxySequencerEntrypoint {\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\n gasleft(),\n _getImplementation(),\n msg.data\n );\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function init(\n address _implementation,\n address _owner\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n _getOwner() == address(0),\n \"ProxySequencerEntrypoint has already been inited\"\n );\n _setOwner(_owner);\n _setImplementation(_implementation);\n }\n\n function upgrade(\n address _implementation\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n _getOwner() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\n \"Only owner can upgrade the Entrypoint\"\n );\n\n _setImplementation(_implementation);\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n bytes32(uint256(0)),\n bytes32(uint256(uint160(_implementation)))\n );\n }\n\n function _getImplementation()\n internal\n returns (\n address _implementation\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n bytes32(uint256(0))\n )\n )));\n }\n\n function _setOwner(\n address _owner\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n bytes32(uint256(1)),\n bytes32(uint256(uint160(_owner)))\n );\n }\n\n function _getOwner()\n internal\n returns (\n address _owner\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n bytes32(uint256(1))\n )\n )));\n }\n}\n" + }, + "contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_SafetyChecker } from \"../../iOVM/execution/iOVM_SafetyChecker.sol\";\n\n/**\n * @title OVM_SafetyChecker\n * @dev The Safety Checker verifies that contracts deployed on L2 do not contain any\n * \"unsafe\" operations. An operation is considered unsafe if it would access state variables which\n * are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used\n * to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. \n * That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction.\n * Note that a \"safe\" contract requires opcodes to appear in a particular pattern;\n * omission of \"unsafe\" opcodes is necessary, but not sufficient.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_SafetyChecker is iOVM_SafetyChecker {\n\n /********************\n * Public Functions *\n ********************/\n /**\n * Returns whether or not all of the provided bytecode is safe.\n * @param _bytecode The bytecode to safety check.\n * @return `true` if the bytecode is safe, `false` otherwise.\n */\n function isBytecodeSafe(\n bytes memory _bytecode\n )\n override\n external\n pure\n returns (bool)\n {\n // autogenerated by gen_safety_checker_constants.py\n // number of bytes to skip for each opcode\n uint256[8] memory opcodeSkippableBytes = [\n uint256(0x0001010101010101010101010000000001010101010101010101010101010000),\n uint256(0x0100000000000000000000000000000000000000010101010101000000010100),\n uint256(0x0000000000000000000000000000000001010101000000010101010100000000),\n uint256(0x0203040500000000000000000000000000000000000000000000000000000000),\n uint256(0x0101010101010101010101010101010101010101010101010101010101010101),\n uint256(0x0101010101000000000000000000000000000000000000000000000000000000),\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000),\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000)\n ];\n // Mask to gate opcode specific cases\n uint256 opcodeGateMask = ~uint256(0xffffffffffffffffffffffe000000000fffffffff070ffff9c0ffffec000f001);\n // Halting opcodes\n uint256 opcodeHaltingMask = ~uint256(0x4008000000000000000000000000000000000000004000000000000000000001);\n // PUSH opcodes\n uint256 opcodePushMask = ~uint256(0xffffffff000000000000000000000000);\n\n uint256 codeLength;\n uint256 _pc;\n assembly {\n _pc := add(_bytecode, 0x20)\n }\n codeLength = _pc + _bytecode.length;\n do {\n // current opcode: 0x00...0xff\n uint256 opNum;\n\n // inline assembly removes the extra add + bounds check\n assembly {\n let word := mload(_pc) //load the next 32 bytes at pc into word\n\n // Look up number of bytes to skip from opcodeSkippableBytes and then update indexInWord\n // E.g. the 02030405 in opcodeSkippableBytes is the number of bytes to skip for PUSH1->4\n // We repeat this 6 times, thus we can only skip bytes for up to PUSH4 ((1+4) * 6 = 30 < 32).\n // If we see an opcode that is listed as 0 skippable bytes e.g. PUSH5,\n // then we will get stuck on that indexInWord and then opNum will be set to the PUSH5 opcode.\n let indexInWord := byte(0, mload(add(opcodeSkippableBytes, byte(0, word))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n _pc := add(_pc, indexInWord)\n\n opNum := byte(indexInWord, word)\n }\n\n // + push opcodes\n // + stop opcodes [STOP(0x00),JUMP(0x56),RETURN(0xf3),INVALID(0xfe)]\n // + caller opcode CALLER(0x33)\n // + blacklisted opcodes\n uint256 opBit = 1 << opNum;\n if (opBit & opcodeGateMask == 0) {\n if (opBit & opcodePushMask == 0) {\n // all pushes are valid opcodes\n // subsequent bytes are not opcodes. Skip them.\n _pc += (opNum - 0x5e); // PUSH1 is 0x60, so opNum-0x5f = PUSHed bytes and we +1 to\n // skip the _pc++; line below in order to save gas ((-0x5f + 1) = -0x5e)\n continue;\n } else if (opBit & opcodeHaltingMask == 0) {\n // STOP or JUMP or RETURN or INVALID (Note: REVERT is blacklisted, so not included here)\n // We are now inside unreachable code until we hit a JUMPDEST!\n do {\n _pc++;\n assembly {\n opNum := byte(0, mload(_pc))\n }\n // encountered a JUMPDEST\n if (opNum == 0x5b) break;\n // skip PUSHed bytes\n if ((1 << opNum) & opcodePushMask == 0) _pc += (opNum - 0x5f); // opNum-0x5f = PUSHed bytes (PUSH1 is 0x60)\n } while (_pc < codeLength);\n // opNum is 0x5b, so we don't continue here since the pc++ is fine\n } else if (opNum == 0x33) { // Caller opcode\n uint256 firstOps; // next 32 bytes of bytecode\n uint256 secondOps; // following 32 bytes of bytecode\n\n assembly {\n firstOps := mload(_pc)\n // 37 bytes total, 5 left over --> 32 - 5 bytes = 27 bytes = 216 bits\n secondOps := shr(216, mload(add(_pc, 0x20)))\n }\n\n // Call identity precompile\n // CALLER POP PUSH1 0x00 PUSH1 0x04 GAS CALL\n // 32 - 8 bytes = 24 bytes = 192\n if ((firstOps >> 192) == 0x3350600060045af1) {\n _pc += 8;\n // Call EM and abort execution if instructed\n // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x0E ADD JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x00 REVERT JUMPDEST RETURNDATASIZE PUSH1 0x01 EQ ISZERO PC PUSH1 0x0a ADD JUMPI PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST \n } else if (firstOps == 0x336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760 && secondOps == 0x016000f35b) {\n _pc += 37;\n } else {\n return false;\n }\n continue;\n } else {\n // encountered a non-whitelisted opcode!\n return false;\n }\n }\n _pc++;\n } while (_pc < codeLength);\n return true;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 37365517a..7a4331d97 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -9,6 +9,7 @@ import { import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-waffle' import 'hardhat-typechain' +import 'hardhat-deploy' import '@eth-optimism/plugins/hardhat/compiler' import '@eth-optimism/smock/build/src/plugins/hardhat-storagelayout' @@ -17,7 +18,17 @@ const config: HardhatUserConfig = { hardhat: { accounts: DEFAULT_ACCOUNTS_HARDHAT, blockGasLimit: RUN_OVM_TEST_GAS * 2, + live: false, + saveDeployments: false, + tags: ['test', 'local'], }, + kovan: { + url: "https://kovan.infura.io/v3/", + accounts: [''], + live: true, + saveDeployments: true, + tags: ['test', 'kovan'], + } }, mocha: { timeout: 50000, @@ -32,6 +43,15 @@ const config: HardhatUserConfig = { outDir: 'build/types', target: 'ethers-v5', }, + paths: { + deploy: './deploy', + deployments: './deployments', + }, + namedAccounts: { + deployer: { + default: 0, + }, + }, } export default config diff --git a/package.json b/package.json index d47b4c97f..d1508bf4b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "lint:fix": "yarn run lint:fix:typescript", "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "clean": "rm -rf ./artifacts ./build ./cache", - "deploy": "./bin/deploy.js", + "deploy": "hardhat deploy", "serve": "./bin/serve_dump.sh" }, "dependencies": { @@ -59,6 +59,7 @@ "ethers": "^5.0.31", "fs-extra": "^9.0.1", "hardhat": "^2.0.8", + "hardhat-deploy": "^0.7.0-beta.46", "hardhat-typechain": "^0.3.4", "lodash": "^4.17.20", "merkle-patricia-tree": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index 7aa6f867e..ec1b9c12e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -181,7 +181,7 @@ "@ethersproject/properties" ">=5.0.0-beta.131" "@ethersproject/strings" ">=5.0.0-beta.130" -"@ethersproject/abi@5.0.12", "@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.0.10": +"@ethersproject/abi@5.0.12", "@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.0.10", "@ethersproject/abi@^5.0.2": version "5.0.12" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.12.tgz#9aebe6aedc05ce45bb6c41b06d80bd195b7de77c" integrity sha512-Ujr/3bwyYYjXLDQfebeiiTuvOw9XtUKM8av6YkoBeMXyGQM9GkjrQlwJMNwGTmqjATH/ZNbRgCh98GjOLiIB1Q== @@ -224,7 +224,7 @@ "@ethersproject/transactions" "^5.0.9" "@ethersproject/web" "^5.0.12" -"@ethersproject/abstract-signer@5.0.13", "@ethersproject/abstract-signer@^5.0.0", "@ethersproject/abstract-signer@^5.0.10": +"@ethersproject/abstract-signer@5.0.13", "@ethersproject/abstract-signer@^5.0.0", "@ethersproject/abstract-signer@^5.0.10", "@ethersproject/abstract-signer@^5.0.2": version "5.0.13" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.13.tgz#59b4d0367d6327ec53bc269c6730c44a4a3b043c" integrity sha512-VBIZEI5OK0TURoCYyw0t3w+TEO4kdwnI9wvt4kqUwyxSn3YCRpXYVl0Xoe7XBR/e5+nYOi2MyFGJ3tsFwONecQ== @@ -235,7 +235,7 @@ "@ethersproject/logger" "^5.0.8" "@ethersproject/properties" "^5.0.7" -"@ethersproject/address@5.0.10", "@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.0", "@ethersproject/address@^5.0.4", "@ethersproject/address@^5.0.9": +"@ethersproject/address@5.0.10", "@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.0", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.0.4", "@ethersproject/address@^5.0.9": version "5.0.10" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.0.10.tgz#2bc69fdff4408e0570471cd19dee577ab06a10d0" integrity sha512-70vqESmW5Srua1kMDIN6uVfdneZMaMyRYH4qPvkAXGkbicrCOsA9m01vIloA4wYiiF+HLEfL1ENKdn5jb9xiAw== @@ -261,7 +261,7 @@ "@ethersproject/bytes" "^5.0.9" "@ethersproject/properties" "^5.0.7" -"@ethersproject/bignumber@5.0.14", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.0", "@ethersproject/bignumber@^5.0.13", "@ethersproject/bignumber@^5.0.7": +"@ethersproject/bignumber@5.0.14", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.0", "@ethersproject/bignumber@^5.0.13", "@ethersproject/bignumber@^5.0.5", "@ethersproject/bignumber@^5.0.7": version "5.0.14" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.0.14.tgz#605bc61dcbd4a8c6df8b5a7a77c0210273f3de8a" integrity sha512-Q4TjMq9Gg3Xzj0aeJWqJgI3tdEiPiET7Y5OtNtjTAODZ2kp4y9jMNg97zVcvPedFvGROdpGDyCI77JDFodUzOw== @@ -270,7 +270,7 @@ "@ethersproject/logger" "^5.0.8" bn.js "^4.4.0" -"@ethersproject/bytes@5.0.10", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.0.9": +"@ethersproject/bytes@5.0.10", "@ethersproject/bytes@>=5.0.0-beta.129", "@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.2", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.0.9": version "5.0.10" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.0.10.tgz#aa49afe7491ba24ff76fa33d98677351263f9ba4" integrity sha512-vpu0v1LZ1j1s9kERQIMnVU69MyHEzUff7nqK9XuCU4vx+AM8n9lU2gj7jtJIvGSt9HzatK/6I6bWusI5nyuaTA== @@ -284,7 +284,7 @@ dependencies: "@ethersproject/bignumber" "^5.0.13" -"@ethersproject/contracts@5.0.11", "@ethersproject/contracts@^5.0.0", "@ethersproject/contracts@^5.0.5": +"@ethersproject/contracts@5.0.11", "@ethersproject/contracts@^5.0.0", "@ethersproject/contracts@^5.0.2", "@ethersproject/contracts@^5.0.5": version "5.0.11" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.0.11.tgz#e6cc57698a05be2329cb2ca3d7e87686f95e438a" integrity sha512-FTUUd/6x00dYL2VufE2VowZ7h3mAyBfCQMGwI3tKDIWka+C0CunllFiKrlYCdiHFuVeMotR65dIcnzbLn72MCw== @@ -397,7 +397,7 @@ dependencies: "@ethersproject/logger" "^5.0.8" -"@ethersproject/providers@5.0.23", "@ethersproject/providers@^5.0.0": +"@ethersproject/providers@5.0.23", "@ethersproject/providers@^5.0.0", "@ethersproject/providers@^5.0.5": version "5.0.23" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.23.tgz#1e26512303d60bbd557242532fdb5fa3c5d5fb73" integrity sha512-eJ94z2tgPaUgUmxwd3BVkIzkgkbNIkY6wRPVas04LVaBTycObQbgj794aaUu2bfk7+Bn2B/gjUZtJW1ybxh9/A== @@ -457,7 +457,7 @@ "@ethersproject/properties" "^5.0.7" elliptic "6.5.4" -"@ethersproject/solidity@5.0.9", "@ethersproject/solidity@^5.0.0": +"@ethersproject/solidity@5.0.9", "@ethersproject/solidity@^5.0.0", "@ethersproject/solidity@^5.0.2": version "5.0.9" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.0.9.tgz#49100fbe9f364ac56f7ff7c726f4f3d151901134" integrity sha512-LIxSAYEQgLRXE3mRPCq39ou61kqP8fDrGqEeNcaNJS3aLbmAOS8MZp56uK++WsdI9hj8sNsFh78hrAa6zR9Jag== @@ -477,7 +477,7 @@ "@ethersproject/constants" "^5.0.8" "@ethersproject/logger" "^5.0.8" -"@ethersproject/transactions@5.0.10", "@ethersproject/transactions@^5.0.0", "@ethersproject/transactions@^5.0.0-beta.135", "@ethersproject/transactions@^5.0.9": +"@ethersproject/transactions@5.0.10", "@ethersproject/transactions@^5.0.0", "@ethersproject/transactions@^5.0.0-beta.135", "@ethersproject/transactions@^5.0.2", "@ethersproject/transactions@^5.0.9": version "5.0.10" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.0.10.tgz#d50cafd80d27206336f80114bc0f18bc18687331" integrity sha512-Tqpp+vKYQyQdJQQk4M73tDzO7ODf2D42/sJOcKlDAAbdSni13v6a+31hUdo02qYXhVYwIs+ZjHnO4zKv5BNk8w== @@ -501,7 +501,7 @@ "@ethersproject/constants" "^5.0.8" "@ethersproject/logger" "^5.0.8" -"@ethersproject/wallet@5.0.11", "@ethersproject/wallet@^5.0.0": +"@ethersproject/wallet@5.0.11", "@ethersproject/wallet@^5.0.0", "@ethersproject/wallet@^5.0.2": version "5.0.11" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.0.11.tgz#9891936089d1b91e22ed59f850bc344b1544bf26" integrity sha512-2Fg/DOvUltR7aZTOyWWlQhru+SKvq2UE3uEhXSyCFgMqDQNuc2nHXh1SHJtN65jsEbjVIppOe1Q7EQMvhmeeRw== @@ -1012,6 +1012,11 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.19.1.tgz#33509849f8e679e4add158959fdb086440e9553f" integrity sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ== +"@types/qs@^6.9.4": + version "6.9.5" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.5.tgz#434711bdd49eb5ee69d90c1d67c354a9a8ecb18b" + integrity sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ== + "@types/resolve@^0.0.8": version "0.0.8" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" @@ -1425,6 +1430,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -2396,7 +2408,7 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.2, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== @@ -3161,6 +3173,11 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +encode-utf8@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/encode-utf8/-/encode-utf8-1.0.3.tgz#f30fdd31da07fb596f281beb2f6b027851994cda" + integrity sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw== + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -4130,7 +4147,14 @@ flow-stoplight@^1.0.0: resolved "https://registry.yarnpkg.com/flow-stoplight/-/flow-stoplight-1.0.0.tgz#4a292c5bcff8b39fa6cc0cb1a853d86f27eeff7b" integrity sha1-SiksW8/4s5+mzAyxqFPYbyfu/3s= -follow-redirects@^1.12.1: +fmix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fmix/-/fmix-0.1.0.tgz#c7bbf124dec42c9d191cfb947d0a9778dd986c0c" + integrity sha1-x7vxJN7ELJ0ZHPuUfQqXeN2YbAw= + dependencies: + imul "^1.0.0" + +follow-redirects@^1.10.0, follow-redirects@^1.12.1: version "1.13.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147" integrity sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA== @@ -4236,7 +4260,7 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.1: +fs-extra@^9.0.0, fs-extra@^9.0.1: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -4493,6 +4517,32 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" +hardhat-deploy@^0.7.0-beta.46: + version "0.7.0-beta.46" + resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.7.0-beta.46.tgz#6caa34a534e7d40e0f2d98a26b90e154d5004e1b" + integrity sha512-VADqekd40MYHWVQxz3jn+C7Vtfv7qPboZZYH7N8wLtPU/ZcGvEQRgB4LBkOeuwQd/80MIXwSBOrnN4x6LjIauA== + dependencies: + "@ethersproject/abi" "^5.0.2" + "@ethersproject/abstract-signer" "^5.0.2" + "@ethersproject/address" "^5.0.2" + "@ethersproject/bignumber" "^5.0.5" + "@ethersproject/bytes" "^5.0.2" + "@ethersproject/contracts" "^5.0.2" + "@ethersproject/providers" "^5.0.5" + "@ethersproject/solidity" "^5.0.2" + "@ethersproject/transactions" "^5.0.2" + "@ethersproject/wallet" "^5.0.2" + "@types/qs" "^6.9.4" + axios "^0.21.1" + chalk "^4.1.0" + chokidar "^3.4.0" + debug "^4.1.1" + form-data "^3.0.0" + fs-extra "^9.0.0" + match-all "^1.2.6" + murmur-128 "^0.2.1" + qs "^6.9.4" + hardhat-typechain@^0.3.4: version "0.3.5" resolved "https://registry.yarnpkg.com/hardhat-typechain/-/hardhat-typechain-0.3.5.tgz#8e50616a9da348b33bd001168c8fda9c66b7b4af" @@ -4797,6 +4847,11 @@ immutable@^4.0.0-rc.12: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.12.tgz#ca59a7e4c19ae8d9bf74a97bdf0f6e2f2a5d0217" integrity sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A== +imul@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/imul/-/imul-1.0.1.tgz#9d5867161e8b3de96c2c38d5dc7cb102f35e2ac9" + integrity sha1-nVhnFh6LPelsLDjV3HyxAvNeKsk= + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -5753,6 +5808,11 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +match-all@^1.2.6: + version "1.2.6" + resolved "https://registry.yarnpkg.com/match-all/-/match-all-1.2.6.tgz#66d276ad6b49655551e63d3a6ee53e8be0566f8d" + integrity sha512-0EESkXiTkWzrQQntBu2uzKvLu6vVkUGz40nGPbSZuegcfE5UuSzNjLaIu76zJWuaT/2I3Z/8M06OlUOZLGwLlQ== + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -6128,6 +6188,15 @@ multihashes@^0.4.15, multihashes@~0.4.15: multibase "^0.7.0" varint "^5.0.0" +murmur-128@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/murmur-128/-/murmur-128-0.2.1.tgz#a9f6568781d2350ecb1bf80c14968cadbeaa4b4d" + integrity sha512-WseEgiRkI6aMFBbj8Cg9yBj/y+OdipwVC7zUo3W2W1JAJITwouUOtpqsmGSg67EQmwwSyod7hsVsWY5LsrfQVg== + dependencies: + encode-utf8 "^1.0.2" + fmix "^0.1.0" + imul "^1.0.0" + nan@2.13.2: version "2.13.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" @@ -6897,7 +6966,7 @@ qs@6.7.0: resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== -qs@^6.7.0: +qs@^6.7.0, qs@^6.9.4: version "6.9.6" resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee" integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ== From b3e75a8875f88fdb20f5644321baf15e02672692 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 24 Feb 2021 16:06:02 -0800 Subject: [PATCH 02/41] Testing etherscan verifications --- deployments/kovan/Lib_AddressManager.json | 30 +- .../kovan/Lib_ResolvedDelegateProxy.json | 118 +++++ deployments/kovan/OVM_BondManager.json | 16 +- .../kovan/OVM_CanonicalTransactionChain.json | 18 +- ...OVM_ChainStorageContainer:CTC:batches.json | 489 ++++++++++++++++++ .../OVM_ChainStorageContainer:CTC:queue.json | 489 ++++++++++++++++++ ...OVM_ChainStorageContainer:SCC:batches.json | 489 ++++++++++++++++++ deployments/kovan/OVM_ExecutionManager.json | 18 +- deployments/kovan/OVM_FraudVerifier.json | 18 +- .../kovan/OVM_L1CrossDomainMessenger.json | 477 +++++++++++++++++ .../kovan/OVM_L1MultiMessageRelayer.json | 205 ++++++++ deployments/kovan/OVM_SafetyChecker.json | 74 +++ .../kovan/OVM_StateCommitmentChain.json | 18 +- .../kovan/OVM_StateManagerFactory.json | 16 +- .../kovan/OVM_StateTransitionerFactory.json | 139 +++++ package.json | 1 + 16 files changed, 2548 insertions(+), 67 deletions(-) create mode 100644 deployments/kovan/Lib_ResolvedDelegateProxy.json create mode 100644 deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json create mode 100644 deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json create mode 100644 deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json create mode 100644 deployments/kovan/OVM_L1CrossDomainMessenger.json create mode 100644 deployments/kovan/OVM_L1MultiMessageRelayer.json create mode 100644 deployments/kovan/OVM_SafetyChecker.json create mode 100644 deployments/kovan/OVM_StateTransitionerFactory.json diff --git a/deployments/kovan/Lib_AddressManager.json b/deployments/kovan/Lib_AddressManager.json index 7cec2c6cc..af56ec835 100644 --- a/deployments/kovan/Lib_AddressManager.json +++ b/deployments/kovan/Lib_AddressManager.json @@ -1,5 +1,5 @@ { - "address": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "address": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", "abi": [ { "anonymous": false, @@ -110,34 +110,34 @@ "type": "function" } ], - "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", + "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", - "transactionIndex": 3, + "contractAddress": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", + "transactionIndex": 4, "gasUsed": "412650", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000021000000000000000000000000000000000000020000000000400000000800000000000000000000000000000400400000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x80415e44dde419392304c9f8036898532069aa96dec2e8c0311156e995f5e872", - "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000001000000000000000000000000000000000000020000000000000000000800000000000000020000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000400000000000080000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000080000000000000000000000", + "blockHash": "0xa2b4941db92d94093afe6dea21f51961f9029fd2eead1452dd8af1f3072f5c2f", + "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", "logs": [ { - "transactionIndex": 3, - "blockNumber": 23635971, - "transactionHash": "0x5985cfd0911b2ba4b8c48e5bba095fcb29644c4b60dbaf4ee24a82446522c9ab", - "address": "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "transactionIndex": 4, + "blockNumber": 23637091, + "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", + "address": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000003a953298098cadcb621a40c1efcfb7dd73b727af" ], "data": "0x", - "logIndex": 5, - "blockHash": "0x80415e44dde419392304c9f8036898532069aa96dec2e8c0311156e995f5e872" + "logIndex": 2, + "blockHash": "0xa2b4941db92d94093afe6dea21f51961f9029fd2eead1452dd8af1f3072f5c2f" } ], - "blockNumber": 23635971, - "cumulativeGasUsed": "628696", + "blockNumber": 23637091, + "cumulativeGasUsed": "687945", "status": 1, "byzantium": true }, diff --git a/deployments/kovan/Lib_ResolvedDelegateProxy.json b/deployments/kovan/Lib_ResolvedDelegateProxy.json new file mode 100644 index 000000000..566fdd741 --- /dev/null +++ b/deployments/kovan/Lib_ResolvedDelegateProxy.json @@ -0,0 +1,118 @@ +{ + "address": "0x8E41057ebbC501581dE5C3C73D38ef34Ca8422dD", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_implementationName", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + } + ], + "transactionHash": "0x001bb76bb2c52fba9c599f3cb4993253f6f8aed5324ddc2764d892dcde96d2cb", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x8E41057ebbC501581dE5C3C73D38ef34Ca8422dD", + "transactionIndex": 2, + "gasUsed": "225652", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x8f991a3cf39369752b6d61d7c02fb694e9eedb2aa50a60e1545f49b4bef87e80", + "transactionHash": "0x001bb76bb2c52fba9c599f3cb4993253f6f8aed5324ddc2764d892dcde96d2cb", + "logs": [], + "blockNumber": 23637150, + "cumulativeGasUsed": "300502", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", + "OVM_L1CrossDomainMessenger" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_implementationName\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_implementationName\":\"implementationName of the contract to proxy to.\",\"_libAddressManager\":\"Address of the Lib_AddressManager.\"}}},\"title\":\"Lib_ResolvedDelegateProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":\"Lib_ResolvedDelegateProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_ResolvedDelegateProxy\\n */\\ncontract Lib_ResolvedDelegateProxy {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n\\n // Using mappings to store fields to avoid overwriting storage slots in the\\n // implementation contract. For example, instead of storing these fields at\\n // storage slot `0` & `1`, they are stored at `keccak256(key + slot)`.\\n // See: https://solidity.readthedocs.io/en/v0.7.0/internals/layout_in_storage.html\\n // NOTE: Do not use this code in your own contract system. \\n // There is a known flaw in this contract, and we will remove it from the repository\\n // in the near future. Due to the very limited way that we are using it, this flaw is\\n // not an issue in our system. \\n mapping(address=>string) private implementationName;\\n mapping(address=>Lib_AddressManager) private addressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n * @param _implementationName implementationName of the contract to proxy to.\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _implementationName\\n )\\n public\\n {\\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\\n implementationName[address(this)] = _implementationName;\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n address target = addressManager[address(this)].getAddress((implementationName[address(this)]));\\n require(\\n target != address(0),\\n \\\"Target address must be initialized.\\\"\\n );\\n\\n (bool success, bytes memory returndata) = target.delegatecall(msg.data);\\n\\n if (success == true) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b349c55f559e95b3e893321cc8603d1c4eb53c155023a8a4de329c48f30561c\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516104173803806104178339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610233806101e46000396000f3fe608060405234801561001057600080fd5b5030600090815260016020818152604080842054848352818520915163bf40fac160e01b815260048101938452825460026101009682161596909602600019011694909404602485018190526001600160a01b039091169363bf40fac19391829160440190849080156100c45780601f10610099576101008083540402835291602001916100c4565b820191906000526020600020905b8154815290600101906020018083116100a757829003601f168201915b50509250505060206040518083038186803b1580156100e257600080fd5b505afa1580156100f6573d6000803e3d6000fd5b505050506040513d602081101561010c57600080fd5b505190506001600160a01b0381166101555760405162461bcd60e51b81526004018080602001828103825260238152602001806101db6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101b4576040519150601f19603f3d011682016040523d82523d6000602084013e6101b9565b606091505b509092509050600182151514156101d257805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220fd3c10941281cebac2447ea154c74e2ae444a39652df5a90ac7eb30c6635b01a64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b5030600090815260016020818152604080842054848352818520915163bf40fac160e01b815260048101938452825460026101009682161596909602600019011694909404602485018190526001600160a01b039091169363bf40fac19391829160440190849080156100c45780601f10610099576101008083540402835291602001916100c4565b820191906000526020600020905b8154815290600101906020018083116100a757829003601f168201915b50509250505060206040518083038186803b1580156100e257600080fd5b505afa1580156100f6573d6000803e3d6000fd5b505050506040513d602081101561010c57600080fd5b505190506001600160a01b0381166101555760405162461bcd60e51b81526004018080602001828103825260238152602001806101db6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101b4576040519150601f19603f3d011682016040523d82523d6000602084013e6101b9565b606091505b509092509050600182151514156101d257805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220fd3c10941281cebac2447ea154c74e2ae444a39652df5a90ac7eb30c6635b01a64736f6c63430007060033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_implementationName": "implementationName of the contract to proxy to.", + "_libAddressManager": "Address of the Lib_AddressManager." + } + } + }, + "title": "Lib_ResolvedDelegateProxy", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12462, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", + "label": "implementationName", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_string_storage)" + }, + { + "astId": 12466, + "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", + "label": "addressManager", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_contract(Lib_AddressManager)12330)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_contract(Lib_AddressManager)12330)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => contract Lib_AddressManager)", + "numberOfBytes": "32", + "value": "t_contract(Lib_AddressManager)12330" + }, + "t_mapping(t_address,t_string_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_BondManager.json b/deployments/kovan/OVM_BondManager.json index 451f77a88..131977266 100644 --- a/deployments/kovan/OVM_BondManager.json +++ b/deployments/kovan/OVM_BondManager.json @@ -1,5 +1,5 @@ { - "address": "0x71869a507DC672f3D35352974b172403272256De", + "address": "0xEE7ff790277fF593282F3e4C2877966018788755", "abi": [ { "inputs": [ @@ -280,25 +280,25 @@ "type": "function" } ], - "transactionHash": "0x6bcc8754bc27dc40c113f2f20644b0e9f0f7f2d901d327dfa19fb4fdbc853f11", + "transactionHash": "0x6bb948ad4d41530f9bde95dbc714a8e246a2985862b1ac1b5575ee30338d5015", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x71869a507DC672f3D35352974b172403272256De", + "contractAddress": "0xEE7ff790277fF593282F3e4C2877966018788755", "transactionIndex": 2, "gasUsed": "1096239", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe99aed539905019ac91fbdeac018736d318ffc7992884100a1b7388dcf953ee3", - "transactionHash": "0x6bcc8754bc27dc40c113f2f20644b0e9f0f7f2d901d327dfa19fb4fdbc853f11", + "blockHash": "0xc2da57e6e305e720dc89808ed705d1af36f1c4e6d493eb044b429a56f8643c0a", + "transactionHash": "0x6bb948ad4d41530f9bde95dbc714a8e246a2985862b1ac1b5575ee30338d5015", "logs": [], - "blockNumber": 23635972, - "cumulativeGasUsed": "1264939", + "blockNumber": 23637093, + "cumulativeGasUsed": "2234758", "status": 1, "byzantium": true }, "args": [ "0x0000000000000000000000000000000000000000", - "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad" + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" ], "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"enum iOVM_BondManager.State\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"withdrawalTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"firstDisputeAt\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"earliestDisputedStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"earliestTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisher\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"finalize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"multiFraudProofPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasSpent\",\"type\":\"uint256\"}],\"name\":\"recordGasSpent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"requiredCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"witnessProviders\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canClaim\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Bond Manager contract handles deposits in the form of an ERC20 token from bonded Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, and the Verifier's gas costs are refunded. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{},\"title\":\"OVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bonds(address)\":{\"notice\":\"The bonds posted by each proposer\"},\"claim(address)\":{\"notice\":\"Claims the user's reward for the witnesses they provided for the earliest disputed state root of the designated publisher\"},\"constructor\":{\"notice\":\"Initializes with a ERC20 token to be used for the fidelity bonds and with the Address Manager\"},\"deposit()\":{\"notice\":\"Sequencers call this function to post collateral which will be used for the `appendBatch` call\"},\"disputePeriodSeconds()\":{\"notice\":\"The dispute period\"},\"finalize(bytes32,address,uint256)\":{\"notice\":\"Slashes + distributes rewards or frees up the sequencer's bond, only called by `FraudVerifier.finalizeFraudVerification`\"},\"finalizeWithdrawal()\":{\"notice\":\"Finalizes a pending withdrawal from a publisher\"},\"getGasSpent(bytes32,address)\":{\"notice\":\"Gets how many witnesses the user has provided for the state root\"},\"isCollateralized(address)\":{\"notice\":\"Checks if the user is collateralized\"},\"multiFraudProofPeriod()\":{\"notice\":\"The period to find the earliest fraud proof for a publisher\"},\"recordGasSpent(bytes32,bytes32,address,uint256)\":{\"notice\":\"Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\"},\"requiredCollateral()\":{\"notice\":\"The minimum collateral a sequencer must post\"},\"startWithdrawal()\":{\"notice\":\"Starts the withdrawal for a publisher\"},\"token()\":{\"notice\":\"The bond token\"},\"witnessProviders(bytes32)\":{\"notice\":\"For each pre-state root, there's an array of witnessProviders that must be rewarded for posting witnesses\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":\"OVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_BondManager, Errors, ERC20 } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\n\\n/**\\n * @title OVM_BondManager\\n * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded \\n * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a\\n * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, \\n * and the Verifier's gas costs are refunded.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\\n\\n /****************************\\n * Constants and Parameters *\\n ****************************/\\n\\n /// The period to find the earliest fraud proof for a publisher\\n uint256 public constant multiFraudProofPeriod = 7 days;\\n\\n /// The dispute period\\n uint256 public constant disputePeriodSeconds = 7 days;\\n\\n /// The minimum collateral a sequencer must post\\n uint256 public constant requiredCollateral = 1 ether;\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n /// The bond token\\n ERC20 immutable public token;\\n\\n\\n /********************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n /// The bonds posted by each proposer\\n mapping(address => Bond) public bonds;\\n\\n /// For each pre-state root, there's an array of witnessProviders that must be rewarded\\n /// for posting witnesses\\n mapping(bytes32 => Rewards) public witnessProviders;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /// Initializes with a ERC20 token to be used for the fidelity bonds\\n /// and with the Address Manager\\n constructor(\\n ERC20 _token,\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n token = _token;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\\n function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public {\\n // The sender must be the transitioner that corresponds to the claimed pre-state root\\n address transitioner = address(iOVM_FraudVerifier(resolve(\\\"OVM_FraudVerifier\\\")).getStateTransitioner(_preStateRoot, _txHash));\\n require(transitioner == msg.sender, Errors.ONLY_TRANSITIONER);\\n\\n witnessProviders[_preStateRoot].total += gasSpent;\\n witnessProviders[_preStateRoot].gasSpent[who] += gasSpent;\\n }\\n\\n /// Slashes + distributes rewards or frees up the sequencer's bond, only called by\\n /// `FraudVerifier.finalizeFraudVerification`\\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {\\n require(msg.sender == resolve(\\\"OVM_FraudVerifier\\\"), Errors.ONLY_FRAUD_VERIFIER);\\n require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);\\n\\n // allow users to claim from that state root's\\n // pool of collateral (effectively slashing the sequencer)\\n witnessProviders[_preStateRoot].canClaim = true;\\n\\n Bond storage bond = bonds[publisher];\\n if (bond.firstDisputeAt == 0) {\\n bond.firstDisputeAt = block.timestamp;\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n } else if (\\n // only update the disputed state root for the publisher if it's within\\n // the dispute period _and_ if it's before the previous one\\n block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod &&\\n timestamp < bond.earliestTimestamp\\n ) {\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n }\\n\\n // if the fraud proof's dispute period does not intersect with the \\n // withdrawal's timestamp, then the user should not be slashed\\n // e.g if a user at day 10 submits a withdrawal, and a fraud proof\\n // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d)\\n // is before the user started their withdrawal. on the contrary, if the user\\n // had started their withdrawal at, say, day 6, they would be slashed\\n if (\\n bond.withdrawalTimestamp != 0 && \\n uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds &&\\n bond.state == State.WITHDRAWING\\n ) {\\n return;\\n }\\n\\n // slash!\\n bond.state = State.NOT_COLLATERALIZED;\\n }\\n\\n /// Sequencers call this function to post collateral which will be used for\\n /// the `appendBatch` call\\n function deposit() override public {\\n require(\\n token.transferFrom(msg.sender, address(this), requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n\\n // This cannot overflow\\n bonds[msg.sender].state = State.COLLATERALIZED;\\n }\\n\\n /// Starts the withdrawal for a publisher\\n function startWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n require(bond.withdrawalTimestamp == 0, Errors.WITHDRAWAL_PENDING);\\n require(bond.state == State.COLLATERALIZED, Errors.WRONG_STATE);\\n\\n bond.state = State.WITHDRAWING;\\n bond.withdrawalTimestamp = uint32(block.timestamp);\\n }\\n\\n /// Finalizes a pending withdrawal from a publisher\\n function finalizeWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n\\n require(\\n block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, \\n Errors.TOO_EARLY\\n );\\n require(bond.state == State.WITHDRAWING, Errors.SLASHED);\\n \\n // refunds!\\n bond.state = State.NOT_COLLATERALIZED;\\n bond.withdrawalTimestamp = 0;\\n \\n require(\\n token.transfer(msg.sender, requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n }\\n\\n /// Claims the user's reward for the witnesses they provided for the earliest\\n /// disputed state root of the designated publisher\\n function claim(address who) override public {\\n Bond storage bond = bonds[who];\\n require(\\n block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod,\\n Errors.WAIT_FOR_DISPUTES\\n );\\n\\n // reward the earliest state root for this publisher\\n bytes32 _preStateRoot = bond.earliestDisputedStateRoot;\\n Rewards storage rewards = witnessProviders[_preStateRoot];\\n\\n // only allow claiming if fraud was proven in `finalize`\\n require(rewards.canClaim, Errors.CANNOT_CLAIM);\\n\\n // proportional allocation - only reward 50% (rest gets locked in the\\n // contract forever\\n uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total);\\n\\n // reset the user's spent gas so they cannot double claim\\n rewards.gasSpent[msg.sender] = 0;\\n\\n // transfer\\n require(token.transfer(msg.sender, amount), Errors.ERC20_ERR);\\n }\\n\\n /// Checks if the user is collateralized\\n function isCollateralized(address who) override public view returns (bool) {\\n return bonds[who].state == State.COLLATERALIZED;\\n }\\n\\n /// Gets how many witnesses the user has provided for the state root\\n function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) {\\n return witnessProviders[preStateRoot].gasSpent[who];\\n }\\n}\\n\",\"keccak256\":\"0xad36f4e83cc43072164586ecb272fd444057a95026ab60cf04d51837a82b2020\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", diff --git a/deployments/kovan/OVM_CanonicalTransactionChain.json b/deployments/kovan/OVM_CanonicalTransactionChain.json index dfb6836e3..a1011697b 100644 --- a/deployments/kovan/OVM_CanonicalTransactionChain.json +++ b/deployments/kovan/OVM_CanonicalTransactionChain.json @@ -1,5 +1,5 @@ { - "address": "0xBb6D8540E168061fe9dbB061d234a00A780d10D5", + "address": "0x2886C4650fC8aC07bF672046c9F90C47Ce581964", "abi": [ { "inputs": [ @@ -588,24 +588,24 @@ "type": "function" } ], - "transactionHash": "0xd195e634a334664c61e6d7bb9281209e14c7a55531c55a78ca40b144c6d20a16", + "transactionHash": "0x812d2607ab53ea9743c4b34e065e6df0f788f130ef44dae7d51e102542ef9506", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xBb6D8540E168061fe9dbB061d234a00A780d10D5", - "transactionIndex": 2, + "contractAddress": "0x2886C4650fC8aC07bF672046c9F90C47Ce581964", + "transactionIndex": 4, "gasUsed": "2859140", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3089f59aa3e8d7312a47129073d12786b52febc00d34a394ae9031411263d7a8", - "transactionHash": "0xd195e634a334664c61e6d7bb9281209e14c7a55531c55a78ca40b144c6d20a16", + "blockHash": "0x68ce91e64698d8626ec602bf796e037699aff0a3223bbff632d8dc8d42cebfbb", + "transactionHash": "0x812d2607ab53ea9743c4b34e065e6df0f788f130ef44dae7d51e102542ef9506", "logs": [], - "blockNumber": 23635974, - "cumulativeGasUsed": "2929664", + "blockNumber": 23637097, + "cumulativeGasUsed": "3175403", "status": 1, "byzantium": true }, "args": [ - "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", 600, 10, 9000000 diff --git a/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json b/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json new file mode 100644 index 000000000..991a4f619 --- /dev/null +++ b/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json @@ -0,0 +1,489 @@ +{ + "address": "0x25879DC7C9a069B747e52e72c6082573aF6310ee", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_owner", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "get", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGlobalMetadata", + "outputs": [ + { + "internalType": "bytes27", + "name": "", + "type": "bytes27" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "length", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "setGlobalMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "setNextOverwritableIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8601555569a384783bbc7859ec5fc559f7f8d62127d04705d3930e439f925847", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x25879DC7C9a069B747e52e72c6082573aF6310ee", + "transactionIndex": 3, + "gasUsed": "1101114", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeab28cfdf6068d35688766c5b72acce4bdc09c4dfb97ad4de607fdb2eff385c5", + "transactionHash": "0x8601555569a384783bbc7859ec5fc559f7f8d62127d04705d3930e439f925847", + "logs": [], + "blockNumber": 23637102, + "cumulativeGasUsed": "1347009", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", + "OVM_CanonicalTransactionChain" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "devdoc": { + "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager.", + "_owner": "Name of the contract that owns this container (will be resolved later)." + } + }, + "deleteElementsAfterInclusive(uint256)": { + "params": { + "_index": "Object index to delete from." + } + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_index": "Object index to delete from." + } + }, + "get(uint256)": { + "params": { + "_index": "Index of the particular object to access." + }, + "returns": { + "_0": "32 byte object value." + } + }, + "getGlobalMetadata()": { + "returns": { + "_0": "Container global metadata field." + } + }, + "length()": { + "returns": { + "_0": "Number of objects in the container." + } + }, + "push(bytes32)": { + "params": { + "_object": "A 32 byte value to insert into the container." + } + }, + "push(bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_object": "A 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32)": { + "params": { + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "setGlobalMetadata(bytes27)": { + "params": { + "_globalMetadata": "New global metadata to set." + } + } + }, + "title": "OVM_ChainStorageContainer", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "deleteElementsAfterInclusive(uint256)": { + "notice": "Removes all objects after and including a given index." + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." + }, + "get(uint256)": { + "notice": "Retrieves an object from the container." + }, + "getGlobalMetadata()": { + "notice": "Retrieves the container's global metadata field." + }, + "length()": { + "notice": "Retrieves the number of objects stored in the container." + }, + "push(bytes32)": { + "notice": "Pushes an object into the container." + }, + "push(bytes32,bytes27)": { + "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." + }, + "push2(bytes32,bytes32)": { + "notice": "Pushes two objects into the container at the same time. A useful optimization." + }, + "push2(bytes32,bytes32,bytes27)": { + "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." + }, + "setGlobalMetadata(bytes27)": { + "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." + }, + "setNextOverwritableIndex(uint256)": { + "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 3530, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3532, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17592_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17581_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17576, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17580, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)17592_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.RingBuffer", + "members": [ + { + "astId": 17583, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextA", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17585, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextB", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 17587, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferA", + "offset": 0, + "slot": "2", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17589, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferB", + "offset": 0, + "slot": "4", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17591, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "nextOverwritableIndex", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "numberOfBytes": "224" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json b/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json new file mode 100644 index 000000000..b700c2ce1 --- /dev/null +++ b/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json @@ -0,0 +1,489 @@ +{ + "address": "0x06Ce68b7798B51f70bC7b3789927DE5aE1E8553E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_owner", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "get", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGlobalMetadata", + "outputs": [ + { + "internalType": "bytes27", + "name": "", + "type": "bytes27" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "length", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "setGlobalMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "setNextOverwritableIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9e3b086de80db8af2a94823deefb325bf61c411a1c7b1678246760261c98c675", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x06Ce68b7798B51f70bC7b3789927DE5aE1E8553E", + "transactionIndex": 3, + "gasUsed": "1101114", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xec69dd8429213b45eb9c69842f4baeb4b80b1b81ee37e474bbcfe9a93d441551", + "transactionHash": "0x9e3b086de80db8af2a94823deefb325bf61c411a1c7b1678246760261c98c675", + "logs": [], + "blockNumber": 23637105, + "cumulativeGasUsed": "1337417", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", + "OVM_CanonicalTransactionChain" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "devdoc": { + "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager.", + "_owner": "Name of the contract that owns this container (will be resolved later)." + } + }, + "deleteElementsAfterInclusive(uint256)": { + "params": { + "_index": "Object index to delete from." + } + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_index": "Object index to delete from." + } + }, + "get(uint256)": { + "params": { + "_index": "Index of the particular object to access." + }, + "returns": { + "_0": "32 byte object value." + } + }, + "getGlobalMetadata()": { + "returns": { + "_0": "Container global metadata field." + } + }, + "length()": { + "returns": { + "_0": "Number of objects in the container." + } + }, + "push(bytes32)": { + "params": { + "_object": "A 32 byte value to insert into the container." + } + }, + "push(bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_object": "A 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32)": { + "params": { + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "setGlobalMetadata(bytes27)": { + "params": { + "_globalMetadata": "New global metadata to set." + } + } + }, + "title": "OVM_ChainStorageContainer", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "deleteElementsAfterInclusive(uint256)": { + "notice": "Removes all objects after and including a given index." + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." + }, + "get(uint256)": { + "notice": "Retrieves an object from the container." + }, + "getGlobalMetadata()": { + "notice": "Retrieves the container's global metadata field." + }, + "length()": { + "notice": "Retrieves the number of objects stored in the container." + }, + "push(bytes32)": { + "notice": "Pushes an object into the container." + }, + "push(bytes32,bytes27)": { + "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." + }, + "push2(bytes32,bytes32)": { + "notice": "Pushes two objects into the container at the same time. A useful optimization." + }, + "push2(bytes32,bytes32,bytes27)": { + "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." + }, + "setGlobalMetadata(bytes27)": { + "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." + }, + "setNextOverwritableIndex(uint256)": { + "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 3530, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3532, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17592_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17581_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17576, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17580, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)17592_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.RingBuffer", + "members": [ + { + "astId": 17583, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextA", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17585, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextB", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 17587, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferA", + "offset": 0, + "slot": "2", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17589, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferB", + "offset": 0, + "slot": "4", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17591, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "nextOverwritableIndex", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "numberOfBytes": "224" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json b/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json new file mode 100644 index 000000000..9d83ae699 --- /dev/null +++ b/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json @@ -0,0 +1,489 @@ +{ + "address": "0xAF1C94a7602557Ae77d868ed5a595904A6CD5DdA", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "string", + "name": "_owner", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "deleteElementsAfterInclusive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "get", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGlobalMetadata", + "outputs": [ + { + "internalType": "bytes27", + "name": "", + "type": "bytes27" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "length", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_object", + "type": "bytes32" + } + ], + "name": "push", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + }, + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_objectA", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_objectB", + "type": "bytes32" + } + ], + "name": "push2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes27", + "name": "_globalMetadata", + "type": "bytes27" + } + ], + "name": "setGlobalMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "setNextOverwritableIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x48a5aea3621e8e9061a2a94f5388aecb58703dd0967b0b8b115f86fc9305861a", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0xAF1C94a7602557Ae77d868ed5a595904A6CD5DdA", + "transactionIndex": 6, + "gasUsed": "1101054", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x082e88c2590d6c9055c0069b9ebd79a957477bb192600be997649a4987b64205", + "transactionHash": "0x48a5aea3621e8e9061a2a94f5388aecb58703dd0967b0b8b115f86fc9305861a", + "logs": [], + "blockNumber": 23637109, + "cumulativeGasUsed": "2021601", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", + "OVM_StateCommitmentChain" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", + "devdoc": { + "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_libAddressManager": "Address of the Address Manager.", + "_owner": "Name of the contract that owns this container (will be resolved later)." + } + }, + "deleteElementsAfterInclusive(uint256)": { + "params": { + "_index": "Object index to delete from." + } + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_index": "Object index to delete from." + } + }, + "get(uint256)": { + "params": { + "_index": "Index of the particular object to access." + }, + "returns": { + "_0": "32 byte object value." + } + }, + "getGlobalMetadata()": { + "returns": { + "_0": "Container global metadata field." + } + }, + "length()": { + "returns": { + "_0": "Number of objects in the container." + } + }, + "push(bytes32)": { + "params": { + "_object": "A 32 byte value to insert into the container." + } + }, + "push(bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_object": "A 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32)": { + "params": { + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "push2(bytes32,bytes32,bytes27)": { + "params": { + "_globalMetadata": "New global metadata for the container.", + "_objectA": "First 32 byte value to insert into the container.", + "_objectB": "Second 32 byte value to insert into the container." + } + }, + "setGlobalMetadata(bytes27)": { + "params": { + "_globalMetadata": "New global metadata to set." + } + } + }, + "title": "OVM_ChainStorageContainer", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "deleteElementsAfterInclusive(uint256)": { + "notice": "Removes all objects after and including a given index." + }, + "deleteElementsAfterInclusive(uint256,bytes27)": { + "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." + }, + "get(uint256)": { + "notice": "Retrieves an object from the container." + }, + "getGlobalMetadata()": { + "notice": "Retrieves the container's global metadata field." + }, + "length()": { + "notice": "Retrieves the number of objects stored in the container." + }, + "push(bytes32)": { + "notice": "Pushes an object into the container." + }, + "push(bytes32,bytes27)": { + "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." + }, + "push2(bytes32,bytes32)": { + "notice": "Pushes two objects into the container at the same time. A useful optimization." + }, + "push2(bytes32,bytes32,bytes27)": { + "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." + }, + "setGlobalMetadata(bytes27)": { + "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." + }, + "setNextOverwritableIndex(uint256)": { + "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + }, + { + "astId": 3530, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "owner", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + }, + { + "astId": 3532, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buffer", + "offset": 0, + "slot": "2", + "type": "t_struct(RingBuffer)17592_storage" + } + ], + "types": { + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(Buffer)17581_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.Buffer", + "members": [ + { + "astId": 17576, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "length", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 17580, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "buf", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RingBuffer)17592_storage": { + "encoding": "inplace", + "label": "struct Lib_RingBuffer.RingBuffer", + "members": [ + { + "astId": 17583, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextA", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 17585, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "contextB", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 17587, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferA", + "offset": 0, + "slot": "2", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17589, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "bufferB", + "offset": 0, + "slot": "4", + "type": "t_struct(Buffer)17581_storage" + }, + { + "astId": 17591, + "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", + "label": "nextOverwritableIndex", + "offset": 0, + "slot": "6", + "type": "t_uint256" + } + ], + "numberOfBytes": "224" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_ExecutionManager.json b/deployments/kovan/OVM_ExecutionManager.json index 99b3a02d8..69c30c201 100644 --- a/deployments/kovan/OVM_ExecutionManager.json +++ b/deployments/kovan/OVM_ExecutionManager.json @@ -1,5 +1,5 @@ { - "address": "0x13E0344eB59423F9f34B3f4394aE922b48E86275", + "address": "0xE55fdd933d620627705250379dd32cd6Ec892522", "abi": [ { "inputs": [ @@ -648,24 +648,24 @@ "type": "function" } ], - "transactionHash": "0x36af51a4aa6e814bb6a7351d24ae3170f49ab7645f84a06a88a49368369f233b", + "transactionHash": "0x0b637586f6bd15e031f459b57264d7a2a1abbf050198af644c2df528d688875c", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x13E0344eB59423F9f34B3f4394aE922b48E86275", - "transactionIndex": 1, + "contractAddress": "0xE55fdd933d620627705250379dd32cd6Ec892522", + "transactionIndex": 4, "gasUsed": "3207657", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0bf0d393ae9d4c3934b091dfb23f9336fb00e9a6adfc6a50256c1627ba9c267b", - "transactionHash": "0x36af51a4aa6e814bb6a7351d24ae3170f49ab7645f84a06a88a49368369f233b", + "blockHash": "0xccae2bf861349aec4ec5327584fec9753cf13368bb40c619ffff5d79e6fc1f52", + "transactionHash": "0x0b637586f6bd15e031f459b57264d7a2a1abbf050198af644c2df528d688875c", "logs": [], - "blockNumber": 23635977, - "cumulativeGasUsed": "3250822", + "blockNumber": 23637114, + "cumulativeGasUsed": "3946015", "status": 1, "byzantium": true }, "args": [ - "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", { "minTransactionGasLimit": 20000, "maxTransactionGasLimit": 9000000, diff --git a/deployments/kovan/OVM_FraudVerifier.json b/deployments/kovan/OVM_FraudVerifier.json index 24fc5b09a..62c7829bd 100644 --- a/deployments/kovan/OVM_FraudVerifier.json +++ b/deployments/kovan/OVM_FraudVerifier.json @@ -1,5 +1,5 @@ { - "address": "0x22d5693F575d3DeDA9cb4A23ADff6a7A65C290af", + "address": "0x22842217e057F4890839F908e90Bbc5e60293313", "abi": [ { "inputs": [ @@ -424,24 +424,24 @@ "type": "function" } ], - "transactionHash": "0x4b58fe171fdc1dde44839a5e76f05e33c5e1a3323cce6e937df497e0cd573495", + "transactionHash": "0xb08165f2828fcf0cae83ec8ed328b3a9977a6ea1aaf0a64b653c3f2f8fdaea58", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x22d5693F575d3DeDA9cb4A23ADff6a7A65C290af", - "transactionIndex": 2, + "contractAddress": "0x22842217e057F4890839F908e90Bbc5e60293313", + "transactionIndex": 3, "gasUsed": "1375611", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x92a9f80b9e794a7ed77c396aed92cfb4b024d1b72ba517574fa759335cca198f", - "transactionHash": "0x4b58fe171fdc1dde44839a5e76f05e33c5e1a3323cce6e937df497e0cd573495", + "blockHash": "0xd966d6303be33ba17c768eaa686378361f16b66db574d8919483bbcd6c20bceb", + "transactionHash": "0xb08165f2828fcf0cae83ec8ed328b3a9977a6ea1aaf0a64b653c3f2f8fdaea58", "logs": [], - "blockNumber": 23636599, - "cumulativeGasUsed": "1564561", + "blockNumber": 23637120, + "cumulativeGasUsed": "2047424", "status": 1, "byzantium": true }, "args": [ - "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad" + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" ], "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofFinalized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofInitialized\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_postStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_postStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_postStateRootProof\",\"type\":\"tuple\"}],\"name\":\"finalizeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"}],\"name\":\"getStateTransitioner\",\"outputs\":[{\"internalType\":\"contract iOVM_StateTransitioner\",\"name\":\"_transitioner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"isSequenced\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"txData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.TransactionChainElement\",\"name\":\"_txChainElement\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_transactionBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_transactionProof\",\"type\":\"tuple\"}],\"name\":\"initializeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Fraud Verifier contract coordinates the entire fraud proof verification process. If the fraud proof was successful it prunes any state batches from State Commitment Chain which were published after the fraudulent state root. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_postStateRoot\":\"State root after the fraudulent transaction.\",\"_postStateRootBatchHeader\":\"Batch header for the provided post-state root.\",\"_postStateRootProof\":\"Inclusion proof for the provided post-state root.\",\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_txHash\":\"The transaction for the state root\"}},\"getStateTransitioner(bytes32,bytes32)\":{\"params\":{\"_preStateRoot\":\"State root to query a transitioner for.\"},\"returns\":{\"_transitioner\":\"Corresponding state transitioner contract.\"}},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_transaction\":\"OVM transaction claimed to be fraudulent.\",\"_transactionBatchHeader\":\"Batch header for the provided transaction.\",\"_transactionProof\":\"Inclusion proof for the provided transaction.\",\"_txChainElement\":\"OVM transaction chain element.\"}}},\"title\":\"OVM_FraudVerifier\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Finalizes the fraud verification process.\"},\"getStateTransitioner(bytes32,bytes32)\":{\"notice\":\"Retrieves the state transitioner for a given root.\"},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Begins the fraud verification process.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":\"OVM_FraudVerifier\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/// Minimal contract to be inherited by contracts consumed by users that provide\\n/// data for fraud proofs\\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\\n /// Decorate your functions with this modifier to store how much total gas was\\n /// consumed by the sender, to reward users fairly\\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\\n uint256 startGas = gasleft();\\n _;\\n uint256 gasSpent = startGas - gasleft();\\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\\n }\\n}\\n\",\"keccak256\":\"0x6c27d089a297103cb93b30f7649ab68691cc6b948c315f1037e5de1fe9bf5903\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_StateTransitionerFactory } from \\\"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_FraudContributor } from \\\"./Abs_FraudContributor.sol\\\";\\n\\n\\n\\n/**\\n * @title OVM_FraudVerifier\\n * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. \\n * If the fraud proof was successful it prunes any state batches from State Commitment Chain\\n * which were published after the fraudulent state root.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier {\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => iOVM_StateTransitioner) internal transitioners;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n /**\\n * Retrieves the state transitioner for a given root.\\n * @param _preStateRoot State root to query a transitioner for.\\n * @return _transitioner Corresponding state transitioner contract.\\n */\\n function getStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n override\\n public\\n view\\n returns (\\n iOVM_StateTransitioner _transitioner\\n )\\n {\\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\\n }\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n /**\\n * Begins the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _transaction OVM transaction claimed to be fraudulent.\\n * @param _txChainElement OVM transaction chain element.\\n * @param _transactionBatchHeader Batch header for the provided transaction.\\n * @param _transactionProof Inclusion proof for the provided transaction.\\n */\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _transactionProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction))\\n {\\n bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction);\\n\\n if (_hasStateTransitioner(_preStateRoot, _txHash)) {\\n return;\\n }\\n\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\"));\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmCanonicalTransactionChain.verifyTransaction(\\n _transaction,\\n _txChainElement,\\n _transactionBatchHeader,\\n _transactionProof\\n ),\\n \\\"Invalid transaction inclusion proof.\\\"\\n );\\n\\n require (\\n _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index,\\n \\\"Pre-state root global index must equal to the transaction root global index.\\\"\\n );\\n\\n _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);\\n\\n emit FraudProofInitialized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n /**\\n * Finalizes the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _txHash The transaction for the state root\\n * @param _postStateRoot State root after the fraudulent transaction.\\n * @param _postStateRootBatchHeader Batch header for the provided post-state root.\\n * @param _postStateRootProof Inclusion proof for the provided post-state root.\\n */\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, _txHash)\\n {\\n iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n require(\\n transitioner.isComplete() == true,\\n \\\"State transition process must be completed prior to finalization.\\\"\\n );\\n\\n require (\\n _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,\\n \\\"Post-state root global index must equal to the pre state root global index plus one.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _postStateRoot,\\n _postStateRootBatchHeader,\\n _postStateRootProof\\n ),\\n \\\"Invalid post-state root inclusion proof.\\\"\\n );\\n\\n // If the post state root did not match, then there was fraud and we should delete the batch\\n require(\\n _postStateRoot != transitioner.getPostStateRoot(),\\n \\\"State transition has not been proven fraudulent.\\\"\\n );\\n \\n _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);\\n\\n // TEMPORARY: Remove the transitioner; for minnet.\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000);\\n\\n emit FraudProofFinalized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n\\n /************************************\\n * Internal Functions: Verification *\\n ************************************/\\n\\n /**\\n * Checks whether a transitioner already exists for a given pre-state root.\\n * @param _preStateRoot Pre-state root to check.\\n * @return _exists Whether or not we already have a transitioner for the root.\\n */\\n function _hasStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n internal\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return address(getStateTransitioner(_preStateRoot, _txHash)) != address(0);\\n }\\n\\n /**\\n * Deploys a new state transitioner.\\n * @param _preStateRoot Pre-state root to initialize the transitioner with.\\n * @param _txHash Hash of the transaction this transitioner will execute.\\n * @param _stateTransitionIndex Index of the transaction in the chain.\\n */\\n function _deployTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n uint256 _stateTransitionIndex\\n )\\n internal\\n {\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitionerFactory(\\n resolve(\\\"OVM_StateTransitionerFactory\\\")\\n ).create(\\n address(libAddressManager),\\n _stateTransitionIndex,\\n _preStateRoot,\\n _txHash\\n );\\n }\\n\\n /**\\n * Removes a state transition from the state commitment chain.\\n * @param _postStateRootBatchHeader Header for the post-state root.\\n * @param _preStateRoot Pre-state root hash.\\n */\\n function _cancelStateTransition(\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n bytes32 _preStateRoot\\n )\\n internal\\n {\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n // Delete the state batch.\\n ovmStateCommitmentChain.deleteStateBatch(\\n _postStateRootBatchHeader\\n );\\n\\n // Get the timestamp and publisher for that block.\\n (uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));\\n\\n // Slash the bonds at the bond manager.\\n ovmBondManager.finalize(\\n _preStateRoot,\\n publisher,\\n timestamp\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc15adfd74295cc85f1aa3e69838f320d90bf036b31af8a75717e22033f3f3f1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitionerFactory\\n */\\ninterface iOVM_StateTransitionerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _proxyManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n external\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n );\\n}\\n\",\"keccak256\":\"0x60a0f0c104e4c0c7863268a93005762e8146d393f9cfddfdd6a2d6585c5911fc\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", diff --git a/deployments/kovan/OVM_L1CrossDomainMessenger.json b/deployments/kovan/OVM_L1CrossDomainMessenger.json new file mode 100644 index 000000000..a8b4714ee --- /dev/null +++ b/deployments/kovan/OVM_L1CrossDomainMessenger.json @@ -0,0 +1,477 @@ +{ + "address": "0xc30275BE689A1Abd45640f321D18f5D8Ded15052", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "RelayedMessage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "message", + "type": "bytes" + } + ], + "name": "SentMessage", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "messageNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_messageNonce", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "stateRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "stateRootBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "stateRootProof", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "stateTrieWitness", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "storageTrieWitness", + "type": "bytes" + } + ], + "internalType": "struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof", + "name": "_proof", + "type": "tuple" + } + ], + "name": "relayMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "relayedMessages", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_messageNonce", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "_gasLimit", + "type": "uint32" + } + ], + "name": "replayMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "_gasLimit", + "type": "uint32" + } + ], + "name": "sendMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "sentMessages", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "successfulMessages", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "xDomainMessageSender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x987c4f8715b887d9129b8ad41c33a50f1e346e4d29d829e1a65be1158952f8cb", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0xc30275BE689A1Abd45640f321D18f5D8Ded15052", + "transactionIndex": 3, + "gasUsed": "2162484", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6fa6b9386a73f5d9b4217d446811e088987aec015ea34492ae680a074fd95084", + "transactionHash": "0x987c4f8715b887d9129b8ad41c33a50f1e346e4d29d829e1a65be1158952f8cb", + "logs": [], + "blockNumber": 23637126, + "cumulativeGasUsed": "2390808", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"RelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SentMessage\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_messageNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"stateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"stateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"stateTrieWitness\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"storageTrieWitness\",\"type\":\"bytes\"}],\"internalType\":\"struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_messageNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\"}],\"name\":\"replayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"sentMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted via this contract's replay function. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))\":{\"params\":{\"_message\":\"Message to send to the target.\",\"_messageNonce\":\"Nonce for the provided message.\",\"_proof\":\"Inclusion proof for the given message.\",\"_sender\":\"Message sender address.\",\"_target\":\"Target contract address.\"}},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_messageNonce\":\"Nonce for the provided message.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Pass a default zero address to the address resolver. This will be updated when initialized.\"},\"relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))\":{\"notice\":\"Relays a cross domain message to a contract.\"},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"notice\":\"Replays a cross domain message to the target messenger.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/Abs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_ReentrancyGuard } from \\\"../../../libraries/utils/Lib_ReentrancyGuard.sol\\\";\\n\\n/**\\n * @title Abs_BaseCrossDomainMessenger\\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common functionality used in the\\n * L1 and L2 Cross Domain Messengers. It can also serve as a template for developers wishing to implement a custom bridge \\n * contract to suit their needs.\\n *\\n * Compiler used: defined by child contract\\n * Runtime target: defined by child contract\\n */\\nabstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger, Lib_ReentrancyGuard {\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public relayedMessages;\\n mapping (bytes32 => bool) public successfulMessages;\\n mapping (bytes32 => bool) public sentMessages;\\n uint256 public messageNonce;\\n address override public xDomainMessageSender;\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n constructor() Lib_ReentrancyGuard() internal {}\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes memory _message,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n messageNonce\\n );\\n\\n messageNonce += 1;\\n sentMessages[keccak256(xDomainCalldata)] = true;\\n\\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\\n emit SentMessage(xDomainCalldata);\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Generates the correct cross domain calldata for a message.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @return ABI encoded cross domain calldata.\\n */\\n function _getXDomainCalldata(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"relayMessage(address,address,bytes,uint256)\\\",\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n }\\n\\n /**\\n * Sends a cross domain message.\\n * @param _message Message to send.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function _sendXDomainMessage(\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n virtual\\n internal\\n {\\n revert(\\\"Implement me in child contracts!\\\");\\n }\\n}\\n\",\"keccak256\":\"0xe43b0d2d0b52d565871388e859a719ac5f80cd8c15e35fa6770019100942b83a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_ReentrancyGuard } from \\\"../../../libraries/utils/Lib_ReentrancyGuard.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_BaseCrossDomainMessenger } from \\\"./Abs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. \\n * In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted \\n * via this contract's replay function. \\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * Pass a default zero address to the address resolver. This will be updated when initialized.\\n */\\n constructor()\\n public\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n {\\n require(address(libAddressManager) == address(0), \\\"L1CrossDomainMessenger already intialized.\\\");\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may successfully call a method.\\n */\\n modifier onlyRelayer() {\\n address relayer = resolve(\\\"OVM_L2MessageRelayer\\\");\\n if (relayer != address(0)) {\\n require(\\n msg.sender == relayer,\\n \\\"Only OVM_L2MessageRelayer can relay L2-to-L1 messages.\\\"\\n );\\n }\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @inheritdoc iOVM_L1CrossDomainMessenger\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n )\\n override\\n public\\n nonReentrant\\n onlyRelayer()\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n\\n require(\\n _verifyXDomainMessage(\\n xDomainCalldata,\\n _proof\\n ) == true,\\n \\\"Provided message could not be verified.\\\"\\n );\\n\\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\\n\\n require(\\n successfulMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has already been received.\\\"\\n );\\n\\n xDomainMessageSender = _sender;\\n (bool success, ) = _target.call(_message);\\n\\n // Mark the message as received if the call was successful. Ensures that a message can be\\n // relayed multiple times in the case that the call reverted.\\n if (success == true) {\\n successfulMessages[xDomainCalldataHash] = true;\\n emit RelayedMessage(xDomainCalldataHash);\\n }\\n\\n // Store an identifier that can be used to prove that the given message was relayed by some\\n // user. Gives us an easy way to pay relayers for their work.\\n bytes32 relayId = keccak256(\\n abi.encodePacked(\\n xDomainCalldata,\\n msg.sender,\\n block.number\\n )\\n );\\n relayedMessages[relayId] = true;\\n }\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @inheritdoc iOVM_L1CrossDomainMessenger\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n\\n require(\\n sentMessages[keccak256(xDomainCalldata)] == true,\\n \\\"Provided message has not already been sent.\\\"\\n );\\n\\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Verifies that the given message is valid.\\n * @param _xDomainCalldata Calldata to verify.\\n * @param _proof Inclusion proof for the message.\\n * @return Whether or not the provided message is valid.\\n */\\n function _verifyXDomainMessage(\\n bytes memory _xDomainCalldata,\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n return (\\n _verifyStateRootProof(_proof)\\n && _verifyStorageProof(_xDomainCalldata, _proof)\\n );\\n }\\n\\n /**\\n * Verifies that the state root within an inclusion proof is valid.\\n * @param _proof Message inclusion proof.\\n * @return Whether or not the provided proof is valid.\\n */\\n function _verifyStateRootProof(\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n\\n return (\\n ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) == false\\n && ovmStateCommitmentChain.verifyStateCommitment(\\n _proof.stateRoot,\\n _proof.stateRootBatchHeader,\\n _proof.stateRootProof\\n )\\n );\\n }\\n\\n /**\\n * Verifies that the storage proof within an inclusion proof is valid.\\n * @param _xDomainCalldata Encoded message calldata.\\n * @param _proof Message inclusion proof.\\n * @return Whether or not the provided proof is valid.\\n */\\n function _verifyStorageProof(\\n bytes memory _xDomainCalldata,\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 storageKey = keccak256(\\n abi.encodePacked(\\n keccak256(\\n abi.encodePacked(\\n _xDomainCalldata,\\n resolve(\\\"OVM_L2CrossDomainMessenger\\\")\\n )\\n ),\\n uint256(0)\\n )\\n );\\n\\n (\\n bool exists,\\n bytes memory encodedMessagePassingAccount\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(0x4200000000000000000000000000000000000000),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing precompile has not been initialized or invalid proof provided.\\\"\\n );\\n\\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\\n encodedMessagePassingAccount\\n );\\n\\n return Lib_SecureMerkleTrie.verifyInclusionProof(\\n abi.encodePacked(storageKey),\\n abi.encodePacked(uint8(1)),\\n _proof.storageTrieWitness,\\n account.storageRoot\\n );\\n }\\n\\n /**\\n * Sends a cross domain message.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n override\\n internal\\n {\\n iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\")).enqueue(\\n resolve(\\\"OVM_L2CrossDomainMessenger\\\"),\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2672850c45003fba9b64b6b4adedec848b4540a7e87c00785fbb3f6d03c7dcbd\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iAbs_BaseCrossDomainMessenger\\n */\\ninterface iAbs_BaseCrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xc2bd6b373daae2ede34281f4be5938d02b9d1cfb056b40d65ff70b7f16ce3c86\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"./iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n struct L2MessageInclusionProof {\\n bytes32 stateRoot;\\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\\n bytes stateTrieWitness;\\n bytes storageTrieWitness;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _proof Inclusion proof for the given message.\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) external;\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _sender Original sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xdcd239d0b215e400674d78e8db4ac12ba18efc34fa78e24c2ff867f61062dba2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\n\\n/**\\n * @title Lib_MerkleTrie\\n */\\nlibrary Lib_MerkleTrie {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum NodeType {\\n BranchNode,\\n ExtensionNode,\\n LeafNode\\n }\\n\\n struct TrieNode {\\n bytes encoded;\\n Lib_RLPReader.RLPItem[] decoded;\\n }\\n\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n // TREE_RADIX determines the number of elements per branch node.\\n uint256 constant TREE_RADIX = 16;\\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\\n\\n // Prefixes are prepended to the `path` within a leaf or extension node and\\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\\n // determined by the number of nibbles within the unprefixed `path`. If the\\n // number of nibbles if even, we need to insert an extra padding nibble so\\n // the resulting prefixed `path` has an even number of nibbles.\\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\\n uint8 constant PREFIX_EXTENSION_ODD = 1;\\n uint8 constant PREFIX_LEAF_EVEN = 2;\\n uint8 constant PREFIX_LEAF_ODD = 3;\\n\\n // Just a utility constant. RLP represents `NULL` as 0x80.\\n bytes1 constant RLP_NULL = bytes1(0x80);\\n bytes constant RLP_NULL_BYTES = hex'80';\\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n bytes memory value\\n ) = get(_key, _proof, _root);\\n\\n return (\\n exists && Lib_BytesUtils.equal(_value, value)\\n );\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n ) = get(_key, _proof, _root);\\n\\n return exists == false;\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n // Special case when inserting the very first node.\\n if (_root == KECCAK256_RLP_NULL_BYTES) {\\n return getSingleNodeRootHash(_key, _value);\\n }\\n\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\\n\\n return _getUpdatedTrieRoot(newPath, _key);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\\n\\n bool exists = keyRemainder.length == 0;\\n\\n require(\\n exists || isFinalNode,\\n \\\"Provided proof is invalid.\\\"\\n );\\n\\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\\n\\n return (\\n exists,\\n value\\n );\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n return keccak256(_makeLeafNode(\\n Lib_BytesUtils.toNibbles(_key),\\n _value\\n ).encoded);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * @notice Walks through a proof using a provided key.\\n * @param _proof Inclusion proof to walk through.\\n * @param _key Key to use for the walk.\\n * @param _root Known root of the trie.\\n * @return _pathLength Length of the final path\\n * @return _keyRemainder Portion of the key remaining after the walk.\\n * @return _isFinalNode Whether or not we've hit a dead end.\\n */\\n function _walkNodePath(\\n TrieNode[] memory _proof,\\n bytes memory _key,\\n bytes32 _root\\n )\\n private\\n pure\\n returns (\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bool _isFinalNode\\n )\\n {\\n uint256 pathLength = 0;\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n bytes32 currentNodeID = _root;\\n uint256 currentKeyIndex = 0;\\n uint256 currentKeyIncrement = 0;\\n TrieNode memory currentNode;\\n\\n // Proof is top-down, so we start at the first element (root).\\n for (uint256 i = 0; i < _proof.length; i++) {\\n currentNode = _proof[i];\\n currentKeyIndex += currentKeyIncrement;\\n\\n // Keep track of the proof elements we actually need.\\n // It's expensive to resize arrays, so this simply reduces gas costs.\\n pathLength += 1;\\n\\n if (currentKeyIndex == 0) {\\n // First proof element is always the root node.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid root hash\\\"\\n );\\n } else if (currentNode.encoded.length >= 32) {\\n // Nodes 32 bytes or larger are hashed inside branch nodes.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid large internal hash\\\"\\n );\\n } else {\\n // Nodes smaller than 31 bytes aren't hashed.\\n require(\\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\\n \\\"Invalid internal node hash\\\"\\n );\\n }\\n\\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\\n if (currentKeyIndex == key.length) {\\n // We've hit the end of the key, meaning the value should be within this branch node.\\n break;\\n } else {\\n // We're not at the end of the key yet.\\n // Figure out what the next node ID should be and continue.\\n uint8 branchKey = uint8(key[currentKeyIndex]);\\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\\n currentNodeID = _getNodeID(nextNode);\\n currentKeyIncrement = 1;\\n continue;\\n }\\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(currentNode);\\n uint8 prefix = uint8(path[0]);\\n uint8 offset = 2 - prefix % 2;\\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n if (\\n pathRemainder.length == sharedNibbleLength &&\\n keyRemainder.length == sharedNibbleLength\\n ) {\\n // The key within this leaf matches our key exactly.\\n // Increment the key index to reflect that we have no remainder.\\n currentKeyIndex += sharedNibbleLength;\\n }\\n\\n // We've hit a leaf node, so our next node should be NULL.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n if (sharedNibbleLength == 0) {\\n // Our extension node doesn't share any part of our key.\\n // We've hit the end of this path, updates will need to modify this extension.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else {\\n // Our extension shares some nibbles.\\n // Carry on to the next node.\\n currentNodeID = _getNodeID(currentNode.decoded[1]);\\n currentKeyIncrement = sharedNibbleLength;\\n continue;\\n }\\n } else {\\n revert(\\\"Received a node with an unknown prefix\\\");\\n }\\n } else {\\n revert(\\\"Received an unparseable node.\\\");\\n }\\n }\\n\\n // If our node ID is NULL, then we're at a dead end.\\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\\n }\\n\\n /**\\n * @notice Creates new nodes to support a k/v pair insertion into a given\\n * Merkle trie path.\\n * @param _path Path to the node nearest the k/v pair.\\n * @param _pathLength Length of the path. Necessary because the provided\\n * path may include additional nodes (e.g., it comes directly from a proof)\\n * and we can't resize in-memory arrays without costly duplication.\\n * @param _keyRemainder Portion of the initial key that must be inserted\\n * into the trie.\\n * @param _value Value to insert at the given key.\\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\\n */\\n function _getNewPath(\\n TrieNode[] memory _path,\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _newPath\\n )\\n {\\n bytes memory keyRemainder = _keyRemainder;\\n\\n // Most of our logic depends on the status of the last node in the path.\\n TrieNode memory lastNode = _path[_pathLength - 1];\\n NodeType lastNodeType = _getNodeType(lastNode);\\n\\n // Create an array for newly created nodes.\\n // We need up to three new nodes, depending on the contents of the last node.\\n // Since array resizing is expensive, we'll keep track of the size manually.\\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\\n TrieNode[] memory newNodes = new TrieNode[](3);\\n uint256 totalNewNodes = 0;\\n\\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\\n // We've found a leaf node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\\n totalNewNodes += 1;\\n } else if (lastNodeType == NodeType.BranchNode) {\\n if (keyRemainder.length == 0) {\\n // We've found a branch node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\\n totalNewNodes += 1;\\n } else {\\n // We've found a branch node, but it doesn't contain our key.\\n // Reinsert the old branch for now.\\n newNodes[totalNewNodes] = lastNode;\\n totalNewNodes += 1;\\n // Create a new leaf node, slicing our remainder since the first byte points\\n // to our branch node.\\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\\n totalNewNodes += 1;\\n }\\n } else {\\n // Our last node is either an extension node or a leaf node with a different key.\\n bytes memory lastNodeKey = _getNodeKey(lastNode);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\\n\\n if (sharedNibbleLength != 0) {\\n // We've got some shared nibbles between the last node and our key remainder.\\n // We'll need to insert an extension node that covers these shared nibbles.\\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\\n totalNewNodes += 1;\\n\\n // Cut down the keys since we've just covered these shared nibbles.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\\n }\\n\\n // Create an empty branch to fill in.\\n TrieNode memory newBranch = _makeEmptyBranchNode();\\n\\n if (lastNodeKey.length == 0) {\\n // Key remainder was larger than the key for our last node.\\n // The value within our last node is therefore going to be shifted into\\n // a branch value slot.\\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\\n } else {\\n // Last node key was larger than the key remainder.\\n // We're going to modify some index of our branch.\\n uint8 branchKey = uint8(lastNodeKey[0]);\\n // Move on to the next nibble.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\\n\\n if (lastNodeType == NodeType.LeafNode) {\\n // We're dealing with a leaf node.\\n // We'll modify the key and insert the old leaf node into the branch index.\\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else if (lastNodeKey.length != 0) {\\n // We're dealing with a shrinking extension node.\\n // We need to modify the node to decrease the size of the key.\\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else {\\n // We're dealing with an unnecessary extension node.\\n // We're going to delete the node entirely.\\n // Simply insert its current value into the branch index.\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\\n }\\n }\\n\\n if (keyRemainder.length == 0) {\\n // We've got nothing left in the key remainder.\\n // Simply insert the value into the branch value slot.\\n newBranch = _editBranchValue(newBranch, _value);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n } else {\\n // We've got some key remainder to work with.\\n // We'll be inserting a leaf node into the trie.\\n // First, move on to the next nibble.\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n // Push a new leaf node for our k/v pair.\\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\\n totalNewNodes += 1;\\n }\\n }\\n\\n // Finally, join the old path with our newly created nodes.\\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\\n }\\n\\n /**\\n * @notice Computes the trie root from a given path.\\n * @param _nodes Path to some k/v pair.\\n * @param _key Key for the k/v pair.\\n * @return _updatedRoot Root hash for the updated trie.\\n */\\n function _getUpdatedTrieRoot(\\n TrieNode[] memory _nodes,\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n // Some variables to keep track of during iteration.\\n TrieNode memory currentNode;\\n NodeType currentNodeType;\\n bytes memory previousNodeHash;\\n\\n // Run through the path backwards to rebuild our root hash.\\n for (uint256 i = _nodes.length; i > 0; i--) {\\n // Pick out the current node.\\n currentNode = _nodes[i - 1];\\n currentNodeType = _getNodeType(currentNode);\\n\\n if (currentNodeType == NodeType.LeafNode) {\\n // Leaf nodes are already correctly encoded.\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n } else if (currentNodeType == NodeType.ExtensionNode) {\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\\n }\\n } else if (currentNodeType == NodeType.BranchNode) {\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n uint8 branchKey = uint8(key[key.length - 1]);\\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\\n }\\n }\\n\\n // Compute the node hash for the next iteration.\\n previousNodeHash = _getNodeHash(currentNode.encoded);\\n }\\n\\n // Current node should be the root at this point.\\n // Simply return the hash of its encoding.\\n return keccak256(currentNode.encoded);\\n }\\n\\n /**\\n * @notice Parses an RLP-encoded proof into something more useful.\\n * @param _proof RLP-encoded proof to parse.\\n * @return _parsed Proof parsed into easily accessible structs.\\n */\\n function _parseProof(\\n bytes memory _proof\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _parsed\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\\n TrieNode[] memory proof = new TrieNode[](nodes.length);\\n\\n for (uint256 i = 0; i < nodes.length; i++) {\\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\\n proof[i] = TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n return proof;\\n }\\n\\n /**\\n * @notice Picks out the ID for a node. Node ID is referred to as the\\n * \\\"hash\\\" within the specification, but nodes < 32 bytes are not actually\\n * hashed.\\n * @param _node Node to pull an ID for.\\n * @return _nodeID ID for the node, depending on the size of its contents.\\n */\\n function _getNodeID(\\n Lib_RLPReader.RLPItem memory _node\\n )\\n private\\n pure\\n returns (\\n bytes32 _nodeID\\n )\\n {\\n bytes memory nodeID;\\n\\n if (_node.length < 32) {\\n // Nodes smaller than 32 bytes are RLP encoded.\\n nodeID = Lib_RLPReader.readRawBytes(_node);\\n } else {\\n // Nodes 32 bytes or larger are hashed.\\n nodeID = Lib_RLPReader.readBytes(_node);\\n }\\n\\n return Lib_BytesUtils.toBytes32(nodeID);\\n }\\n\\n /**\\n * @notice Gets the path for a leaf or extension node.\\n * @param _node Node to get a path for.\\n * @return _path Node path, converted to an array of nibbles.\\n */\\n function _getNodePath(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _path\\n )\\n {\\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\\n }\\n\\n /**\\n * @notice Gets the key for a leaf or extension node. Keys are essentially\\n * just paths without any prefix.\\n * @param _node Node to get a key for.\\n * @return _key Node key, converted to an array of nibbles.\\n */\\n function _getNodeKey(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _key\\n )\\n {\\n return _removeHexPrefix(_getNodePath(_node));\\n }\\n\\n /**\\n * @notice Gets the path for a node.\\n * @param _node Node to get a value for.\\n * @return _value Node value, as hex bytes.\\n */\\n function _getNodeValue(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _value\\n )\\n {\\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\\n }\\n\\n /**\\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\\n * are not hashed, all others are keccak256 hashed.\\n * @param _encoded Encoded node to hash.\\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\\n */\\n function _getNodeHash(\\n bytes memory _encoded\\n )\\n private\\n pure\\n returns (\\n bytes memory _hash\\n )\\n {\\n if (_encoded.length < 32) {\\n return _encoded;\\n } else {\\n return abi.encodePacked(keccak256(_encoded));\\n }\\n }\\n\\n /**\\n * @notice Determines the type for a given node.\\n * @param _node Node to determine a type for.\\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\\n */\\n function _getNodeType(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n NodeType _type\\n )\\n {\\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\\n return NodeType.BranchNode;\\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(_node);\\n uint8 prefix = uint8(path[0]);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n return NodeType.LeafNode;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n return NodeType.ExtensionNode;\\n }\\n }\\n\\n revert(\\\"Invalid node type\\\");\\n }\\n\\n /**\\n * @notice Utility; determines the number of nibbles shared between two\\n * nibble arrays.\\n * @param _a First nibble array.\\n * @param _b Second nibble array.\\n * @return _shared Number of shared nibbles.\\n */\\n function _getSharedNibbleLength(\\n bytes memory _a,\\n bytes memory _b\\n )\\n private\\n pure\\n returns (\\n uint256 _shared\\n )\\n {\\n uint256 i = 0;\\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\\n i++;\\n }\\n return i;\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-encoded node into our nice struct.\\n * @param _raw RLP-encoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n bytes[] memory _raw\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\\n\\n return TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-decoded node into our nice struct.\\n * @param _items RLP-decoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n Lib_RLPReader.RLPItem[] memory _items\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](_items.length);\\n for (uint256 i = 0; i < _items.length; i++) {\\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new extension node.\\n * @param _key Key for the extension node, unprefixed.\\n * @param _value Value for the extension node.\\n * @return _node New extension node with the given k/v pair.\\n */\\n function _makeExtensionNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new leaf node.\\n * @dev This function is essentially identical to `_makeExtensionNode`.\\n * Although we could route both to a single method with a flag, it's\\n * more gas efficient to keep them separate and duplicate the logic.\\n * @param _key Key for the leaf node, unprefixed.\\n * @param _value Value for the leaf node.\\n * @return _node New leaf node with the given k/v pair.\\n */\\n function _makeLeafNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, true);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates an empty branch node.\\n * @return _node Empty branch node as a TrieNode struct.\\n */\\n function _makeEmptyBranchNode()\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\\n for (uint256 i = 0; i < raw.length; i++) {\\n raw[i] = RLP_NULL_BYTES;\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Modifies the value slot for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _value Value to insert into the branch.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchValue(\\n TrieNode memory _branch,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Modifies a slot at an index for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _index Slot index to modify.\\n * @param _value Value to insert into the slot.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchIndex(\\n TrieNode memory _branch,\\n uint8 _index,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Utility; adds a prefix to a key.\\n * @param _key Key to prefix.\\n * @param _isLeaf Whether or not the key belongs to a leaf.\\n * @return _prefixedKey Prefixed key.\\n */\\n function _addHexPrefix(\\n bytes memory _key,\\n bool _isLeaf\\n )\\n private\\n pure\\n returns (\\n bytes memory _prefixedKey\\n )\\n {\\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\\n uint8 offset = uint8(_key.length % 2);\\n bytes memory prefixed = new bytes(2 - offset);\\n prefixed[0] = bytes1(prefix + offset);\\n return Lib_BytesUtils.concat(prefixed, _key);\\n }\\n\\n /**\\n * @notice Utility; removes a prefix from a path.\\n * @param _path Path to remove the prefix from.\\n * @return _unprefixedKey Unprefixed key.\\n */\\n function _removeHexPrefix(\\n bytes memory _path\\n )\\n private\\n pure\\n returns (\\n bytes memory _unprefixedKey\\n )\\n {\\n if (uint8(_path[0]) % 2 == 0) {\\n return Lib_BytesUtils.slice(_path, 2);\\n } else {\\n return Lib_BytesUtils.slice(_path, 1);\\n }\\n }\\n\\n /**\\n * @notice Utility; combines two node arrays. Array lengths are required\\n * because the actual lengths may be longer than the filled lengths.\\n * Array resizing is extremely costly and should be avoided.\\n * @param _a First array to join.\\n * @param _aLength Length of the first array.\\n * @param _b Second array to join.\\n * @param _bLength Length of the second array.\\n * @return _joined Combined node array.\\n */\\n function _joinNodeArrays(\\n TrieNode[] memory _a,\\n uint256 _aLength,\\n TrieNode[] memory _b,\\n uint256 _bLength\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _joined\\n )\\n {\\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\\n\\n // Copy elements from the first array.\\n for (uint256 i = 0; i < _aLength; i++) {\\n ret[i] = _a[i];\\n }\\n\\n // Copy elements from the second array.\\n for (uint256 i = 0; i < _bLength; i++) {\\n ret[i + _aLength] = _b[i];\\n }\\n\\n return ret;\\n }\\n}\\n\",\"keccak256\":\"0x86fecc050ffc298ac364d118e65ce8ef2418749cbef1ad0d4dce2ca8a0d15ace\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_MerkleTrie } from \\\"./Lib_MerkleTrie.sol\\\";\\n\\n/**\\n * @title Lib_SecureMerkleTrie\\n */\\nlibrary Lib_SecureMerkleTrie {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.get(key, _proof, _root);\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Computes the secure counterpart to a key.\\n * @param _key Key to get a secure key from.\\n * @return _secureKey Secure version of the key.\\n */\\n function _getSecureKey(\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes memory _secureKey\\n )\\n {\\n return abi.encodePacked(keccak256(_key));\\n }\\n}\",\"keccak256\":\"0x79355346f74bb1eb9eeb733cb5d9677d50115c4f390307cbf608fe071a1ada0c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract Lib_ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor () internal {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xc304e479db6914188c19c56ea871f7f8c541238fdbf088fbf51c99eecef7347f\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506001600055600680546001600160a01b03191690556125c6806100356000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c806382e3702d1161006657806382e3702d1461011c578063b1b1b2091461012f578063c4d66de814610142578063d7fd19dd14610155578063ecc70428146101685761009e565b806321d800ec146100a35780633dbb202b146100cc578063461a4478146100e15780636e296e4514610101578063706ceab614610109575b600080fd5b6100b66100b136600461203d565b61017d565b6040516100c39190612253565b60405180910390f35b6100df6100da366004611fc1565b610192565b005b6100f46100ef366004612055565b610221565b6040516100c391906121db565b6100f46102fd565b6100df610117366004611f4a565b61030c565b6100b661012a36600461203d565b61037c565b6100b661013d36600461203d565b610391565b6100df610150366004611e01565b6103a6565b6100df610163366004611e1b565b6103f1565b61017061065f565b6040516100c39190612124565b60016020526000908152604090205460ff1681565b60006101a2843385600454610665565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506101e48163ffffffff84166106b2565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268160405161021391906122d5565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d60208110156102f357600080fd5b505190505b919050565b6005546001600160a01b031681565b600061031a86868686610665565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103645760405162461bcd60e51b815260040161035b90612333565b60405180910390fd5b610374818363ffffffff166106b2565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156103cf5760405162461bcd60e51b815260040161035b9061241b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610449576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015261048490610221565b90506001600160a01b038116156104bd57336001600160a01b038216146104bd5760405162461bcd60e51b815260040161035b9061237e565b60006104cb87878787610665565b90506104d7818461078a565b15156001146104f85760405162461bcd60e51b815260040161035b906123d4565b80516020808301919091206000818152600290925260409091205460ff16156105335760405162461bcd60e51b815260040161035b906122e8565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a169061056790899061213b565b6000604051808303816000865af19150503d80600081146105a4576040519150601f19603f3d011682016040523d82523d6000602084013e6105a9565b606091505b50909150506001811515141561060b5760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610602908490612124565b60405180910390a15b600083334360405160200161062293929190612189565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161067e94939291906121ef565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b6106f06040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610221565b6001600160a01b0316636fee07e061073c6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b83856040518463ffffffff1660e01b815260040161075c9392919061222c565b600060405180830381600087803b15801561077657600080fd5b505af1158015610374573d6000803e3d6000fd5b6000610795826107af565b80156107a657506107a6838361090c565b90505b92915050565b6000806107f06040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610221565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd91610822916004016124d9565b60206040518083038186803b15801561083a57600080fd5b505afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610872919061201d565b1580156109055750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee57936108b593919290919060040161225e565b60206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610905919061201d565b9392505050565b6000808361094e6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b60405160200161095f929190612157565b60405160208183030381529060405280519060200120600060405160200161098892919061212d565b6040516020818303038152906040528051906020012090506000806109d7602160991b6040516020016109bb919061210c565b60408051601f1981840301815291905260608701518751610a69565b90925090506001821515146109fe5760405162461bcd60e51b815260040161035b90612465565b6000610a0982610a92565b9050610a5e84604051602001610a1f9190612124565b6040516020818303038152906040526001604051602001610a4091906121c3565b60405160208183030381529060405288608001518460400151610b24565b979650505050505050565b600060606000610a7886610b48565b9050610a85818686610b78565b9250925050935093915050565b610a9a611bb7565b6000610aa583610c4b565b90506040518060800160405280610acf83600081518110610ac257fe5b6020026020010151610c5e565b8152602001610ae483600181518110610ac257fe5b8152602001610b0683600281518110610af957fe5b6020026020010151610c65565b8152602001610b1b83600381518110610af957fe5b90529392505050565b600080610b3086610b48565b9050610b3e81868686610d5e565b9695505050505050565b60608180519060200120604051602001610b629190612124565b6040516020818303038152906040529050919050565b600060606000610b8785610d84565b90506000806000610b99848a89610e5b565b81519295509093509150158080610bad5750815b610bfe576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610c1a5760405180602001604052806000815250610c39565b610c39866001870381518110610c2c57fe5b60200260200101516111fe565b919b919a509098505050505050505050565b60606107a9610c598361121a565b61123f565b60006107a9825b6000602182600001511115610cc1576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610ccf856113b5565b919450925090506000816001811115610ce457fe5b14610d36576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610b3e5760208490036101000a90049695505050505050565b6000806000610d6e878686610b78565b91509150818015610a5e5750610a5e86826116de565b60606000610d9183610c4b565b90506000815167ffffffffffffffff81118015610dad57600080fd5b50604051908082528060200260200182016040528015610de757816020015b610dd4611bde565b815260200190600190039081610dcc5790505b50905060005b8251811015610e53576000610e14848381518110610e0757fe5b60200260200101516116f4565b90506040518060400160405280828152602001610e3083610c4b565b815250838381518110610e3f57fe5b602090810291909101015250600101610ded565b509392505050565b60006060818080610e6b87611783565b905085600080610e79611bde565b60005b8c518110156111d6578c8181518110610e9157fe5b6020026020010151915082840193506001870196508360001415610f0557815180516020909101208514610f00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b610fcc565b815151602011610f6c57815180516020909101208514610f00576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84610f7a8360000151611880565b14610fcc576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b6020820151516011141561103b578551841415610fe8576111d6565b6000868581518110610ff657fe5b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061101b57fe5b6020026020010151905061102e816118ac565b96506001945050506111ce565b60028260200151511415611181576000611054836118e2565b905060008160008151811061106557fe5b016020015160f81c90506001811660020360006110858460ff8416611900565b905060006110938b8a611900565b905060006110a18383611931565b905060ff8516600214806110b8575060ff85166003145b156110ea578083511480156110cd5750808251145b156110d757988901985b50600160ff1b99506111d6945050505050565b60ff851615806110fd575060ff85166001145b1561114a578061111a5750600160ff1b99506111d6945050505050565b61113b886020015160018151811061112e57fe5b60200260200101516118ac565b9a5097506111ce945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061256b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610e7c565b50600160ff1b8414866111e98786611900565b909e909d50909b509950505050505050505050565b602081015180516060916107a9916000198101908110610e0757fe5b611222611bf8565b506040805180820190915281518152602082810190820152919050565b606060008061124d846113b5565b9193509091506001905081600181111561126357fe5b146112b5576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b6112d6611bf8565b8152602001906001900390816112ce5790505090506000835b86518110156113aa57602082106113375760405162461bcd60e51b815260040180806020018281038252602a815260200180612541602a913960400191505060405180910390fd5b6000806113636040518060400160405280858c60000151038152602001858c60200151018152506113b5565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061139157fe5b60209081029190910101526001939093019201016112ef565b508152949350505050565b600080600080846000015111611412576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114375760006001600094509450945050506116d7565b60b781116114ac578551607f19820190811061149a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506116d7915050565b60bf811161159057855160b619820190811061150f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161157b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506116d7915050565b60f7811161160457855160bf1982019081106115f3576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506116d7915050565b855160f619820190811061165f576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116116c4576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506116d7915050565b9193909250565b8051602091820120825192909101919091201490565b60606000806000611704856113b5565b91945092509050600081600181111561171957fe5b1461176b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61177a85602001518484611997565b95945050505050565b60606000825160020267ffffffffffffffff811180156117a257600080fd5b506040519080825280601f01601f1916602001820160405280156117cd576020820181803683370190505b50905060005b83518110156118795760048482815181106117ea57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061181057fe5b60200101906001600160f81b031916908160001a905350601084828151811061183557fe5b016020015160f81c8161184457fe5b0660f81b82826002026001018151811061185a57fe5b60200101906001600160f81b031916908160001a9053506001016117d3565b5092915050565b6000602082511015611897575060208101516102f8565b8180602001905160208110156102f357600080fd5b600060606020836000015110156118cd576118c683611a45565b90506118d9565b6118d6836116f4565b90505b61090581611880565b60606107a96118fb8360200151600081518110610e0757fe5b611783565b6060818351036000141561192357506040805160208101909152600081526107a9565b6107a6838384865103611a50565b6000805b8084511180156119455750808351115b801561198a575082818151811061195857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061197957fe5b01602001516001600160f81b031916145b156107a657600101611935565b606060008267ffffffffffffffff811180156119b257600080fd5b506040519080825280601f01601f1916602001820160405280156119dd576020820181803683370190505b5090508051600014156119f1579050610905565b8484016020820160005b60208604811015611a1c5782518252602092830192909101906001016119fb565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606107a982611ba1565b60608182601f011015611a9b576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611ae3576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611b2f576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611b4e5760405191506000825260208201604052611b98565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611b87578051835260209283019201611b6f565b5050858452601f01601f1916604052505b50949350505050565b60606107a9826020015160008460000151611997565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611c2657fe5b611c39601f8401601f19166020016124ec565b9050828152838383011115611c4d57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102f857600080fd5b600082601f830112611c8b578081fd5b6107a683833560208501611c12565b600060a08284031215611cab578081fd5b60405160a0810167ffffffffffffffff8282108183111715611cc957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611d0657600080fd5b50611d1385828601611c7b565b6080830152505092915050565b600060408284031215611d31578081fd5b6040516040810167ffffffffffffffff8282108183111715611d4f57fe5b8160405282935084358352602091508185013581811115611d6f57600080fd5b8501601f81018713611d8057600080fd5b803582811115611d8c57fe5b8381029250611d9c8484016124ec565b8181528481019083860185850187018b1015611db757600080fd5b600095505b83861015611dda578035835260019590950194918601918601611dbc565b5080868801525050505050505092915050565b803563ffffffff811681146102f857600080fd5b600060208284031215611e12578081fd5b6107a682611c64565b600080600080600060a08688031215611e32578081fd5b611e3b86611c64565b9450611e4960208701611c64565b9350604086013567ffffffffffffffff80821115611e65578283fd5b611e7189838a01611c7b565b9450606088013593506080880135915080821115611e8d578283fd5b9087019060a0828a031215611ea0578283fd5b611eaa60a06124ec565b82358152602083013582811115611ebf578485fd5b611ecb8b828601611c9a565b602083015250604083013582811115611ee2578485fd5b611eee8b828601611d20565b604083015250606083013582811115611f05578485fd5b611f118b828601611c7b565b606083015250608083013582811115611f28578485fd5b611f348b828601611c7b565b6080830152508093505050509295509295909350565b600080600080600060a08688031215611f61578081fd5b611f6a86611c64565b9450611f7860208701611c64565b9350604086013567ffffffffffffffff811115611f93578182fd5b611f9f88828901611c7b565b93505060608601359150611fb560808701611ded565b90509295509295909350565b600080600060608486031215611fd5578283fd5b611fde84611c64565b9250602084013567ffffffffffffffff811115611ff9578283fd5b61200586828701611c7b565b92505061201460408501611ded565b90509250925092565b60006020828403121561202e578081fd5b815180151581146107a6578182fd5b60006020828403121561204e578081fd5b5035919050565b600060208284031215612066578081fd5b813567ffffffffffffffff81111561207c578182fd5b8201601f8101841361208c578182fd5b61209b84823560208401611c12565b949350505050565b600081518084526120bb816020860160208601612510565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261209b60a08501826120a3565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b6000825161214d818460208701612510565b9190910192915050565b60008351612169818460208801612510565b60609390931b6001600160601b0319169190920190815260140192915050565b6000845161219b818460208901612510565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260806040820181905260009061221b908301856120a3565b905082606083015295945050505050565b600060018060a01b03851682528360208301526060604083015261177a60608301846120a3565b901515815260200190565b6000848252602060608184015261227860608401866120cf565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156122c757845182529385019360019390930192908501906122a7565b509998505050505050505050565b6000602082526107a660208301846120a3565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b6020808252604e908201527f4d6573736167652070617373696e6720707265636f6d70696c6520686173206e60408201527f6f74206265656e20696e697469616c697a6564206f7220696e76616c6964207060608201526d3937b7b310383937bb34b232b21760911b608082015260a00190565b6000602082526107a660208301846120cf565b60405181810167ffffffffffffffff8111828210171561250857fe5b604052919050565b60005b8381101561252b578181015183820152602001612513565b8381111561253a576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220d0b28cf8f96b59527ddacc889954cf7daf7a7ed3e494dd3b8457563cdc9171c464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c806382e3702d1161006657806382e3702d1461011c578063b1b1b2091461012f578063c4d66de814610142578063d7fd19dd14610155578063ecc70428146101685761009e565b806321d800ec146100a35780633dbb202b146100cc578063461a4478146100e15780636e296e4514610101578063706ceab614610109575b600080fd5b6100b66100b136600461203d565b61017d565b6040516100c39190612253565b60405180910390f35b6100df6100da366004611fc1565b610192565b005b6100f46100ef366004612055565b610221565b6040516100c391906121db565b6100f46102fd565b6100df610117366004611f4a565b61030c565b6100b661012a36600461203d565b61037c565b6100b661013d36600461203d565b610391565b6100df610150366004611e01565b6103a6565b6100df610163366004611e1b565b6103f1565b61017061065f565b6040516100c39190612124565b60016020526000908152604090205460ff1681565b60006101a2843385600454610665565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506101e48163ffffffff84166106b2565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268160405161021391906122d5565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d60208110156102f357600080fd5b505190505b919050565b6005546001600160a01b031681565b600061031a86868686610665565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103645760405162461bcd60e51b815260040161035b90612333565b60405180910390fd5b610374818363ffffffff166106b2565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156103cf5760405162461bcd60e51b815260040161035b9061241b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610449576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015261048490610221565b90506001600160a01b038116156104bd57336001600160a01b038216146104bd5760405162461bcd60e51b815260040161035b9061237e565b60006104cb87878787610665565b90506104d7818461078a565b15156001146104f85760405162461bcd60e51b815260040161035b906123d4565b80516020808301919091206000818152600290925260409091205460ff16156105335760405162461bcd60e51b815260040161035b906122e8565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a169061056790899061213b565b6000604051808303816000865af19150503d80600081146105a4576040519150601f19603f3d011682016040523d82523d6000602084013e6105a9565b606091505b50909150506001811515141561060b5760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610602908490612124565b60405180910390a15b600083334360405160200161062293929190612189565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161067e94939291906121ef565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b6106f06040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610221565b6001600160a01b0316636fee07e061073c6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b83856040518463ffffffff1660e01b815260040161075c9392919061222c565b600060405180830381600087803b15801561077657600080fd5b505af1158015610374573d6000803e3d6000fd5b6000610795826107af565b80156107a657506107a6838361090c565b90505b92915050565b6000806107f06040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610221565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd91610822916004016124d9565b60206040518083038186803b15801561083a57600080fd5b505afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610872919061201d565b1580156109055750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee57936108b593919290919060040161225e565b60206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610905919061201d565b9392505050565b6000808361094e6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b60405160200161095f929190612157565b60405160208183030381529060405280519060200120600060405160200161098892919061212d565b6040516020818303038152906040528051906020012090506000806109d7602160991b6040516020016109bb919061210c565b60408051601f1981840301815291905260608701518751610a69565b90925090506001821515146109fe5760405162461bcd60e51b815260040161035b90612465565b6000610a0982610a92565b9050610a5e84604051602001610a1f9190612124565b6040516020818303038152906040526001604051602001610a4091906121c3565b60405160208183030381529060405288608001518460400151610b24565b979650505050505050565b600060606000610a7886610b48565b9050610a85818686610b78565b9250925050935093915050565b610a9a611bb7565b6000610aa583610c4b565b90506040518060800160405280610acf83600081518110610ac257fe5b6020026020010151610c5e565b8152602001610ae483600181518110610ac257fe5b8152602001610b0683600281518110610af957fe5b6020026020010151610c65565b8152602001610b1b83600381518110610af957fe5b90529392505050565b600080610b3086610b48565b9050610b3e81868686610d5e565b9695505050505050565b60608180519060200120604051602001610b629190612124565b6040516020818303038152906040529050919050565b600060606000610b8785610d84565b90506000806000610b99848a89610e5b565b81519295509093509150158080610bad5750815b610bfe576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610c1a5760405180602001604052806000815250610c39565b610c39866001870381518110610c2c57fe5b60200260200101516111fe565b919b919a509098505050505050505050565b60606107a9610c598361121a565b61123f565b60006107a9825b6000602182600001511115610cc1576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610ccf856113b5565b919450925090506000816001811115610ce457fe5b14610d36576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610b3e5760208490036101000a90049695505050505050565b6000806000610d6e878686610b78565b91509150818015610a5e5750610a5e86826116de565b60606000610d9183610c4b565b90506000815167ffffffffffffffff81118015610dad57600080fd5b50604051908082528060200260200182016040528015610de757816020015b610dd4611bde565b815260200190600190039081610dcc5790505b50905060005b8251811015610e53576000610e14848381518110610e0757fe5b60200260200101516116f4565b90506040518060400160405280828152602001610e3083610c4b565b815250838381518110610e3f57fe5b602090810291909101015250600101610ded565b509392505050565b60006060818080610e6b87611783565b905085600080610e79611bde565b60005b8c518110156111d6578c8181518110610e9157fe5b6020026020010151915082840193506001870196508360001415610f0557815180516020909101208514610f00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b610fcc565b815151602011610f6c57815180516020909101208514610f00576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84610f7a8360000151611880565b14610fcc576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b6020820151516011141561103b578551841415610fe8576111d6565b6000868581518110610ff657fe5b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061101b57fe5b6020026020010151905061102e816118ac565b96506001945050506111ce565b60028260200151511415611181576000611054836118e2565b905060008160008151811061106557fe5b016020015160f81c90506001811660020360006110858460ff8416611900565b905060006110938b8a611900565b905060006110a18383611931565b905060ff8516600214806110b8575060ff85166003145b156110ea578083511480156110cd5750808251145b156110d757988901985b50600160ff1b99506111d6945050505050565b60ff851615806110fd575060ff85166001145b1561114a578061111a5750600160ff1b99506111d6945050505050565b61113b886020015160018151811061112e57fe5b60200260200101516118ac565b9a5097506111ce945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061256b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610e7c565b50600160ff1b8414866111e98786611900565b909e909d50909b509950505050505050505050565b602081015180516060916107a9916000198101908110610e0757fe5b611222611bf8565b506040805180820190915281518152602082810190820152919050565b606060008061124d846113b5565b9193509091506001905081600181111561126357fe5b146112b5576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b6112d6611bf8565b8152602001906001900390816112ce5790505090506000835b86518110156113aa57602082106113375760405162461bcd60e51b815260040180806020018281038252602a815260200180612541602a913960400191505060405180910390fd5b6000806113636040518060400160405280858c60000151038152602001858c60200151018152506113b5565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061139157fe5b60209081029190910101526001939093019201016112ef565b508152949350505050565b600080600080846000015111611412576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114375760006001600094509450945050506116d7565b60b781116114ac578551607f19820190811061149a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506116d7915050565b60bf811161159057855160b619820190811061150f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161157b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506116d7915050565b60f7811161160457855160bf1982019081106115f3576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506116d7915050565b855160f619820190811061165f576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116116c4576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506116d7915050565b9193909250565b8051602091820120825192909101919091201490565b60606000806000611704856113b5565b91945092509050600081600181111561171957fe5b1461176b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61177a85602001518484611997565b95945050505050565b60606000825160020267ffffffffffffffff811180156117a257600080fd5b506040519080825280601f01601f1916602001820160405280156117cd576020820181803683370190505b50905060005b83518110156118795760048482815181106117ea57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061181057fe5b60200101906001600160f81b031916908160001a905350601084828151811061183557fe5b016020015160f81c8161184457fe5b0660f81b82826002026001018151811061185a57fe5b60200101906001600160f81b031916908160001a9053506001016117d3565b5092915050565b6000602082511015611897575060208101516102f8565b8180602001905160208110156102f357600080fd5b600060606020836000015110156118cd576118c683611a45565b90506118d9565b6118d6836116f4565b90505b61090581611880565b60606107a96118fb8360200151600081518110610e0757fe5b611783565b6060818351036000141561192357506040805160208101909152600081526107a9565b6107a6838384865103611a50565b6000805b8084511180156119455750808351115b801561198a575082818151811061195857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061197957fe5b01602001516001600160f81b031916145b156107a657600101611935565b606060008267ffffffffffffffff811180156119b257600080fd5b506040519080825280601f01601f1916602001820160405280156119dd576020820181803683370190505b5090508051600014156119f1579050610905565b8484016020820160005b60208604811015611a1c5782518252602092830192909101906001016119fb565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606107a982611ba1565b60608182601f011015611a9b576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611ae3576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611b2f576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611b4e5760405191506000825260208201604052611b98565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611b87578051835260209283019201611b6f565b5050858452601f01601f1916604052505b50949350505050565b60606107a9826020015160008460000151611997565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611c2657fe5b611c39601f8401601f19166020016124ec565b9050828152838383011115611c4d57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102f857600080fd5b600082601f830112611c8b578081fd5b6107a683833560208501611c12565b600060a08284031215611cab578081fd5b60405160a0810167ffffffffffffffff8282108183111715611cc957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611d0657600080fd5b50611d1385828601611c7b565b6080830152505092915050565b600060408284031215611d31578081fd5b6040516040810167ffffffffffffffff8282108183111715611d4f57fe5b8160405282935084358352602091508185013581811115611d6f57600080fd5b8501601f81018713611d8057600080fd5b803582811115611d8c57fe5b8381029250611d9c8484016124ec565b8181528481019083860185850187018b1015611db757600080fd5b600095505b83861015611dda578035835260019590950194918601918601611dbc565b5080868801525050505050505092915050565b803563ffffffff811681146102f857600080fd5b600060208284031215611e12578081fd5b6107a682611c64565b600080600080600060a08688031215611e32578081fd5b611e3b86611c64565b9450611e4960208701611c64565b9350604086013567ffffffffffffffff80821115611e65578283fd5b611e7189838a01611c7b565b9450606088013593506080880135915080821115611e8d578283fd5b9087019060a0828a031215611ea0578283fd5b611eaa60a06124ec565b82358152602083013582811115611ebf578485fd5b611ecb8b828601611c9a565b602083015250604083013582811115611ee2578485fd5b611eee8b828601611d20565b604083015250606083013582811115611f05578485fd5b611f118b828601611c7b565b606083015250608083013582811115611f28578485fd5b611f348b828601611c7b565b6080830152508093505050509295509295909350565b600080600080600060a08688031215611f61578081fd5b611f6a86611c64565b9450611f7860208701611c64565b9350604086013567ffffffffffffffff811115611f93578182fd5b611f9f88828901611c7b565b93505060608601359150611fb560808701611ded565b90509295509295909350565b600080600060608486031215611fd5578283fd5b611fde84611c64565b9250602084013567ffffffffffffffff811115611ff9578283fd5b61200586828701611c7b565b92505061201460408501611ded565b90509250925092565b60006020828403121561202e578081fd5b815180151581146107a6578182fd5b60006020828403121561204e578081fd5b5035919050565b600060208284031215612066578081fd5b813567ffffffffffffffff81111561207c578182fd5b8201601f8101841361208c578182fd5b61209b84823560208401611c12565b949350505050565b600081518084526120bb816020860160208601612510565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261209b60a08501826120a3565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b6000825161214d818460208701612510565b9190910192915050565b60008351612169818460208801612510565b60609390931b6001600160601b0319169190920190815260140192915050565b6000845161219b818460208901612510565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260806040820181905260009061221b908301856120a3565b905082606083015295945050505050565b600060018060a01b03851682528360208301526060604083015261177a60608301846120a3565b901515815260200190565b6000848252602060608184015261227860608401866120cf565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156122c757845182529385019360019390930192908501906122a7565b509998505050505050505050565b6000602082526107a660208301846120a3565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b6020808252604e908201527f4d6573736167652070617373696e6720707265636f6d70696c6520686173206e60408201527f6f74206265656e20696e697469616c697a6564206f7220696e76616c6964207060608201526d3937b7b310383937bb34b232b21760911b608082015260a00190565b6000602082526107a660208301846120cf565b60405181810167ffffffffffffffff8111828210171561250857fe5b604052919050565b60005b8381101561252b578181015183820152602001612513565b8381111561253a576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220d0b28cf8f96b59527ddacc889954cf7daf7a7ed3e494dd3b8457563cdc9171c464736f6c63430007060033", + "devdoc": { + "details": "The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted via this contract's replay function. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "initialize(address)": { + "params": { + "_libAddressManager": "Address of the Address Manager." + } + }, + "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { + "params": { + "_message": "Message to send to the target.", + "_messageNonce": "Nonce for the provided message.", + "_proof": "Inclusion proof for the given message.", + "_sender": "Message sender address.", + "_target": "Target contract address." + } + }, + "replayMessage(address,address,bytes,uint256,uint32)": { + "params": { + "_gasLimit": "Gas limit for the provided message.", + "_message": "Message to send to the target.", + "_messageNonce": "Nonce for the provided message.", + "_sender": "Original sender address.", + "_target": "Target contract address." + } + }, + "sendMessage(address,bytes,uint32)": { + "params": { + "_gasLimit": "Gas limit for the provided message.", + "_message": "Message to send to the target.", + "_target": "Target contract address." + } + } + }, + "title": "OVM_L1CrossDomainMessenger", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "constructor": { + "notice": "Pass a default zero address to the address resolver. This will be updated when initialized." + }, + "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { + "notice": "Relays a cross domain message to a contract." + }, + "replayMessage(address,address,bytes,uint256,uint32)": { + "notice": "Replays a cross domain message to the target messenger." + }, + "sendMessage(address,bytes,uint32)": { + "notice": "Sends a cross domain message to the target messenger." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 17540, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 681, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "relayedMessages", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 685, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "successfulMessages", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 689, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "sentMessages", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_bool)" + }, + { + "astId": 691, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "messageNonce", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 694, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "xDomainMessageSender", + "offset": 0, + "slot": "5", + "type": "t_address" + }, + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", + "label": "libAddressManager", + "offset": 0, + "slot": "6", + "type": "t_contract(Lib_AddressManager)12330" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_bool)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_L1MultiMessageRelayer.json b/deployments/kovan/OVM_L1MultiMessageRelayer.json new file mode 100644 index 000000000..9bd5aac31 --- /dev/null +++ b/deployments/kovan/OVM_L1MultiMessageRelayer.json @@ -0,0 +1,205 @@ +{ + "address": "0x41e91c4c3404D3eA4251FE58dadf7c3C3460b114", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "messageNonce", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "stateRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "batchIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "batchRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "prevTotalElements", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + } + ], + "internalType": "struct Lib_OVMCodec.ChainBatchHeader", + "name": "stateRootBatchHeader", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "siblings", + "type": "bytes32[]" + } + ], + "internalType": "struct Lib_OVMCodec.ChainInclusionProof", + "name": "stateRootProof", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "stateTrieWitness", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "storageTrieWitness", + "type": "bytes" + } + ], + "internalType": "struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof", + "name": "proof", + "type": "tuple" + } + ], + "internalType": "struct iOVM_L1MultiMessageRelayer.L2ToL1Message[]", + "name": "_messages", + "type": "tuple[]" + } + ], + "name": "batchRelayMessages", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x94daa3b8710e82d088601740fe37484c482ff52385d2b8fa823650a07ddf537f", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x41e91c4c3404D3eA4251FE58dadf7c3C3460b114", + "transactionIndex": 1, + "gasUsed": "597839", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x068df5985d56b1bccac5f8611d0d3ff7b966bb45bb2dbc807211100a750675c9", + "transactionHash": "0x94daa3b8710e82d088601740fe37484c482ff52385d2b8fa823650a07ddf537f", + "logs": [], + "blockNumber": 23637130, + "cumulativeGasUsed": "643268", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"stateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"stateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"stateTrieWitness\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"storageTrieWitness\",\"type\":\"bytes\"}],\"internalType\":\"struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"internalType\":\"struct iOVM_L1MultiMessageRelayer.L2ToL1Message[]\",\"name\":\"_messages\",\"type\":\"tuple[]\"}],\"name\":\"batchRelayMessages\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain Message Sender. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])\":{\"params\":{\"_messages\":\"An array of L2 to L1 messages\"}}},\"title\":\"OVM_L1MultiMessageRelayer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])\":{\"notice\":\"Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Contract Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n\\n/**\\n * @title OVM_L1MultiMessageRelayer\\n * @dev The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the \\n * relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain\\n * Message Sender.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1MultiMessageRelayer is iOVM_L1MultiMessageRelayer, Lib_AddressResolver {\\n\\n /***************\\n * Constructor *\\n ***************/\\n constructor(\\n address _libAddressManager\\n ) \\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyBatchRelayer() {\\n require(\\n msg.sender == resolve(\\\"OVM_L2BatchMessageRelayer\\\"),\\n \\\"OVM_L1MultiMessageRelayer: Function can only be called by the OVM_L2BatchMessageRelayer\\\"\\n );\\n _;\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @notice Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\\n * @param _messages An array of L2 to L1 messages\\n */\\n function batchRelayMessages(L2ToL1Message[] calldata _messages) \\n override\\n external\\n onlyBatchRelayer \\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\"));\\n for (uint256 i = 0; i < _messages.length; i++) {\\n L2ToL1Message memory message = _messages[i];\\n messenger.relayMessage(\\n message.target,\\n message.sender,\\n message.message,\\n message.messageNonce,\\n message.proof\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x83fdf5867642a7ecb73a0ef082c966a9d8c348eecdc353f48640476f8508cdd5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iAbs_BaseCrossDomainMessenger\\n */\\ninterface iAbs_BaseCrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xc2bd6b373daae2ede34281f4be5938d02b9d1cfb056b40d65ff70b7f16ce3c86\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"./iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n struct L2MessageInclusionProof {\\n bytes32 stateRoot;\\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\\n bytes stateTrieWitness;\\n bytes storageTrieWitness;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _proof Inclusion proof for the given message.\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) external;\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _sender Original sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xdcd239d0b215e400674d78e8db4ac12ba18efc34fa78e24c2ff867f61062dba2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\ninterface iOVM_L1MultiMessageRelayer {\\n\\n struct L2ToL1Message {\\n address target;\\n address sender;\\n bytes message;\\n uint256 messageNonce;\\n iOVM_L1CrossDomainMessenger.L2MessageInclusionProof proof;\\n }\\n\\n function batchRelayMessages(L2ToL1Message[] calldata _messages) external; \\n}\\n\",\"keccak256\":\"0x7135d8578f07e7cc04930e742d0e9a787345bf8ddbfc17fcad94db1d43a299a1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610a00380380610a0083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b61096f806100916000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806316e9cd9b1461003b578063461a447814610050575b600080fd5b61004e61004936600461055b565b610079565b005b61006361005e3660046105ca565b6101d7565b60405161007091906106b9565b60405180910390f35b6100b76040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101d7565b6001600160a01b0316336001600160a01b0316146100f05760405162461bcd60e51b81526004016100e7906107b5565b60405180910390fd5b6000610113604051806060016040528060218152602001610919602191396101d7565b905060005b828110156101d157600084848381811061012e57fe5b90506020028101906101409190610838565b6101499061087b565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd95610192959094909392916004016106cd565b600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505060019093019250610118915050565b50505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561023757818101518382015260200161021f565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561028157600080fd5b505afa158015610295573d6000803e3d6000fd5b505050506040513d60208110156102ab57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102c957fe5b6102dc601f8401601f1916602001610857565b90508281528383830111156102f057600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102b057600080fd5b600082601f83011261032e578081fd5b61033d838335602085016102b5565b9392505050565b600060a08284031215610355578081fd5b60405160a0810167ffffffffffffffff828210818311171561037357fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103b057600080fd5b506103bd8582860161031e565b6080830152505092915050565b6000604082840312156103db578081fd5b6040516040810167ffffffffffffffff82821081831117156103f957fe5b816040528293508435835260209150818501358181111561041957600080fd5b8501601f8101871361042a57600080fd5b80358281111561043657fe5b8381029250610446848401610857565b8181528481019083860185850187018b101561046157600080fd5b600095505b83861015610484578035835260019590950194918601918601610466565b5080868801525050505050505092915050565b600060a082840312156104a8578081fd5b6104b260a0610857565b905081358152602082013567ffffffffffffffff808211156104d357600080fd5b6104df85838601610344565b602084015260408401359150808211156104f857600080fd5b610504858386016103ca565b6040840152606084013591508082111561051d57600080fd5b6105298583860161031e565b6060840152608084013591508082111561054257600080fd5b5061054f8482850161031e565b60808301525092915050565b6000806020838503121561056d578182fd5b823567ffffffffffffffff80821115610584578384fd5b818501915085601f830112610597578384fd5b8135818111156105a5578485fd5b86602080830285010111156105b8578485fd5b60209290920196919550909350505050565b6000602082840312156105db578081fd5b813567ffffffffffffffff8111156105f1578182fd5b8201601f81018413610601578182fd5b610610848235602084016102b5565b949350505050565b60008151808452815b8181101561063d57602081850181015186830182015201610621565b8181111561064e5782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106ae578451825293830193600192909201919083019061068e565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a0604082018190526000906106f990830186610618565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261075a610140830182610618565b9050604085015182820360408401526107738282610663565b9150506060850151828203606084015261078d8282610618565b915050608085015182820360808401526107a78282610618565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261084d578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561087357fe5b604052919050565b600060a0823603121561088c578081fd5b60405160a0810167ffffffffffffffff82821081831117156108aa57fe5b816040526108b785610307565b83526108c560208601610307565b602084015260408501359150808211156108dd578384fd5b6108e93683870161031e565b604084015260608501356060840152608085013591508082111561090b578384fd5b5061054f3682860161049756fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220496799237919f1a19e0ff724ed914173ffae08bf4e918b2ba00351303fe8d51464736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806316e9cd9b1461003b578063461a447814610050575b600080fd5b61004e61004936600461055b565b610079565b005b61006361005e3660046105ca565b6101d7565b60405161007091906106b9565b60405180910390f35b6100b76040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101d7565b6001600160a01b0316336001600160a01b0316146100f05760405162461bcd60e51b81526004016100e7906107b5565b60405180910390fd5b6000610113604051806060016040528060218152602001610919602191396101d7565b905060005b828110156101d157600084848381811061012e57fe5b90506020028101906101409190610838565b6101499061087b565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd95610192959094909392916004016106cd565b600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505060019093019250610118915050565b50505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561023757818101518382015260200161021f565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561028157600080fd5b505afa158015610295573d6000803e3d6000fd5b505050506040513d60208110156102ab57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102c957fe5b6102dc601f8401601f1916602001610857565b90508281528383830111156102f057600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102b057600080fd5b600082601f83011261032e578081fd5b61033d838335602085016102b5565b9392505050565b600060a08284031215610355578081fd5b60405160a0810167ffffffffffffffff828210818311171561037357fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103b057600080fd5b506103bd8582860161031e565b6080830152505092915050565b6000604082840312156103db578081fd5b6040516040810167ffffffffffffffff82821081831117156103f957fe5b816040528293508435835260209150818501358181111561041957600080fd5b8501601f8101871361042a57600080fd5b80358281111561043657fe5b8381029250610446848401610857565b8181528481019083860185850187018b101561046157600080fd5b600095505b83861015610484578035835260019590950194918601918601610466565b5080868801525050505050505092915050565b600060a082840312156104a8578081fd5b6104b260a0610857565b905081358152602082013567ffffffffffffffff808211156104d357600080fd5b6104df85838601610344565b602084015260408401359150808211156104f857600080fd5b610504858386016103ca565b6040840152606084013591508082111561051d57600080fd5b6105298583860161031e565b6060840152608084013591508082111561054257600080fd5b5061054f8482850161031e565b60808301525092915050565b6000806020838503121561056d578182fd5b823567ffffffffffffffff80821115610584578384fd5b818501915085601f830112610597578384fd5b8135818111156105a5578485fd5b86602080830285010111156105b8578485fd5b60209290920196919550909350505050565b6000602082840312156105db578081fd5b813567ffffffffffffffff8111156105f1578182fd5b8201601f81018413610601578182fd5b610610848235602084016102b5565b949350505050565b60008151808452815b8181101561063d57602081850181015186830182015201610621565b8181111561064e5782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106ae578451825293830193600192909201919083019061068e565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a0604082018190526000906106f990830186610618565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261075a610140830182610618565b9050604085015182820360408401526107738282610663565b9150506060850151828203606084015261078d8282610618565b915050608085015182820360808401526107a78282610618565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261084d578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561087357fe5b604052919050565b600060a0823603121561088c578081fd5b60405160a0810167ffffffffffffffff82821081831117156108aa57fe5b816040526108b785610307565b83526108c560208601610307565b602084015260408501359150808211156108dd578384fd5b6108e93683870161031e565b604084015260608501356060840152608085013591508082111561090b578384fd5b5061054f3682860161049756fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220496799237919f1a19e0ff724ed914173ffae08bf4e918b2ba00351303fe8d51464736f6c63430007060033", + "devdoc": { + "details": "The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain Message Sender. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])": { + "params": { + "_messages": "An array of L2 to L1 messages" + } + } + }, + "title": "OVM_L1MultiMessageRelayer", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])": { + "notice": "Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + } + ], + "types": { + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_SafetyChecker.json b/deployments/kovan/OVM_SafetyChecker.json new file mode 100644 index 000000000..ec51f3f10 --- /dev/null +++ b/deployments/kovan/OVM_SafetyChecker.json @@ -0,0 +1,74 @@ +{ + "address": "0xa9770c8F8Cac8F86815Cb41DC91f0eE7a3451304", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes", + "name": "_bytecode", + "type": "bytes" + } + ], + "name": "isBytecodeSafe", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x32cf8baaba87cde5cf26043361e0c2955e6d31948ed3953d11def531ac7ce5ba", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0xa9770c8F8Cac8F86815Cb41DC91f0eE7a3451304", + "transactionIndex": 2, + "gasUsed": "243548", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x44cbb30014f38bdc2b802fe94de9c29e320ab1ecf3419807ea44ab740302e688", + "transactionHash": "0x32cf8baaba87cde5cf26043361e0c2955e6d31948ed3953d11def531ac7ce5ba", + "logs": [], + "blockNumber": 23637135, + "cumulativeGasUsed": "390669", + "status": 1, + "byzantium": true + }, + "args": [], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"isBytecodeSafe\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Safety Checker verifies that contracts deployed on L2 do not contain any \\\"unsafe\\\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \\\"escape the sandbox\\\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \\\"prove fraud\\\" on an honestly applied transaction. Note that a \\\"safe\\\" contract requires opcodes to appear in a particular pattern; omission of \\\"unsafe\\\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"isBytecodeSafe(bytes)\":{\"params\":{\"_bytecode\":\"The bytecode to safety check.\"},\"returns\":{\"_0\":\"`true` if the bytecode is safe, `false` otherwise.\"}}},\"title\":\"OVM_SafetyChecker\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"isBytecodeSafe(bytes)\":{\"notice\":\"Returns whether or not all of the provided bytecode is safe.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol\":\"OVM_SafetyChecker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/**\\n * @title OVM_SafetyChecker\\n * @dev The Safety Checker verifies that contracts deployed on L2 do not contain any\\n * \\\"unsafe\\\" operations. An operation is considered unsafe if it would access state variables which\\n * are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used\\n * to \\\"escape the sandbox\\\" of the OVM, resulting in non-deterministic fraud proofs. \\n * That is, an attacker would be able to \\\"prove fraud\\\" on an honestly applied transaction.\\n * Note that a \\\"safe\\\" contract requires opcodes to appear in a particular pattern;\\n * omission of \\\"unsafe\\\" opcodes is necessary, but not sufficient.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_SafetyChecker is iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n /**\\n * Returns whether or not all of the provided bytecode is safe.\\n * @param _bytecode The bytecode to safety check.\\n * @return `true` if the bytecode is safe, `false` otherwise.\\n */\\n function isBytecodeSafe(\\n bytes memory _bytecode\\n )\\n override\\n external\\n pure\\n returns (bool)\\n {\\n // autogenerated by gen_safety_checker_constants.py\\n // number of bytes to skip for each opcode\\n uint256[8] memory opcodeSkippableBytes = [\\n uint256(0x0001010101010101010101010000000001010101010101010101010101010000),\\n uint256(0x0100000000000000000000000000000000000000010101010101000000010100),\\n uint256(0x0000000000000000000000000000000001010101000000010101010100000000),\\n uint256(0x0203040500000000000000000000000000000000000000000000000000000000),\\n uint256(0x0101010101010101010101010101010101010101010101010101010101010101),\\n uint256(0x0101010101000000000000000000000000000000000000000000000000000000),\\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000),\\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000)\\n ];\\n // Mask to gate opcode specific cases\\n uint256 opcodeGateMask = ~uint256(0xffffffffffffffffffffffe000000000fffffffff070ffff9c0ffffec000f001);\\n // Halting opcodes\\n uint256 opcodeHaltingMask = ~uint256(0x4008000000000000000000000000000000000000004000000000000000000001);\\n // PUSH opcodes\\n uint256 opcodePushMask = ~uint256(0xffffffff000000000000000000000000);\\n\\n uint256 codeLength;\\n uint256 _pc;\\n assembly {\\n _pc := add(_bytecode, 0x20)\\n }\\n codeLength = _pc + _bytecode.length;\\n do {\\n // current opcode: 0x00...0xff\\n uint256 opNum;\\n\\n // inline assembly removes the extra add + bounds check\\n assembly {\\n let word := mload(_pc) //load the next 32 bytes at pc into word\\n\\n // Look up number of bytes to skip from opcodeSkippableBytes and then update indexInWord\\n // E.g. the 02030405 in opcodeSkippableBytes is the number of bytes to skip for PUSH1->4\\n // We repeat this 6 times, thus we can only skip bytes for up to PUSH4 ((1+4) * 6 = 30 < 32).\\n // If we see an opcode that is listed as 0 skippable bytes e.g. PUSH5,\\n // then we will get stuck on that indexInWord and then opNum will be set to the PUSH5 opcode.\\n let indexInWord := byte(0, mload(add(opcodeSkippableBytes, byte(0, word))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n _pc := add(_pc, indexInWord)\\n\\n opNum := byte(indexInWord, word)\\n }\\n\\n // + push opcodes\\n // + stop opcodes [STOP(0x00),JUMP(0x56),RETURN(0xf3),INVALID(0xfe)]\\n // + caller opcode CALLER(0x33)\\n // + blacklisted opcodes\\n uint256 opBit = 1 << opNum;\\n if (opBit & opcodeGateMask == 0) {\\n if (opBit & opcodePushMask == 0) {\\n // all pushes are valid opcodes\\n // subsequent bytes are not opcodes. Skip them.\\n _pc += (opNum - 0x5e); // PUSH1 is 0x60, so opNum-0x5f = PUSHed bytes and we +1 to\\n // skip the _pc++; line below in order to save gas ((-0x5f + 1) = -0x5e)\\n continue;\\n } else if (opBit & opcodeHaltingMask == 0) {\\n // STOP or JUMP or RETURN or INVALID (Note: REVERT is blacklisted, so not included here)\\n // We are now inside unreachable code until we hit a JUMPDEST!\\n do {\\n _pc++;\\n assembly {\\n opNum := byte(0, mload(_pc))\\n }\\n // encountered a JUMPDEST\\n if (opNum == 0x5b) break;\\n // skip PUSHed bytes\\n if ((1 << opNum) & opcodePushMask == 0) _pc += (opNum - 0x5f); // opNum-0x5f = PUSHed bytes (PUSH1 is 0x60)\\n } while (_pc < codeLength);\\n // opNum is 0x5b, so we don't continue here since the pc++ is fine\\n } else if (opNum == 0x33) { // Caller opcode\\n uint256 firstOps; // next 32 bytes of bytecode\\n uint256 secondOps; // following 32 bytes of bytecode\\n\\n assembly {\\n firstOps := mload(_pc)\\n // 37 bytes total, 5 left over --> 32 - 5 bytes = 27 bytes = 216 bits\\n secondOps := shr(216, mload(add(_pc, 0x20)))\\n }\\n\\n // Call identity precompile\\n // CALLER POP PUSH1 0x00 PUSH1 0x04 GAS CALL\\n // 32 - 8 bytes = 24 bytes = 192\\n if ((firstOps >> 192) == 0x3350600060045af1) {\\n _pc += 8;\\n // Call EM and abort execution if instructed\\n // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x0E ADD JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x00 REVERT JUMPDEST RETURNDATASIZE PUSH1 0x01 EQ ISZERO PC PUSH1 0x0a ADD JUMPI PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST \\n } else if (firstOps == 0x336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760 && secondOps == 0x016000f35b) {\\n _pc += 37;\\n } else {\\n return false;\\n }\\n continue;\\n } else {\\n // encountered a non-whitelisted opcode!\\n return false;\\n }\\n }\\n _pc++;\\n } while (_pc < codeLength);\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x3053b7b1bb58319d8e69e246270d123cc0085f5cc464707f45b784cae0acd774\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610373806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212203094e4fb12ca7ef3e9253b892048a07ad2cd882f0940e964f04661606fdc1fe664736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212203094e4fb12ca7ef3e9253b892048a07ad2cd882f0940e964f04661606fdc1fe664736f6c63430007060033", + "devdoc": { + "details": "The Safety Checker verifies that contracts deployed on L2 do not contain any \"unsafe\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction. Note that a \"safe\" contract requires opcodes to appear in a particular pattern; omission of \"unsafe\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "isBytecodeSafe(bytes)": { + "params": { + "_bytecode": "The bytecode to safety check." + }, + "returns": { + "_0": "`true` if the bytecode is safe, `false` otherwise." + } + } + }, + "title": "OVM_SafetyChecker", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "isBytecodeSafe(bytes)": { + "notice": "Returns whether or not all of the provided bytecode is safe." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateCommitmentChain.json b/deployments/kovan/OVM_StateCommitmentChain.json index 0ddec5ac1..c9ef25513 100644 --- a/deployments/kovan/OVM_StateCommitmentChain.json +++ b/deployments/kovan/OVM_StateCommitmentChain.json @@ -1,5 +1,5 @@ { - "address": "0x61486103c072Dc1A6ac275d6E50D2adb1162263C", + "address": "0x63139eC71aFf564351b2EbA21bE114D2069021cB", "abi": [ { "inputs": [ @@ -348,24 +348,24 @@ "type": "function" } ], - "transactionHash": "0x00ac04aac57fb9e0f2a09bf37b8d96df9a1072f653b85061743aad995a298c87", + "transactionHash": "0x4c0d30924c696fea16ac0447dfd2f99a413f8435511dc7bc7f17ed081d36bd26", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x61486103c072Dc1A6ac275d6E50D2adb1162263C", - "transactionIndex": 3, + "contractAddress": "0x63139eC71aFf564351b2EbA21bE114D2069021cB", + "transactionIndex": 0, "gasUsed": "1620938", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x02dfe2482f15052adc685b554cbea05696e42ffc7626482817417ae9dd5efc9a", - "transactionHash": "0x00ac04aac57fb9e0f2a09bf37b8d96df9a1072f653b85061743aad995a298c87", + "blockHash": "0xe9bda56bde047ad73b05a03e4f9d610098804e3f8350c56949083d37c8d50629", + "transactionHash": "0x4c0d30924c696fea16ac0447dfd2f99a413f8435511dc7bc7f17ed081d36bd26", "logs": [], - "blockNumber": 23635980, - "cumulativeGasUsed": "1747814", + "blockNumber": 23637140, + "cumulativeGasUsed": "1620938", "status": 1, "byzantium": true }, "args": [ - "0xe32CEbDb70aC8572Ebee537507784089Fb96a8Ad", + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", 60000, 60000 ], diff --git a/deployments/kovan/OVM_StateManagerFactory.json b/deployments/kovan/OVM_StateManagerFactory.json index 67fb8cd3c..99bd26d90 100644 --- a/deployments/kovan/OVM_StateManagerFactory.json +++ b/deployments/kovan/OVM_StateManagerFactory.json @@ -1,5 +1,5 @@ { - "address": "0x8ba74b3C5AAc1b26AFBfD5780EA8a2c81753bF36", + "address": "0x2B518585718dd8a3812A0441dE0f1DDF2FA3cBf5", "abi": [ { "inputs": [ @@ -21,19 +21,19 @@ "type": "function" } ], - "transactionHash": "0xdc9418127414cbd58dd03790012b29196e06951c105dc9bc43347934414c2e2f", + "transactionHash": "0xa008a616f18db05c6ace3e94b96d133407cb70f8b7bd6ca5809fd30f4ce40c9e", "receipt": { "to": null, "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x8ba74b3C5AAc1b26AFBfD5780EA8a2c81753bF36", - "transactionIndex": 0, + "contractAddress": "0x2B518585718dd8a3812A0441dE0f1DDF2FA3cBf5", + "transactionIndex": 4, "gasUsed": "1170970", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xf889adc978b910b12386513fe0bddc36c5309325a4bc4e5f94f08f0a2565a0ce", - "transactionHash": "0xdc9418127414cbd58dd03790012b29196e06951c105dc9bc43347934414c2e2f", + "blockHash": "0x6213746630f139c66f8c55df2186ef11f690ca4606f1adf6770ecfe70898ce1e", + "transactionHash": "0xa008a616f18db05c6ace3e94b96d133407cb70f8b7bd6ca5809fd30f4ce40c9e", "logs": [], - "blockNumber": 23635982, - "cumulativeGasUsed": "1170970", + "blockNumber": 23637144, + "cumulativeGasUsed": "1342685", "status": 1, "byzantium": true }, diff --git a/deployments/kovan/OVM_StateTransitionerFactory.json b/deployments/kovan/OVM_StateTransitionerFactory.json new file mode 100644 index 000000000..86bf5165d --- /dev/null +++ b/deployments/kovan/OVM_StateTransitionerFactory.json @@ -0,0 +1,139 @@ +{ + "address": "0x08337386255CaA3ddC2b55E0aa546218c92a5dCE", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_libAddressManager", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_stateTransitionIndex", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_preStateRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_transactionHash", + "type": "bytes32" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "contract iOVM_StateTransitioner", + "name": "_ovmStateTransitioner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address", + "name": "_contract", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xcf2e9291837c499aa978653ac290e26ec001fc0f5da228484c9bb7c91825c2b4", + "receipt": { + "to": null, + "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", + "contractAddress": "0x08337386255CaA3ddC2b55E0aa546218c92a5dCE", + "transactionIndex": 2, + "gasUsed": "4021009", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa30a364c7e784548599fc347c78edd15bef45bff4a7d2551ceead391dfcdf03f", + "transactionHash": "0xcf2e9291837c499aa978653ac290e26ec001fc0f5da228484c9bb7c91825c2b4", + "logs": [], + "blockNumber": 23637147, + "cumulativeGasUsed": "4109675", + "status": 1, + "byzantium": true + }, + "args": [ + "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" + ], + "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", + "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stateTransitionIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"}],\"name\":\"create\",\"outputs\":[{\"internalType\":\"contract iOVM_StateTransitioner\",\"name\":\"_ovmStateTransitioner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Transitioner Factory is used by the Fraud Verifier to create a new State Transitioner during the initialization of a fraud proof. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_preStateRoot\":\"State root before the transition was executed.\",\"_stateTransitionIndex\":\"Index of the state transition being verified.\",\"_transactionHash\":\"Hash of the executed transaction.\"},\"returns\":{\"_ovmStateTransitioner\":\"New OVM_StateTransitioner instance.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol\":\"OVM_StateTransitionerFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/// Minimal contract to be inherited by contracts consumed by users that provide\\n/// data for fraud proofs\\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\\n /// Decorate your functions with this modifier to store how much total gas was\\n /// consumed by the sender, to reward users fairly\\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\\n uint256 startGas = gasleft();\\n _;\\n uint256 gasSpent = startGas - gasleft();\\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\\n }\\n}\\n\",\"keccak256\":\"0x6c27d089a297103cb93b30f7649ab68691cc6b948c315f1037e5de1fe9bf5903\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../../libraries/rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_RLPReader } from \\\"../../libraries/rlp/Lib_RLPReader.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_StateManagerFactory } from \\\"../../iOVM/execution/iOVM_StateManagerFactory.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_FraudContributor } from \\\"./Abs_FraudContributor.sol\\\";\\n\\n/**\\n * @title OVM_StateTransitioner\\n * @dev The State Transitioner coordinates the execution of a state transition during the evaluation of a\\n * fraud proof. It feeds verified input to the Execution Manager's run(), and controls a State Manager (which is\\n * uniquely created for each fraud proof).\\n * Once a fraud proof has been initialized, this contract is provided with the pre-state root and verifies\\n * that the OVM storage slots committed to the State Mangager are contained in that state\\n * This contract controls the State Manager and Execution Manager, and uses them to calculate the\\n * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by comparing\\n * the calculated post-state root with the proposed post-state root.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum TransitionPhase {\\n PRE_EXECUTION,\\n POST_EXECUTION,\\n COMPLETE\\n }\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n iOVM_StateManager public ovmStateManager;\\n\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n bytes32 internal preStateRoot;\\n bytes32 internal postStateRoot;\\n TransitionPhase public phase;\\n uint256 internal stateTransitionIndex;\\n bytes32 internal transactionHash;\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _stateTransitionIndex Index of the state transition being verified.\\n * @param _preStateRoot State root before the transition was executed.\\n * @param _transactionHash Hash of the executed transaction.\\n */\\n constructor(\\n address _libAddressManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n stateTransitionIndex = _stateTransitionIndex;\\n preStateRoot = _preStateRoot;\\n postStateRoot = _preStateRoot;\\n transactionHash = _transactionHash;\\n\\n ovmStateManager = iOVM_StateManagerFactory(resolve(\\\"OVM_StateManagerFactory\\\")).create(address(this));\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Checks that a function is only run during a specific phase.\\n * @param _phase Phase the function must run within.\\n */\\n modifier onlyDuringPhase(\\n TransitionPhase _phase\\n ) {\\n require(\\n phase == _phase,\\n \\\"Function must be called during the correct phase.\\\"\\n );\\n _;\\n }\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n /**\\n * Retrieves the state root before execution.\\n * @return _preStateRoot State root before execution.\\n */\\n function getPreStateRoot()\\n override\\n public\\n view\\n returns (\\n bytes32 _preStateRoot\\n )\\n {\\n return preStateRoot;\\n }\\n\\n /**\\n * Retrieves the state root after execution.\\n * @return _postStateRoot State root after execution.\\n */\\n function getPostStateRoot()\\n override\\n public\\n view\\n returns (\\n bytes32 _postStateRoot\\n )\\n {\\n return postStateRoot;\\n }\\n\\n /**\\n * Checks whether the transitioner is complete.\\n * @return _complete Whether or not the transition process is finished.\\n */\\n function isComplete()\\n override\\n public\\n view\\n returns (\\n bool _complete\\n )\\n {\\n return phase == TransitionPhase.COMPLETE;\\n }\\n \\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n /**\\n * Allows a user to prove the initial state of a contract.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _ethContractAddress Address of the corresponding contract on L1.\\n * @param _stateTrieWitness Proof of the account state.\\n */\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes memory _stateTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n // Exit quickly to avoid unnecessary work.\\n require(\\n (\\n ovmStateManager.hasAccount(_ovmContractAddress) == false\\n && ovmStateManager.hasEmptyAccount(_ovmContractAddress) == false\\n ),\\n \\\"Account state has already been proven.\\\"\\n );\\n\\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\\n (\\n bool exists,\\n bytes memory encodedAccount\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(_ovmContractAddress),\\n _stateTrieWitness,\\n preStateRoot\\n );\\n\\n if (exists == true) {\\n // Account exists, this was an inclusion proof.\\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\\n encodedAccount\\n );\\n\\n address ethContractAddress = _ethContractAddress;\\n if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) {\\n // Use a known empty contract to prevent an attack in which a user provides a\\n // contract address here and then later deploys code to it.\\n ethContractAddress = 0x0000000000000000000000000000000000000000;\\n } else {\\n // Otherwise, make sure that the code at the provided eth address matches the hash\\n // of the code stored on L2.\\n require(\\n Lib_EthUtils.getCodeHash(ethContractAddress) == account.codeHash,\\n \\\"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash.\\\"\\n );\\n }\\n\\n ovmStateManager.putAccount(\\n _ovmContractAddress,\\n Lib_OVMCodec.Account({\\n nonce: account.nonce,\\n balance: account.balance,\\n storageRoot: account.storageRoot,\\n codeHash: account.codeHash,\\n ethAddress: ethContractAddress,\\n isFresh: false\\n })\\n );\\n } else {\\n // Account does not exist, this was an exclusion proof.\\n ovmStateManager.putEmptyAccount(_ovmContractAddress);\\n }\\n }\\n\\n /**\\n * Allows a user to prove the initial state of a contract storage slot.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _key Claimed account slot key.\\n * @param _storageTrieWitness Proof of the storage slot.\\n */\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes memory _storageTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n // Exit quickly to avoid unnecessary work.\\n require(\\n ovmStateManager.hasContractStorage(_ovmContractAddress, _key) == false,\\n \\\"Storage slot has already been proven.\\\"\\n );\\n\\n require(\\n ovmStateManager.hasAccount(_ovmContractAddress) == true,\\n \\\"Contract must be verified before proving a storage slot.\\\"\\n );\\n\\n bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress);\\n bytes32 value;\\n\\n if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) {\\n // Storage trie was empty, so the user is always allowed to insert zero-byte values.\\n value = bytes32(0);\\n } else {\\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\\n (\\n bool exists,\\n bytes memory encodedValue\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(_key),\\n _storageTrieWitness,\\n storageRoot\\n );\\n\\n if (exists == true) {\\n // Inclusion proof.\\n // Stored values are RLP encoded, with leading zeros removed.\\n value = Lib_BytesUtils.toBytes32PadLeft(\\n Lib_RLPReader.readBytes(encodedValue)\\n );\\n } else {\\n // Exclusion proof, can only be zero bytes.\\n value = bytes32(0);\\n }\\n }\\n\\n ovmStateManager.putContractStorage(\\n _ovmContractAddress,\\n _key,\\n value\\n );\\n }\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n /**\\n * Executes the state transition.\\n * @param _transaction OVM transaction to execute.\\n */\\n function applyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n Lib_OVMCodec.hashTransaction(_transaction) == transactionHash,\\n \\\"Invalid transaction provided.\\\"\\n );\\n\\n // We require gas to complete the logic here in run() before/after execution,\\n // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism)\\n // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first \\n // going into EM, then going into the code contract).\\n require(\\n gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, // 1032/1000 = 1.032 = (64/63)^2 rounded up\\n \\\"Not enough gas to execute transaction deterministically.\\\"\\n );\\n\\n iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve(\\\"OVM_ExecutionManager\\\"));\\n\\n // We call `setExecutionManager` right before `run` (and not earlier) just in case the\\n // OVM_ExecutionManager address was updated between the time when this contract was created\\n // and when `applyTransaction` was called.\\n ovmStateManager.setExecutionManager(address(ovmExecutionManager));\\n\\n // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction`\\n // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line\\n // if that's the case.\\n ovmExecutionManager.run(_transaction, address(ovmStateManager));\\n\\n phase = TransitionPhase.POST_EXECUTION;\\n }\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n /**\\n * Allows a user to commit the final state of a contract.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _stateTrieWitness Proof of the account state.\\n */\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes memory _stateTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\\n \\\"All storage must be committed before committing account states.\\\"\\n );\\n\\n require (\\n ovmStateManager.commitAccount(_ovmContractAddress) == true,\\n \\\"Account state wasn't changed or has already been committed.\\\"\\n );\\n\\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\\n\\n postStateRoot = Lib_SecureMerkleTrie.update(\\n abi.encodePacked(_ovmContractAddress),\\n Lib_OVMCodec.encodeEVMAccount(\\n Lib_OVMCodec.toEVMAccount(account)\\n ),\\n _stateTrieWitness,\\n postStateRoot\\n );\\n\\n // Emit an event to help clients figure out the proof ordering.\\n emit AccountCommitted(\\n _ovmContractAddress\\n );\\n }\\n\\n /**\\n * Allows a user to commit the final state of a contract storage slot.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _key Claimed account slot key.\\n * @param _storageTrieWitness Proof of the storage slot.\\n */\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes memory _storageTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n ovmStateManager.commitContractStorage(_ovmContractAddress, _key) == true,\\n \\\"Storage slot value wasn't changed or has already been committed.\\\"\\n );\\n\\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\\n bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key);\\n\\n account.storageRoot = Lib_SecureMerkleTrie.update(\\n abi.encodePacked(_key),\\n Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(value)\\n ),\\n _storageTrieWitness,\\n account.storageRoot\\n );\\n\\n ovmStateManager.putAccount(_ovmContractAddress, account);\\n\\n // Emit an event to help clients figure out the proof ordering.\\n emit ContractStorageCommitted(\\n _ovmContractAddress,\\n _key\\n );\\n }\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n /**\\n * Finalizes the transition process.\\n */\\n function completeTransition()\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n {\\n require(\\n ovmStateManager.getTotalUncommittedAccounts() == 0,\\n \\\"All accounts must be committed before completing a transition.\\\"\\n );\\n\\n require(\\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\\n \\\"All storage must be committed before completing a transition.\\\"\\n );\\n\\n phase = TransitionPhase.COMPLETE;\\n }\\n}\\n\",\"keccak256\":\"0xbff1135355a03ea535c952bd130799fdc95d2a559622830afabf70aba7f62742\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_StateTransitionerFactory } from \\\"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\\\";\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_StateTransitioner } from \\\"./OVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title OVM_StateTransitionerFactory\\n * @dev The State Transitioner Factory is used by the Fraud Verifier to create a new State \\n * Transitioner during the initialization of a fraud proof.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_AddressResolver {\\n\\n constructor(\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n /**\\n * Creates a new OVM_StateTransitioner\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _stateTransitionIndex Index of the state transition being verified.\\n * @param _preStateRoot State root before the transition was executed.\\n * @param _transactionHash Hash of the executed transaction.\\n * @return _ovmStateTransitioner New OVM_StateTransitioner instance.\\n */\\n function create(\\n address _libAddressManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n override\\n public\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x6caf30cd761fb3b1fbe4765fd18e2636fbd8f96bf8403216797664dac726aed2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateManager } from \\\"./iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title iOVM_StateManagerFactory\\n */\\ninterface iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _owner\\n )\\n external\\n returns (\\n iOVM_StateManager _ovmStateManager\\n );\\n}\\n\",\"keccak256\":\"0x27a90fc43889d0c7d1db50f37907ef7386d9b415d15a1e91a0a068cba59afd36\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitionerFactory\\n */\\ninterface iOVM_StateTransitionerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _proxyManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n external\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n );\\n}\\n\",\"keccak256\":\"0x60a0f0c104e4c0c7863268a93005762e8146d393f9cfddfdd6a2d6585c5911fc\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\n\\n/**\\n * @title Lib_MerkleTrie\\n */\\nlibrary Lib_MerkleTrie {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum NodeType {\\n BranchNode,\\n ExtensionNode,\\n LeafNode\\n }\\n\\n struct TrieNode {\\n bytes encoded;\\n Lib_RLPReader.RLPItem[] decoded;\\n }\\n\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n // TREE_RADIX determines the number of elements per branch node.\\n uint256 constant TREE_RADIX = 16;\\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\\n\\n // Prefixes are prepended to the `path` within a leaf or extension node and\\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\\n // determined by the number of nibbles within the unprefixed `path`. If the\\n // number of nibbles if even, we need to insert an extra padding nibble so\\n // the resulting prefixed `path` has an even number of nibbles.\\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\\n uint8 constant PREFIX_EXTENSION_ODD = 1;\\n uint8 constant PREFIX_LEAF_EVEN = 2;\\n uint8 constant PREFIX_LEAF_ODD = 3;\\n\\n // Just a utility constant. RLP represents `NULL` as 0x80.\\n bytes1 constant RLP_NULL = bytes1(0x80);\\n bytes constant RLP_NULL_BYTES = hex'80';\\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n bytes memory value\\n ) = get(_key, _proof, _root);\\n\\n return (\\n exists && Lib_BytesUtils.equal(_value, value)\\n );\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n ) = get(_key, _proof, _root);\\n\\n return exists == false;\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n // Special case when inserting the very first node.\\n if (_root == KECCAK256_RLP_NULL_BYTES) {\\n return getSingleNodeRootHash(_key, _value);\\n }\\n\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\\n\\n return _getUpdatedTrieRoot(newPath, _key);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\\n\\n bool exists = keyRemainder.length == 0;\\n\\n require(\\n exists || isFinalNode,\\n \\\"Provided proof is invalid.\\\"\\n );\\n\\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\\n\\n return (\\n exists,\\n value\\n );\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n return keccak256(_makeLeafNode(\\n Lib_BytesUtils.toNibbles(_key),\\n _value\\n ).encoded);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * @notice Walks through a proof using a provided key.\\n * @param _proof Inclusion proof to walk through.\\n * @param _key Key to use for the walk.\\n * @param _root Known root of the trie.\\n * @return _pathLength Length of the final path\\n * @return _keyRemainder Portion of the key remaining after the walk.\\n * @return _isFinalNode Whether or not we've hit a dead end.\\n */\\n function _walkNodePath(\\n TrieNode[] memory _proof,\\n bytes memory _key,\\n bytes32 _root\\n )\\n private\\n pure\\n returns (\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bool _isFinalNode\\n )\\n {\\n uint256 pathLength = 0;\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n bytes32 currentNodeID = _root;\\n uint256 currentKeyIndex = 0;\\n uint256 currentKeyIncrement = 0;\\n TrieNode memory currentNode;\\n\\n // Proof is top-down, so we start at the first element (root).\\n for (uint256 i = 0; i < _proof.length; i++) {\\n currentNode = _proof[i];\\n currentKeyIndex += currentKeyIncrement;\\n\\n // Keep track of the proof elements we actually need.\\n // It's expensive to resize arrays, so this simply reduces gas costs.\\n pathLength += 1;\\n\\n if (currentKeyIndex == 0) {\\n // First proof element is always the root node.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid root hash\\\"\\n );\\n } else if (currentNode.encoded.length >= 32) {\\n // Nodes 32 bytes or larger are hashed inside branch nodes.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid large internal hash\\\"\\n );\\n } else {\\n // Nodes smaller than 31 bytes aren't hashed.\\n require(\\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\\n \\\"Invalid internal node hash\\\"\\n );\\n }\\n\\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\\n if (currentKeyIndex == key.length) {\\n // We've hit the end of the key, meaning the value should be within this branch node.\\n break;\\n } else {\\n // We're not at the end of the key yet.\\n // Figure out what the next node ID should be and continue.\\n uint8 branchKey = uint8(key[currentKeyIndex]);\\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\\n currentNodeID = _getNodeID(nextNode);\\n currentKeyIncrement = 1;\\n continue;\\n }\\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(currentNode);\\n uint8 prefix = uint8(path[0]);\\n uint8 offset = 2 - prefix % 2;\\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n if (\\n pathRemainder.length == sharedNibbleLength &&\\n keyRemainder.length == sharedNibbleLength\\n ) {\\n // The key within this leaf matches our key exactly.\\n // Increment the key index to reflect that we have no remainder.\\n currentKeyIndex += sharedNibbleLength;\\n }\\n\\n // We've hit a leaf node, so our next node should be NULL.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n if (sharedNibbleLength == 0) {\\n // Our extension node doesn't share any part of our key.\\n // We've hit the end of this path, updates will need to modify this extension.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else {\\n // Our extension shares some nibbles.\\n // Carry on to the next node.\\n currentNodeID = _getNodeID(currentNode.decoded[1]);\\n currentKeyIncrement = sharedNibbleLength;\\n continue;\\n }\\n } else {\\n revert(\\\"Received a node with an unknown prefix\\\");\\n }\\n } else {\\n revert(\\\"Received an unparseable node.\\\");\\n }\\n }\\n\\n // If our node ID is NULL, then we're at a dead end.\\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\\n }\\n\\n /**\\n * @notice Creates new nodes to support a k/v pair insertion into a given\\n * Merkle trie path.\\n * @param _path Path to the node nearest the k/v pair.\\n * @param _pathLength Length of the path. Necessary because the provided\\n * path may include additional nodes (e.g., it comes directly from a proof)\\n * and we can't resize in-memory arrays without costly duplication.\\n * @param _keyRemainder Portion of the initial key that must be inserted\\n * into the trie.\\n * @param _value Value to insert at the given key.\\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\\n */\\n function _getNewPath(\\n TrieNode[] memory _path,\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _newPath\\n )\\n {\\n bytes memory keyRemainder = _keyRemainder;\\n\\n // Most of our logic depends on the status of the last node in the path.\\n TrieNode memory lastNode = _path[_pathLength - 1];\\n NodeType lastNodeType = _getNodeType(lastNode);\\n\\n // Create an array for newly created nodes.\\n // We need up to three new nodes, depending on the contents of the last node.\\n // Since array resizing is expensive, we'll keep track of the size manually.\\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\\n TrieNode[] memory newNodes = new TrieNode[](3);\\n uint256 totalNewNodes = 0;\\n\\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\\n // We've found a leaf node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\\n totalNewNodes += 1;\\n } else if (lastNodeType == NodeType.BranchNode) {\\n if (keyRemainder.length == 0) {\\n // We've found a branch node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\\n totalNewNodes += 1;\\n } else {\\n // We've found a branch node, but it doesn't contain our key.\\n // Reinsert the old branch for now.\\n newNodes[totalNewNodes] = lastNode;\\n totalNewNodes += 1;\\n // Create a new leaf node, slicing our remainder since the first byte points\\n // to our branch node.\\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\\n totalNewNodes += 1;\\n }\\n } else {\\n // Our last node is either an extension node or a leaf node with a different key.\\n bytes memory lastNodeKey = _getNodeKey(lastNode);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\\n\\n if (sharedNibbleLength != 0) {\\n // We've got some shared nibbles between the last node and our key remainder.\\n // We'll need to insert an extension node that covers these shared nibbles.\\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\\n totalNewNodes += 1;\\n\\n // Cut down the keys since we've just covered these shared nibbles.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\\n }\\n\\n // Create an empty branch to fill in.\\n TrieNode memory newBranch = _makeEmptyBranchNode();\\n\\n if (lastNodeKey.length == 0) {\\n // Key remainder was larger than the key for our last node.\\n // The value within our last node is therefore going to be shifted into\\n // a branch value slot.\\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\\n } else {\\n // Last node key was larger than the key remainder.\\n // We're going to modify some index of our branch.\\n uint8 branchKey = uint8(lastNodeKey[0]);\\n // Move on to the next nibble.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\\n\\n if (lastNodeType == NodeType.LeafNode) {\\n // We're dealing with a leaf node.\\n // We'll modify the key and insert the old leaf node into the branch index.\\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else if (lastNodeKey.length != 0) {\\n // We're dealing with a shrinking extension node.\\n // We need to modify the node to decrease the size of the key.\\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else {\\n // We're dealing with an unnecessary extension node.\\n // We're going to delete the node entirely.\\n // Simply insert its current value into the branch index.\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\\n }\\n }\\n\\n if (keyRemainder.length == 0) {\\n // We've got nothing left in the key remainder.\\n // Simply insert the value into the branch value slot.\\n newBranch = _editBranchValue(newBranch, _value);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n } else {\\n // We've got some key remainder to work with.\\n // We'll be inserting a leaf node into the trie.\\n // First, move on to the next nibble.\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n // Push a new leaf node for our k/v pair.\\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\\n totalNewNodes += 1;\\n }\\n }\\n\\n // Finally, join the old path with our newly created nodes.\\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\\n }\\n\\n /**\\n * @notice Computes the trie root from a given path.\\n * @param _nodes Path to some k/v pair.\\n * @param _key Key for the k/v pair.\\n * @return _updatedRoot Root hash for the updated trie.\\n */\\n function _getUpdatedTrieRoot(\\n TrieNode[] memory _nodes,\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n // Some variables to keep track of during iteration.\\n TrieNode memory currentNode;\\n NodeType currentNodeType;\\n bytes memory previousNodeHash;\\n\\n // Run through the path backwards to rebuild our root hash.\\n for (uint256 i = _nodes.length; i > 0; i--) {\\n // Pick out the current node.\\n currentNode = _nodes[i - 1];\\n currentNodeType = _getNodeType(currentNode);\\n\\n if (currentNodeType == NodeType.LeafNode) {\\n // Leaf nodes are already correctly encoded.\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n } else if (currentNodeType == NodeType.ExtensionNode) {\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\\n }\\n } else if (currentNodeType == NodeType.BranchNode) {\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n uint8 branchKey = uint8(key[key.length - 1]);\\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\\n }\\n }\\n\\n // Compute the node hash for the next iteration.\\n previousNodeHash = _getNodeHash(currentNode.encoded);\\n }\\n\\n // Current node should be the root at this point.\\n // Simply return the hash of its encoding.\\n return keccak256(currentNode.encoded);\\n }\\n\\n /**\\n * @notice Parses an RLP-encoded proof into something more useful.\\n * @param _proof RLP-encoded proof to parse.\\n * @return _parsed Proof parsed into easily accessible structs.\\n */\\n function _parseProof(\\n bytes memory _proof\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _parsed\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\\n TrieNode[] memory proof = new TrieNode[](nodes.length);\\n\\n for (uint256 i = 0; i < nodes.length; i++) {\\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\\n proof[i] = TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n return proof;\\n }\\n\\n /**\\n * @notice Picks out the ID for a node. Node ID is referred to as the\\n * \\\"hash\\\" within the specification, but nodes < 32 bytes are not actually\\n * hashed.\\n * @param _node Node to pull an ID for.\\n * @return _nodeID ID for the node, depending on the size of its contents.\\n */\\n function _getNodeID(\\n Lib_RLPReader.RLPItem memory _node\\n )\\n private\\n pure\\n returns (\\n bytes32 _nodeID\\n )\\n {\\n bytes memory nodeID;\\n\\n if (_node.length < 32) {\\n // Nodes smaller than 32 bytes are RLP encoded.\\n nodeID = Lib_RLPReader.readRawBytes(_node);\\n } else {\\n // Nodes 32 bytes or larger are hashed.\\n nodeID = Lib_RLPReader.readBytes(_node);\\n }\\n\\n return Lib_BytesUtils.toBytes32(nodeID);\\n }\\n\\n /**\\n * @notice Gets the path for a leaf or extension node.\\n * @param _node Node to get a path for.\\n * @return _path Node path, converted to an array of nibbles.\\n */\\n function _getNodePath(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _path\\n )\\n {\\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\\n }\\n\\n /**\\n * @notice Gets the key for a leaf or extension node. Keys are essentially\\n * just paths without any prefix.\\n * @param _node Node to get a key for.\\n * @return _key Node key, converted to an array of nibbles.\\n */\\n function _getNodeKey(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _key\\n )\\n {\\n return _removeHexPrefix(_getNodePath(_node));\\n }\\n\\n /**\\n * @notice Gets the path for a node.\\n * @param _node Node to get a value for.\\n * @return _value Node value, as hex bytes.\\n */\\n function _getNodeValue(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _value\\n )\\n {\\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\\n }\\n\\n /**\\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\\n * are not hashed, all others are keccak256 hashed.\\n * @param _encoded Encoded node to hash.\\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\\n */\\n function _getNodeHash(\\n bytes memory _encoded\\n )\\n private\\n pure\\n returns (\\n bytes memory _hash\\n )\\n {\\n if (_encoded.length < 32) {\\n return _encoded;\\n } else {\\n return abi.encodePacked(keccak256(_encoded));\\n }\\n }\\n\\n /**\\n * @notice Determines the type for a given node.\\n * @param _node Node to determine a type for.\\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\\n */\\n function _getNodeType(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n NodeType _type\\n )\\n {\\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\\n return NodeType.BranchNode;\\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(_node);\\n uint8 prefix = uint8(path[0]);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n return NodeType.LeafNode;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n return NodeType.ExtensionNode;\\n }\\n }\\n\\n revert(\\\"Invalid node type\\\");\\n }\\n\\n /**\\n * @notice Utility; determines the number of nibbles shared between two\\n * nibble arrays.\\n * @param _a First nibble array.\\n * @param _b Second nibble array.\\n * @return _shared Number of shared nibbles.\\n */\\n function _getSharedNibbleLength(\\n bytes memory _a,\\n bytes memory _b\\n )\\n private\\n pure\\n returns (\\n uint256 _shared\\n )\\n {\\n uint256 i = 0;\\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\\n i++;\\n }\\n return i;\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-encoded node into our nice struct.\\n * @param _raw RLP-encoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n bytes[] memory _raw\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\\n\\n return TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-decoded node into our nice struct.\\n * @param _items RLP-decoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n Lib_RLPReader.RLPItem[] memory _items\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](_items.length);\\n for (uint256 i = 0; i < _items.length; i++) {\\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new extension node.\\n * @param _key Key for the extension node, unprefixed.\\n * @param _value Value for the extension node.\\n * @return _node New extension node with the given k/v pair.\\n */\\n function _makeExtensionNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new leaf node.\\n * @dev This function is essentially identical to `_makeExtensionNode`.\\n * Although we could route both to a single method with a flag, it's\\n * more gas efficient to keep them separate and duplicate the logic.\\n * @param _key Key for the leaf node, unprefixed.\\n * @param _value Value for the leaf node.\\n * @return _node New leaf node with the given k/v pair.\\n */\\n function _makeLeafNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, true);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates an empty branch node.\\n * @return _node Empty branch node as a TrieNode struct.\\n */\\n function _makeEmptyBranchNode()\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\\n for (uint256 i = 0; i < raw.length; i++) {\\n raw[i] = RLP_NULL_BYTES;\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Modifies the value slot for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _value Value to insert into the branch.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchValue(\\n TrieNode memory _branch,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Modifies a slot at an index for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _index Slot index to modify.\\n * @param _value Value to insert into the slot.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchIndex(\\n TrieNode memory _branch,\\n uint8 _index,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Utility; adds a prefix to a key.\\n * @param _key Key to prefix.\\n * @param _isLeaf Whether or not the key belongs to a leaf.\\n * @return _prefixedKey Prefixed key.\\n */\\n function _addHexPrefix(\\n bytes memory _key,\\n bool _isLeaf\\n )\\n private\\n pure\\n returns (\\n bytes memory _prefixedKey\\n )\\n {\\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\\n uint8 offset = uint8(_key.length % 2);\\n bytes memory prefixed = new bytes(2 - offset);\\n prefixed[0] = bytes1(prefix + offset);\\n return Lib_BytesUtils.concat(prefixed, _key);\\n }\\n\\n /**\\n * @notice Utility; removes a prefix from a path.\\n * @param _path Path to remove the prefix from.\\n * @return _unprefixedKey Unprefixed key.\\n */\\n function _removeHexPrefix(\\n bytes memory _path\\n )\\n private\\n pure\\n returns (\\n bytes memory _unprefixedKey\\n )\\n {\\n if (uint8(_path[0]) % 2 == 0) {\\n return Lib_BytesUtils.slice(_path, 2);\\n } else {\\n return Lib_BytesUtils.slice(_path, 1);\\n }\\n }\\n\\n /**\\n * @notice Utility; combines two node arrays. Array lengths are required\\n * because the actual lengths may be longer than the filled lengths.\\n * Array resizing is extremely costly and should be avoided.\\n * @param _a First array to join.\\n * @param _aLength Length of the first array.\\n * @param _b Second array to join.\\n * @param _bLength Length of the second array.\\n * @return _joined Combined node array.\\n */\\n function _joinNodeArrays(\\n TrieNode[] memory _a,\\n uint256 _aLength,\\n TrieNode[] memory _b,\\n uint256 _bLength\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _joined\\n )\\n {\\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\\n\\n // Copy elements from the first array.\\n for (uint256 i = 0; i < _aLength; i++) {\\n ret[i] = _a[i];\\n }\\n\\n // Copy elements from the second array.\\n for (uint256 i = 0; i < _bLength; i++) {\\n ret[i + _aLength] = _b[i];\\n }\\n\\n return ret;\\n }\\n}\\n\",\"keccak256\":\"0x86fecc050ffc298ac364d118e65ce8ef2418749cbef1ad0d4dce2ca8a0d15ace\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_MerkleTrie } from \\\"./Lib_MerkleTrie.sol\\\";\\n\\n/**\\n * @title Lib_SecureMerkleTrie\\n */\\nlibrary Lib_SecureMerkleTrie {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.get(key, _proof, _root);\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Computes the secure counterpart to a key.\\n * @param _key Key to get a secure key from.\\n * @return _secureKey Secure version of the key.\\n */\\n function _getSecureKey(\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes memory _secureKey\\n )\\n {\\n return abi.encodePacked(keccak256(_key));\\n }\\n}\",\"keccak256\":\"0x79355346f74bb1eb9eeb733cb5d9677d50115c4f390307cbf608fe071a1ada0c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516147cb3803806147cb8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614766806100656000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806322d147021461003b578063461a44781461008f575b600080fd5b6100736004803603608081101561005157600080fd5b506001600160a01b038135169060208101359060408101359060600135610135565b604080516001600160a01b039092168252519081900360200190f35b610073600480360360208110156100a557600080fd5b8101906020810181356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610216945050505050565b60006101696040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610216565b6001600160a01b0316336001600160a01b0316146101b85760405162461bcd60e51b81526004018080602001828103825260318152602001806147006031913960400191505060405180910390fd5b848484846040516101c8906102f2565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561020c573d6000803e3d6000fd5b5095945050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561027657818101518382015260200161025e565b50505050905090810190601f1680156102a35780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d60208110156102ea57600080fd5b505192915050565b614400806103008339019056fe60806040523480156200001157600080fd5b506040516200440038038062004400833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61412a80620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a244316a11610071578063a244316a14610145578063b1c9fe6e1461014d578063b2fa1c9e14610162578063b528057114610177578063b91943101461017f578063c1c618b814610192576100b4565b80632e1ac36c146100b95780632eb13758146100ce578063461a4478146100e1578063732f960b1461010a578063805e9d301461011d578063845fe7a314610132575b600080fd5b6100cc6100c73660046137bd565b61019a565b005b6100cc6100dc3660046137fd565b610533565b6100f46100ef36600461387c565b61086f565b6040516101019190613ac9565b60405180910390f35b6100cc610118366004613940565b61094d565b610125610bb5565b6040516101019190613a51565b6100cc6101403660046137bd565b610bbb565b6100cc610ee7565b61015561106e565b6040516101019190613b7b565b61016a611077565b6040516101019190613b70565b6100f4611092565b6100cc61018d36600461375e565b6110a1565b6101256113bb565b60018060045460ff1660028111156101ae57fe5b146101d45760405162461bcd60e51b81526004016101cb90613ecc565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610210908a908a90600401613add565b602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610262919061384a565b15156001146102835760405162461bcd60e51b81526004016101cb90613c77565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102b4908b90600401613ac9565b60c06040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906138c1565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061033c908c908c90600401613add565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190613864565b90506103cd886040516020016103a29190613a51565b6040516020818303038152906040526103c26103bd846113c1565b61140a565b89856040015161145c565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610407908c908690600401613b17565b600060405180830381600087803b15801561042157600080fd5b505af1158015610435573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161046a929190613add565b60405180910390a1505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561054757fe5b146105645760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105bd57600080fd5b505afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190613864565b156106125760405162461bcd60e51b81526004016101cb90613d58565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610642908990600401613ac9565b602060405180830381600087803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610694919061384a565b15156001146106b55760405162461bcd60e51b81526004016101cb90613e12565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906106e6908a90600401613ac9565b60c06040518083038186803b1580156106fe57600080fd5b505afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073691906138c1565b90506107758760405160200161074c9190613a34565b60405160208183030381529060405261076c61076784611482565b6114c2565b8860035461145c565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107a8908990613ac9565b60405180910390a15060005a820390506107e86040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156108cf5781810151838201526020016108b7565b50505050905090810190601f1680156108fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561091957600080fd5b505afa15801561092d573d6000803e3d6000fd5b505050506040513d602081101561094357600080fd5b505190505b919050565b60008060045460ff16600281111561096157fe5b1461097e5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600654610995866115cb565b146109b25760405162461bcd60e51b81526004016101cb90613f1d565b6103e88560a0015161040802816109c557fe5b04620186a0015a10156109ea5760405162461bcd60e51b81526004016101cb90613db5565b6000610a216040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b81525061086f565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a52908490600401613ac9565b600060405180830381600087803b158015610a6c57600080fd5b505af1158015610a80573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ab7928b92911690600401613fb1565b600060405180830381600087803b158015610ad157600080fd5b505af1158015610ae5573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610b2f6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610bcf57fe5b14610bec5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610c28908a908a90600401613add565b60206040518083038186803b158015610c4057600080fd5b505afa158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c78919061384a565b15610c955760405162461bcd60e51b81526004016101cb90613b8f565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610cc5908a90600401613ac9565b60206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061384a565b1515600114610d365760405162461bcd60e51b81526004016101cb90613f54565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610d67908b90600401613ac9565b60206040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190613864565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610deb57506000610e48565b600080610e188a604051602001610e029190613a51565b6040516020818303038152906040528a866115e4565b909250905060018215151415610e4057610e39610e348261160d565b611620565b9250610e45565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610e7c908c908c908690600401613af6565b600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60018060045460ff166002811115610efb57fe5b14610f185760405162461bcd60e51b81526004016101cb90613ecc565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6657600080fd5b505afa158015610f7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9e9190613864565b15610fbb5760405162461bcd60e51b81526004016101cb90613c1a565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b15801561100957600080fd5b505afa15801561101d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110419190613864565b1561105e5760405162461bcd60e51b81526004016101cb90613e6f565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561108c57fe5b14905090565b6001546001600160a01b031681565b60008060045460ff1660028111156110b557fe5b146110d25760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf9061110c908a90600401613ac9565b60206040518083038186803b15801561112457600080fd5b505afa158015611138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115c919061384a565b1580156111e657506001546040516307a1294560e01b81526001600160a01b03909116906307a1294590611194908a90600401613ac9565b60206040518083038186803b1580156111ac57600080fd5b505afa1580156111c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e4919061384a565b155b6112025760405162461bcd60e51b81526004016101cb90613bd4565b600080611231896040516020016112199190613a34565b604051602081830303815290604052886002546115e4565b90925090506001821515141561135257600061124c8261164f565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701415611285575060006112b0565b8160600151611293826116e1565b146112b05760405162461bcd60e51b81526004016101cb90613cd5565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b964791611319918f91600401613b17565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505050611382565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610e7c908c90600401613ac9565b505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60035490565b6060806000805b6020811085821a1516156113e257600191820191016113c8565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b60608082516001148015611432575060808360008151811061142857fe5b016020015160f81c105b1561143e575081611456565b61145361144d845160806116e5565b84611835565b90505b92915050565b600080611468866118b2565b9050611476818686866118e2565b9150505b949350505050565b61148a613669565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816114de5750508351909150611504906103bd906113c1565b8160008151811061151157fe5b602002602001018190525061152f6103bd846020015160001b6113c1565b8160018151811061153c57fe5b6020026020010181905250611573836040015160405160200161155f9190613a51565b60405160208183030381529060405261140a565b8160028151811061158057fe5b60200260200101819052506115a3836060015160405160200161155f9190613a51565b816003815181106115b057fe5b60200260200101819052506115c48161197d565b9392505050565b60006115d6826119a1565b805190602001209050919050565b6000606060006115f3866118b2565b90506116008186866119dc565b9250925050935093915050565b606061145661161b83611aaf565b611ad4565b6000806000602084511115611636576020611639565b83515b6020858101519190036008021c92505050919050565b611657613669565b600061166283611b63565b9050604051806080016040528061168c8360008151811061167f57fe5b6020026020010151611b76565b81526020016116a18360018151811061167f57fe5b81526020016116c3836002815181106116b657fe5b6020026020010151611b7d565b81526020016116d8836003815181106116b657fe5b90529392505050565b3f90565b606080603884101561173f576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061172357fe5b60200101906001600160f81b031916908160001a905350611453565b600060015b80868161174d57fe5b04156117625760019091019061010002611744565b816001016001600160401b038111801561177b57600080fd5b506040519080825280601f01601f1916602001820160405280156117a6576020820181803683370190505b50925084820160370160f81b836000815181106117bf57fe5b60200101906001600160f81b031916908160001a905350600190505b81811161182b576101008183036101000a87816117f457fe5b04816117fc57fe5b0660f81b83828151811061180c57fe5b60200101906001600160f81b031916908160001a9053506001016117db565b5050905092915050565b6060806040519050835180825260208201818101602087015b8183101561186657805183526020928301920161184e565b50855184518101855292509050808201602086015b8183101561189357805183526020928301920161187b565b508651929092011591909101601f01601f191660405250905092915050565b606081805190602001206040516020016118cc9190613a51565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218214156119365761192f8585611c77565b905061147a565b600061194184611c9b565b9050600080611951838987611d71565b509150915060006119648484848b612114565b9050611970818a61242c565b9998505050505050505050565b6060600061198a83612585565b90506115c461199b825160c06116e5565b82611835565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016118cc9796959493929190613a5a565b6000606060006119eb85611c9b565b905060008060006119fd848a89611d71565b81519295509093509150158080611a115750815b611a62576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611a7e5760405180602001604052806000815250611a9d565b611a9d866001870381518110611a9057fe5b602002602001015161268e565b919b919a509098505050505050505050565b611ab7613690565b506040805180820190915281518152602082810190820152919050565b60606000806000611ae4856126aa565b919450925090506000816001811115611af957fe5b14611b4b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611b5a856020015184846129d3565b95945050505050565b6060611456611b7183611aaf565b612a80565b6000611456825b6000602182600001511115611bd9576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611be7856126aa565b919450925090506000816001811115611bfc57fe5b14611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611c6d5760208490036101000a90045b9695505050505050565b6000611c8b611c8584612bf6565b83612cf2565b5180516020909101209392505050565b60606000611ca883611b63565b9050600081516001600160401b0381118015611cc357600080fd5b50604051908082528060200260200182016040528015611cfd57816020015b611cea6136aa565b815260200190600190039081611ce25790505b50905060005b8251811015611d69576000611d2a848381518110611d1d57fe5b6020026020010151611ad4565b90506040518060400160405280828152602001611d4683611b63565b815250838381518110611d5557fe5b602090810291909101015250600101611d03565b509392505050565b60006060818080611d8187612bf6565b905085600080611d8f6136aa565b60005b8c518110156120ec578c8181518110611da757fe5b6020026020010151915082840193506001870196508360001415611e1b57815180516020909101208514611e16576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611ee2565b815151602011611e8257815180516020909101208514611e16576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611e908360000151612d86565b14611ee2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611f51578551841415611efe576120ec565b6000868581518110611f0c57fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611f3157fe5b60200260200101519050611f4481612db2565b96506001945050506120e4565b60028260200151511415612097576000611f6a83612de8565b9050600081600081518110611f7b57fe5b016020015160f81c9050600181166002036000611f9b8460ff8416612e06565b90506000611fa98b8a612e06565b90506000611fb78383612e37565b905060ff851660021480611fce575060ff85166003145b1561200057808351148015611fe35750808251145b15611fed57988901985b50600160ff1b99506120ec945050505050565b60ff85161580612013575060ff85166001145b1561206057806120305750600160ff1b99506120ec945050505050565b612051886020015160018151811061204457fe5b6020026020010151612db2565b9a5097506120e4945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806140cf6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611d92565b50600160ff1b8414866120ff8786612e06565b909e909d50909b509950505050505050505050565b60606000839050600086600187038151811061212c57fe5b60200260200101519050600061214182612e9d565b6040805160038082526080820190925291925060009190816020015b6121656136aa565b81526020019060019003908161215d5790505090506000845160001480156121985750600283600281111561219657fe5b145b156121ce576121af6121a985612f73565b88612cf2565b8282815181106121bb57fe5b602090810291909101015260010161240f565b60008360028111156121dc57fe5b1415612242578451612211576121f28488612f86565b8282815181106121fe57fe5b602090810291909101015260010161223d565b8382828151811061221e57fe5b60200260200101819052506001810190506121af6121a9866001612e06565b61240f565b600061224d85612f73565b9050600061225b8288612e37565b905080156122bc57600061227183600084612fd1565b9050612285816122808c613121565b613162565b85858151811061229157fe5b60200260200101819052506001840193506122ac8383612e06565b92506122b88883612e06565b9750505b60006122c66131a6565b90508251600014156122eb576122e4816122df8961268e565b612f86565b9050612383565b6000836000815181106122fa57fe5b016020015160f81c905061230f846001612e06565b9350600287600281111561231f57fe5b141561235a576000612339856123348b61268e565b612cf2565b9050612352838361234d8460000151613121565b613233565b925050612381565b835115612370576000612339856122808b61268e565b61237e828261234d8b61268e565b91505b505b87516123b857612393818b612f86565b9050808585815181106123a257fe5b602002602001018190525060018401935061240b565b6123c3886001612e06565b9750808585815181106123d257fe5b60200260200101819052506001840193506123ed888b612cf2565b8585815181106123f957fe5b60200260200101819052506001840193505b5050505b61241e8a60018b03848461328c565b9a9950505050505050505050565b60008061243883612bf6565b90506124426136aa565b84516000906060905b80156125705787600182038151811061246057fe5b6020026020010151935061247384612e9d565b9250600283600281111561248357fe5b14156124ae57600061249485612f73565b90506124a68660008351895103612fd1565b95505061255a565b60018360028111156124bc57fe5b14156124fc5760006124cd85612f73565b90506124df8660008351895103612fd1565b8351909650156124f6576124f38184613162565b94505b5061255a565b600083600281111561250a57fe5b141561255a5781511561255a5760008560018751038151811061252957fe5b602001015160f81c60f81b60f81c90506125498660006001895103612fd1565b9550612556858285613233565b9450505b835161256590613121565b91506000190161244b565b50509051805160209091012095945050505050565b60608151600014156125a65750604080516000815260208101909152610948565b6000805b83518110156125d9578381815181106125bf57fe5b6020026020010151518201915080806001019150506125aa565b6000826001600160401b03811180156125f157600080fd5b506040519080825280601f01601f19166020018201604052801561261c576020820181803683370190505b50600092509050602081015b855183101561268557600086848151811061263f57fe5b60200260200101519050600060208201905061265d8382845161336e565b87858151811061266957fe5b6020026020010151518301925050508280600101935050612628565b50949350505050565b60208101518051606091611456916000198101908110611d1d57fe5b600080600080846000015111612707576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161272c5760006001600094509450945050506129cc565b60b781116127a1578551607f19820190811061278f576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506129cc915050565b60bf811161288557855160b6198201908110612804576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612870576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506129cc915050565b60f781116128f957855160bf1982019081106128e8576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506129cc915050565b855160f6198201908110612954576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129b9576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506129cc915050565b9193909250565b60606000826001600160401b03811180156129ed57600080fd5b506040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b509050805160001415612a2c5790506115c4565b8484016020820160005b60208604811015612a57578251825260209283019290910190600101612a36565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612a8e846126aa565b91935090915060019050816001811115612aa457fe5b14612af6576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b17613690565b815260200190600190039081612b0f5790505090506000835b8651811015612beb5760208210612b785760405162461bcd60e51b815260040180806020018281038252602a8152602001806140a5602a913960400191505060405180910390fd5b600080612ba46040518060400160405280858c60000151038152602001858c60200151018152506126aa565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612bd257fe5b6020908102919091010152600193909301920101612b30565b508152949350505050565b6060600082516002026001600160401b0381118015612c1457600080fd5b506040519080825280601f01601f191660200182016040528015612c3f576020820181803683370190505b50905060005b8351811015612ceb576004848281518110612c5c57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612c8257fe5b60200101906001600160f81b031916908160001a9053506010848281518110612ca757fe5b016020015160f81c81612cb657fe5b0660f81b828260020260010181518110612ccc57fe5b60200101906001600160f81b031916908160001a905350600101612c45565b5092915050565b612cfa6136aa565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d125790505090506000612d368560016133b2565b9050612d446103bd82613457565b82600081518110612d5157fe5b6020026020010181905250612d658461140a565b82600181518110612d7257fe5b6020026020010181905250611b5a82613527565b6000602082511015612d9d57506020810151610948565b81806020019051602081101561094357600080fd5b60006060602083600001511015612dd357612dcc83613556565b9050612ddf565b612ddc83611ad4565b90505b6115c481612d86565b6060611456612e018360200151600081518110611d1d57fe5b612bf6565b60608183510360001415612e295750604080516020810190915260008152611456565b611453838384865103612fd1565b6000805b808451118015612e4b5750808351115b8015612e905750828181518110612e5e57fe5b602001015160f81c60f81b6001600160f81b031916848281518110612e7f57fe5b01602001516001600160f81b031916145b1561145357600101612e3b565b60208101515160009060111415612eb657506000610948565b60028260200151511415612f32576000612ecf83612de8565b9050600081600081518110612ee057fe5b016020015160f81c90506002811480612efc575060ff81166003145b15612f0c57600292505050610948565b60ff81161580612f1f575060ff81166001145b15612f2f57600192505050610948565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611456612f8183612de8565b613561565b612f8e6136aa565b6000612f998361140a565b9050612fa481611aaf565b602085015180516000198101908110612fb957fe5b602002602001018190525061147a84602001516135aa565b60608182601f01101561301c576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015613064576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156130b0576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156130cf5760405191506000825260208201604052612685565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156131085780518352602092830192016130f0565b5050858452601f01601f19166040525050949350505050565b6060602082511015613134575080610948565b8180519060200120604051602001808281526020019150506040516020818303038152906040529050610948565b61316a6136aa565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131825790505090506000612d368560006133b2565b6131ae6136aa565b6040805160118082526102408201909252600091816020015b60608152602001906001900390816131c757905050905060005b815181101561322357604051806040016040528060018152602001600160ff1b81525082828151811061321057fe5b60209081029190910101526001016131e1565b5061322d81613527565b91505090565b61323b6136aa565b600060208351106132545761324f8361140a565b613256565b825b905061326181611aaf565b85602001518560ff168151811061327457fe5b6020026020010181905250611b5a85602001516135aa565b606060008285016001600160401b03811180156132a857600080fd5b506040519080825280602002602001820160405280156132e257816020015b6132cf6136aa565b8152602001906001900390816132c75790505b50905060005b85811015613323578681815181106132fc57fe5b602002602001015182828151811061331057fe5b60209081029190910101526001016132e8565b5060005b838110156133645784818151811061333b57fe5b6020026020010151828783018151811061335157fe5b6020908102919091010152600101613327565b5095945050505050565b8282825b60208110613391578151835260209283019290910190601f1901613372565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826133c25760006133c5565b60025b9050600060028551816133d457fe5b06905060008160020360ff166001600160401b03811180156133f557600080fd5b506040519080825280601f01601f191660200182016040528015613420576020820181803683370190505b50905081830160f81b8160008151811061343657fe5b60200101906001600160f81b031916908160001a905350611c6d8187611835565b60606000600283518161346657fe5b046001600160401b038111801561347c57600080fd5b506040519080825280601f01601f1916602001820160405280156134a7576020820181803683370190505b50905060005b8151811015612ceb578381600202600101815181106134c857fe5b602001015160f81c60f81b60048583600202815181106134e457fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061350857fe5b60200101906001600160f81b031916908160001a9053506001016134ad565b61352f6136aa565b600061353a8361197d565b905060405180604001604052808281526020016116d883611b63565b606061145682613653565b606060028260008151811061357257fe5b016020015160f81c8161358157fe5b0660ff166000141561359f57613598826002612e06565b9050610948565b613598826001612e06565b6135b26136aa565b600082516001600160401b03811180156135cb57600080fd5b506040519080825280602002602001820160405280156135ff57816020015b60608152602001906001900390816135ea5790505b50905060005b83518110156136495761362a84828151811061361d57fe5b6020026020010151613556565b82828151811061363657fe5b6020908102919091010152600101613605565b506115c481613527565b60606114568260200151600084600001516129d3565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006001600160401b038311156136d757fe5b6136ea601f8401601f1916602001614039565b90508281528383830111156136fe57600080fd5b828260208301376000602084830101529392505050565b80356109488161408c565b8051801515811461094857600080fd5b600082601f830112613740578081fd5b611453838335602085016136c4565b80356002811061094857600080fd5b600080600060608486031215613772578283fd5b833561377d8161408c565b9250602084013561378d8161408c565b915060408401356001600160401b038111156137a7578182fd5b6137b386828701613730565b9150509250925092565b6000806000606084860312156137d1578283fd5b83356137dc8161408c565b92506020840135915060408401356001600160401b038111156137a7578182fd5b6000806040838503121561380f578182fd5b823561381a8161408c565b915060208301356001600160401b03811115613834578182fd5b61384085828601613730565b9150509250929050565b60006020828403121561385b578081fd5b61145382613720565b600060208284031215613875578081fd5b5051919050565b60006020828403121561388d578081fd5b81356001600160401b038111156138a2578182fd5b8201601f810184136138b2578182fd5b61147a848235602084016136c4565b600060c082840312156138d2578081fd5b60405160c081018181106001600160401b03821117156138ee57fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516139238161408c565b608082015261393460a08401613720565b60a08201529392505050565b600060208284031215613951578081fd5b81356001600160401b0380821115613967578283fd5b9083019060e0828603121561397a578283fd5b61398460e0614039565b823581526020830135602082015261399e6040840161374f565b60408201526139af60608401613715565b60608201526139c060808401613715565b608082015260a083013560a082015260c0830135828111156139e0578485fd5b6139ec87828601613730565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613a2081602086016020860161405c565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b600088825287602083015260028710613a6f57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613ab681608985016020870161405c565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613b8957fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b6000604082528351604083015260208401516060830152604084015160028110613fd757fe5b60808381019190915260608501516001600160a01b031660a084015284015161400360c08401826139fb565b5060a084015160e083015260c084015160e0610100840152614029610120840182613a08565b9150506115c460208301846139fb565b6040518181016001600160401b038111828210171561405457fe5b604052919050565b60005b8381101561407757818101518382015260200161405f565b83811115614086576000848401525b50505050565b6001600160a01b03811681146140a157600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220585b3731ad3984ef3b77187738a1026bd3e69375837d244bb63400abe835349664736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212206be2efd743bb636f4d53c9776948c26451e831f9d5ad5bab4cd233ff773bfc0b64736f6c63430007060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806322d147021461003b578063461a44781461008f575b600080fd5b6100736004803603608081101561005157600080fd5b506001600160a01b038135169060208101359060408101359060600135610135565b604080516001600160a01b039092168252519081900360200190f35b610073600480360360208110156100a557600080fd5b8101906020810181356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610216945050505050565b60006101696040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610216565b6001600160a01b0316336001600160a01b0316146101b85760405162461bcd60e51b81526004018080602001828103825260318152602001806147006031913960400191505060405180910390fd5b848484846040516101c8906102f2565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561020c573d6000803e3d6000fd5b5095945050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561027657818101518382015260200161025e565b50505050905090810190601f1680156102a35780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d60208110156102ea57600080fd5b505192915050565b614400806103008339019056fe60806040523480156200001157600080fd5b506040516200440038038062004400833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61412a80620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a244316a11610071578063a244316a14610145578063b1c9fe6e1461014d578063b2fa1c9e14610162578063b528057114610177578063b91943101461017f578063c1c618b814610192576100b4565b80632e1ac36c146100b95780632eb13758146100ce578063461a4478146100e1578063732f960b1461010a578063805e9d301461011d578063845fe7a314610132575b600080fd5b6100cc6100c73660046137bd565b61019a565b005b6100cc6100dc3660046137fd565b610533565b6100f46100ef36600461387c565b61086f565b6040516101019190613ac9565b60405180910390f35b6100cc610118366004613940565b61094d565b610125610bb5565b6040516101019190613a51565b6100cc6101403660046137bd565b610bbb565b6100cc610ee7565b61015561106e565b6040516101019190613b7b565b61016a611077565b6040516101019190613b70565b6100f4611092565b6100cc61018d36600461375e565b6110a1565b6101256113bb565b60018060045460ff1660028111156101ae57fe5b146101d45760405162461bcd60e51b81526004016101cb90613ecc565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610210908a908a90600401613add565b602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610262919061384a565b15156001146102835760405162461bcd60e51b81526004016101cb90613c77565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102b4908b90600401613ac9565b60c06040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906138c1565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061033c908c908c90600401613add565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190613864565b90506103cd886040516020016103a29190613a51565b6040516020818303038152906040526103c26103bd846113c1565b61140a565b89856040015161145c565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610407908c908690600401613b17565b600060405180830381600087803b15801561042157600080fd5b505af1158015610435573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161046a929190613add565b60405180910390a1505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561054757fe5b146105645760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105bd57600080fd5b505afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190613864565b156106125760405162461bcd60e51b81526004016101cb90613d58565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610642908990600401613ac9565b602060405180830381600087803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610694919061384a565b15156001146106b55760405162461bcd60e51b81526004016101cb90613e12565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906106e6908a90600401613ac9565b60c06040518083038186803b1580156106fe57600080fd5b505afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073691906138c1565b90506107758760405160200161074c9190613a34565b60405160208183030381529060405261076c61076784611482565b6114c2565b8860035461145c565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107a8908990613ac9565b60405180910390a15060005a820390506107e86040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156108cf5781810151838201526020016108b7565b50505050905090810190601f1680156108fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561091957600080fd5b505afa15801561092d573d6000803e3d6000fd5b505050506040513d602081101561094357600080fd5b505190505b919050565b60008060045460ff16600281111561096157fe5b1461097e5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600654610995866115cb565b146109b25760405162461bcd60e51b81526004016101cb90613f1d565b6103e88560a0015161040802816109c557fe5b04620186a0015a10156109ea5760405162461bcd60e51b81526004016101cb90613db5565b6000610a216040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b81525061086f565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a52908490600401613ac9565b600060405180830381600087803b158015610a6c57600080fd5b505af1158015610a80573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ab7928b92911690600401613fb1565b600060405180830381600087803b158015610ad157600080fd5b505af1158015610ae5573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610b2f6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610bcf57fe5b14610bec5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610c28908a908a90600401613add565b60206040518083038186803b158015610c4057600080fd5b505afa158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c78919061384a565b15610c955760405162461bcd60e51b81526004016101cb90613b8f565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610cc5908a90600401613ac9565b60206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061384a565b1515600114610d365760405162461bcd60e51b81526004016101cb90613f54565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610d67908b90600401613ac9565b60206040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190613864565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610deb57506000610e48565b600080610e188a604051602001610e029190613a51565b6040516020818303038152906040528a866115e4565b909250905060018215151415610e4057610e39610e348261160d565b611620565b9250610e45565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610e7c908c908c908690600401613af6565b600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60018060045460ff166002811115610efb57fe5b14610f185760405162461bcd60e51b81526004016101cb90613ecc565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6657600080fd5b505afa158015610f7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9e9190613864565b15610fbb5760405162461bcd60e51b81526004016101cb90613c1a565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b15801561100957600080fd5b505afa15801561101d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110419190613864565b1561105e5760405162461bcd60e51b81526004016101cb90613e6f565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561108c57fe5b14905090565b6001546001600160a01b031681565b60008060045460ff1660028111156110b557fe5b146110d25760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf9061110c908a90600401613ac9565b60206040518083038186803b15801561112457600080fd5b505afa158015611138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115c919061384a565b1580156111e657506001546040516307a1294560e01b81526001600160a01b03909116906307a1294590611194908a90600401613ac9565b60206040518083038186803b1580156111ac57600080fd5b505afa1580156111c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e4919061384a565b155b6112025760405162461bcd60e51b81526004016101cb90613bd4565b600080611231896040516020016112199190613a34565b604051602081830303815290604052886002546115e4565b90925090506001821515141561135257600061124c8261164f565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701415611285575060006112b0565b8160600151611293826116e1565b146112b05760405162461bcd60e51b81526004016101cb90613cd5565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b964791611319918f91600401613b17565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505050611382565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610e7c908c90600401613ac9565b505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60035490565b6060806000805b6020811085821a1516156113e257600191820191016113c8565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b60608082516001148015611432575060808360008151811061142857fe5b016020015160f81c105b1561143e575081611456565b61145361144d845160806116e5565b84611835565b90505b92915050565b600080611468866118b2565b9050611476818686866118e2565b9150505b949350505050565b61148a613669565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816114de5750508351909150611504906103bd906113c1565b8160008151811061151157fe5b602002602001018190525061152f6103bd846020015160001b6113c1565b8160018151811061153c57fe5b6020026020010181905250611573836040015160405160200161155f9190613a51565b60405160208183030381529060405261140a565b8160028151811061158057fe5b60200260200101819052506115a3836060015160405160200161155f9190613a51565b816003815181106115b057fe5b60200260200101819052506115c48161197d565b9392505050565b60006115d6826119a1565b805190602001209050919050565b6000606060006115f3866118b2565b90506116008186866119dc565b9250925050935093915050565b606061145661161b83611aaf565b611ad4565b6000806000602084511115611636576020611639565b83515b6020858101519190036008021c92505050919050565b611657613669565b600061166283611b63565b9050604051806080016040528061168c8360008151811061167f57fe5b6020026020010151611b76565b81526020016116a18360018151811061167f57fe5b81526020016116c3836002815181106116b657fe5b6020026020010151611b7d565b81526020016116d8836003815181106116b657fe5b90529392505050565b3f90565b606080603884101561173f576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061172357fe5b60200101906001600160f81b031916908160001a905350611453565b600060015b80868161174d57fe5b04156117625760019091019061010002611744565b816001016001600160401b038111801561177b57600080fd5b506040519080825280601f01601f1916602001820160405280156117a6576020820181803683370190505b50925084820160370160f81b836000815181106117bf57fe5b60200101906001600160f81b031916908160001a905350600190505b81811161182b576101008183036101000a87816117f457fe5b04816117fc57fe5b0660f81b83828151811061180c57fe5b60200101906001600160f81b031916908160001a9053506001016117db565b5050905092915050565b6060806040519050835180825260208201818101602087015b8183101561186657805183526020928301920161184e565b50855184518101855292509050808201602086015b8183101561189357805183526020928301920161187b565b508651929092011591909101601f01601f191660405250905092915050565b606081805190602001206040516020016118cc9190613a51565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218214156119365761192f8585611c77565b905061147a565b600061194184611c9b565b9050600080611951838987611d71565b509150915060006119648484848b612114565b9050611970818a61242c565b9998505050505050505050565b6060600061198a83612585565b90506115c461199b825160c06116e5565b82611835565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016118cc9796959493929190613a5a565b6000606060006119eb85611c9b565b905060008060006119fd848a89611d71565b81519295509093509150158080611a115750815b611a62576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611a7e5760405180602001604052806000815250611a9d565b611a9d866001870381518110611a9057fe5b602002602001015161268e565b919b919a509098505050505050505050565b611ab7613690565b506040805180820190915281518152602082810190820152919050565b60606000806000611ae4856126aa565b919450925090506000816001811115611af957fe5b14611b4b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611b5a856020015184846129d3565b95945050505050565b6060611456611b7183611aaf565b612a80565b6000611456825b6000602182600001511115611bd9576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611be7856126aa565b919450925090506000816001811115611bfc57fe5b14611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611c6d5760208490036101000a90045b9695505050505050565b6000611c8b611c8584612bf6565b83612cf2565b5180516020909101209392505050565b60606000611ca883611b63565b9050600081516001600160401b0381118015611cc357600080fd5b50604051908082528060200260200182016040528015611cfd57816020015b611cea6136aa565b815260200190600190039081611ce25790505b50905060005b8251811015611d69576000611d2a848381518110611d1d57fe5b6020026020010151611ad4565b90506040518060400160405280828152602001611d4683611b63565b815250838381518110611d5557fe5b602090810291909101015250600101611d03565b509392505050565b60006060818080611d8187612bf6565b905085600080611d8f6136aa565b60005b8c518110156120ec578c8181518110611da757fe5b6020026020010151915082840193506001870196508360001415611e1b57815180516020909101208514611e16576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611ee2565b815151602011611e8257815180516020909101208514611e16576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611e908360000151612d86565b14611ee2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611f51578551841415611efe576120ec565b6000868581518110611f0c57fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611f3157fe5b60200260200101519050611f4481612db2565b96506001945050506120e4565b60028260200151511415612097576000611f6a83612de8565b9050600081600081518110611f7b57fe5b016020015160f81c9050600181166002036000611f9b8460ff8416612e06565b90506000611fa98b8a612e06565b90506000611fb78383612e37565b905060ff851660021480611fce575060ff85166003145b1561200057808351148015611fe35750808251145b15611fed57988901985b50600160ff1b99506120ec945050505050565b60ff85161580612013575060ff85166001145b1561206057806120305750600160ff1b99506120ec945050505050565b612051886020015160018151811061204457fe5b6020026020010151612db2565b9a5097506120e4945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806140cf6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611d92565b50600160ff1b8414866120ff8786612e06565b909e909d50909b509950505050505050505050565b60606000839050600086600187038151811061212c57fe5b60200260200101519050600061214182612e9d565b6040805160038082526080820190925291925060009190816020015b6121656136aa565b81526020019060019003908161215d5790505090506000845160001480156121985750600283600281111561219657fe5b145b156121ce576121af6121a985612f73565b88612cf2565b8282815181106121bb57fe5b602090810291909101015260010161240f565b60008360028111156121dc57fe5b1415612242578451612211576121f28488612f86565b8282815181106121fe57fe5b602090810291909101015260010161223d565b8382828151811061221e57fe5b60200260200101819052506001810190506121af6121a9866001612e06565b61240f565b600061224d85612f73565b9050600061225b8288612e37565b905080156122bc57600061227183600084612fd1565b9050612285816122808c613121565b613162565b85858151811061229157fe5b60200260200101819052506001840193506122ac8383612e06565b92506122b88883612e06565b9750505b60006122c66131a6565b90508251600014156122eb576122e4816122df8961268e565b612f86565b9050612383565b6000836000815181106122fa57fe5b016020015160f81c905061230f846001612e06565b9350600287600281111561231f57fe5b141561235a576000612339856123348b61268e565b612cf2565b9050612352838361234d8460000151613121565b613233565b925050612381565b835115612370576000612339856122808b61268e565b61237e828261234d8b61268e565b91505b505b87516123b857612393818b612f86565b9050808585815181106123a257fe5b602002602001018190525060018401935061240b565b6123c3886001612e06565b9750808585815181106123d257fe5b60200260200101819052506001840193506123ed888b612cf2565b8585815181106123f957fe5b60200260200101819052506001840193505b5050505b61241e8a60018b03848461328c565b9a9950505050505050505050565b60008061243883612bf6565b90506124426136aa565b84516000906060905b80156125705787600182038151811061246057fe5b6020026020010151935061247384612e9d565b9250600283600281111561248357fe5b14156124ae57600061249485612f73565b90506124a68660008351895103612fd1565b95505061255a565b60018360028111156124bc57fe5b14156124fc5760006124cd85612f73565b90506124df8660008351895103612fd1565b8351909650156124f6576124f38184613162565b94505b5061255a565b600083600281111561250a57fe5b141561255a5781511561255a5760008560018751038151811061252957fe5b602001015160f81c60f81b60f81c90506125498660006001895103612fd1565b9550612556858285613233565b9450505b835161256590613121565b91506000190161244b565b50509051805160209091012095945050505050565b60608151600014156125a65750604080516000815260208101909152610948565b6000805b83518110156125d9578381815181106125bf57fe5b6020026020010151518201915080806001019150506125aa565b6000826001600160401b03811180156125f157600080fd5b506040519080825280601f01601f19166020018201604052801561261c576020820181803683370190505b50600092509050602081015b855183101561268557600086848151811061263f57fe5b60200260200101519050600060208201905061265d8382845161336e565b87858151811061266957fe5b6020026020010151518301925050508280600101935050612628565b50949350505050565b60208101518051606091611456916000198101908110611d1d57fe5b600080600080846000015111612707576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161272c5760006001600094509450945050506129cc565b60b781116127a1578551607f19820190811061278f576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506129cc915050565b60bf811161288557855160b6198201908110612804576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612870576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506129cc915050565b60f781116128f957855160bf1982019081106128e8576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506129cc915050565b855160f6198201908110612954576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129b9576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506129cc915050565b9193909250565b60606000826001600160401b03811180156129ed57600080fd5b506040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b509050805160001415612a2c5790506115c4565b8484016020820160005b60208604811015612a57578251825260209283019290910190600101612a36565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612a8e846126aa565b91935090915060019050816001811115612aa457fe5b14612af6576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b17613690565b815260200190600190039081612b0f5790505090506000835b8651811015612beb5760208210612b785760405162461bcd60e51b815260040180806020018281038252602a8152602001806140a5602a913960400191505060405180910390fd5b600080612ba46040518060400160405280858c60000151038152602001858c60200151018152506126aa565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612bd257fe5b6020908102919091010152600193909301920101612b30565b508152949350505050565b6060600082516002026001600160401b0381118015612c1457600080fd5b506040519080825280601f01601f191660200182016040528015612c3f576020820181803683370190505b50905060005b8351811015612ceb576004848281518110612c5c57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612c8257fe5b60200101906001600160f81b031916908160001a9053506010848281518110612ca757fe5b016020015160f81c81612cb657fe5b0660f81b828260020260010181518110612ccc57fe5b60200101906001600160f81b031916908160001a905350600101612c45565b5092915050565b612cfa6136aa565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d125790505090506000612d368560016133b2565b9050612d446103bd82613457565b82600081518110612d5157fe5b6020026020010181905250612d658461140a565b82600181518110612d7257fe5b6020026020010181905250611b5a82613527565b6000602082511015612d9d57506020810151610948565b81806020019051602081101561094357600080fd5b60006060602083600001511015612dd357612dcc83613556565b9050612ddf565b612ddc83611ad4565b90505b6115c481612d86565b6060611456612e018360200151600081518110611d1d57fe5b612bf6565b60608183510360001415612e295750604080516020810190915260008152611456565b611453838384865103612fd1565b6000805b808451118015612e4b5750808351115b8015612e905750828181518110612e5e57fe5b602001015160f81c60f81b6001600160f81b031916848281518110612e7f57fe5b01602001516001600160f81b031916145b1561145357600101612e3b565b60208101515160009060111415612eb657506000610948565b60028260200151511415612f32576000612ecf83612de8565b9050600081600081518110612ee057fe5b016020015160f81c90506002811480612efc575060ff81166003145b15612f0c57600292505050610948565b60ff81161580612f1f575060ff81166001145b15612f2f57600192505050610948565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611456612f8183612de8565b613561565b612f8e6136aa565b6000612f998361140a565b9050612fa481611aaf565b602085015180516000198101908110612fb957fe5b602002602001018190525061147a84602001516135aa565b60608182601f01101561301c576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015613064576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156130b0576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156130cf5760405191506000825260208201604052612685565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156131085780518352602092830192016130f0565b5050858452601f01601f19166040525050949350505050565b6060602082511015613134575080610948565b8180519060200120604051602001808281526020019150506040516020818303038152906040529050610948565b61316a6136aa565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131825790505090506000612d368560006133b2565b6131ae6136aa565b6040805160118082526102408201909252600091816020015b60608152602001906001900390816131c757905050905060005b815181101561322357604051806040016040528060018152602001600160ff1b81525082828151811061321057fe5b60209081029190910101526001016131e1565b5061322d81613527565b91505090565b61323b6136aa565b600060208351106132545761324f8361140a565b613256565b825b905061326181611aaf565b85602001518560ff168151811061327457fe5b6020026020010181905250611b5a85602001516135aa565b606060008285016001600160401b03811180156132a857600080fd5b506040519080825280602002602001820160405280156132e257816020015b6132cf6136aa565b8152602001906001900390816132c75790505b50905060005b85811015613323578681815181106132fc57fe5b602002602001015182828151811061331057fe5b60209081029190910101526001016132e8565b5060005b838110156133645784818151811061333b57fe5b6020026020010151828783018151811061335157fe5b6020908102919091010152600101613327565b5095945050505050565b8282825b60208110613391578151835260209283019290910190601f1901613372565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826133c25760006133c5565b60025b9050600060028551816133d457fe5b06905060008160020360ff166001600160401b03811180156133f557600080fd5b506040519080825280601f01601f191660200182016040528015613420576020820181803683370190505b50905081830160f81b8160008151811061343657fe5b60200101906001600160f81b031916908160001a905350611c6d8187611835565b60606000600283518161346657fe5b046001600160401b038111801561347c57600080fd5b506040519080825280601f01601f1916602001820160405280156134a7576020820181803683370190505b50905060005b8151811015612ceb578381600202600101815181106134c857fe5b602001015160f81c60f81b60048583600202815181106134e457fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061350857fe5b60200101906001600160f81b031916908160001a9053506001016134ad565b61352f6136aa565b600061353a8361197d565b905060405180604001604052808281526020016116d883611b63565b606061145682613653565b606060028260008151811061357257fe5b016020015160f81c8161358157fe5b0660ff166000141561359f57613598826002612e06565b9050610948565b613598826001612e06565b6135b26136aa565b600082516001600160401b03811180156135cb57600080fd5b506040519080825280602002602001820160405280156135ff57816020015b60608152602001906001900390816135ea5790505b50905060005b83518110156136495761362a84828151811061361d57fe5b6020026020010151613556565b82828151811061363657fe5b6020908102919091010152600101613605565b506115c481613527565b60606114568260200151600084600001516129d3565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006001600160401b038311156136d757fe5b6136ea601f8401601f1916602001614039565b90508281528383830111156136fe57600080fd5b828260208301376000602084830101529392505050565b80356109488161408c565b8051801515811461094857600080fd5b600082601f830112613740578081fd5b611453838335602085016136c4565b80356002811061094857600080fd5b600080600060608486031215613772578283fd5b833561377d8161408c565b9250602084013561378d8161408c565b915060408401356001600160401b038111156137a7578182fd5b6137b386828701613730565b9150509250925092565b6000806000606084860312156137d1578283fd5b83356137dc8161408c565b92506020840135915060408401356001600160401b038111156137a7578182fd5b6000806040838503121561380f578182fd5b823561381a8161408c565b915060208301356001600160401b03811115613834578182fd5b61384085828601613730565b9150509250929050565b60006020828403121561385b578081fd5b61145382613720565b600060208284031215613875578081fd5b5051919050565b60006020828403121561388d578081fd5b81356001600160401b038111156138a2578182fd5b8201601f810184136138b2578182fd5b61147a848235602084016136c4565b600060c082840312156138d2578081fd5b60405160c081018181106001600160401b03821117156138ee57fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516139238161408c565b608082015261393460a08401613720565b60a08201529392505050565b600060208284031215613951578081fd5b81356001600160401b0380821115613967578283fd5b9083019060e0828603121561397a578283fd5b61398460e0614039565b823581526020830135602082015261399e6040840161374f565b60408201526139af60608401613715565b60608201526139c060808401613715565b608082015260a083013560a082015260c0830135828111156139e0578485fd5b6139ec87828601613730565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613a2081602086016020860161405c565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b600088825287602083015260028710613a6f57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613ab681608985016020870161405c565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613b8957fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b6000604082528351604083015260208401516060830152604084015160028110613fd757fe5b60808381019190915260608501516001600160a01b031660a084015284015161400360c08401826139fb565b5060a084015160e083015260c084015160e0610100840152614029610120840182613a08565b9150506115c460208301846139fb565b6040518181016001600160401b038111828210171561405457fe5b604052919050565b60005b8381101561407757818101518382015260200161405f565b83811115614086576000848401525b50505050565b6001600160a01b03811681146140a157600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220585b3731ad3984ef3b77187738a1026bd3e69375837d244bb63400abe835349664736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212206be2efd743bb636f4d53c9776948c26451e831f9d5ad5bab4cd233ff773bfc0b64736f6c63430007060033", + "devdoc": { + "details": "The State Transitioner Factory is used by the Fraud Verifier to create a new State Transitioner during the initialization of a fraud proof. Compiler used: solc Runtime target: EVM", + "kind": "dev", + "methods": { + "create(address,uint256,bytes32,bytes32)": { + "params": { + "_libAddressManager": "Address of the Address Manager.", + "_preStateRoot": "State root before the transition was executed.", + "_stateTransitionIndex": "Index of the state transition being verified.", + "_transactionHash": "Hash of the executed transaction." + }, + "returns": { + "_ovmStateTransitioner": "New OVM_StateTransitioner instance." + } + } + }, + "title": "OVM_StateTransitionerFactory", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "create(address,uint256,bytes32,bytes32)": { + "notice": "Creates a new OVM_StateTransitioner" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12337, + "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", + "label": "libAddressManager", + "offset": 0, + "slot": "0", + "type": "t_contract(Lib_AddressManager)12330" + } + ], + "types": { + "t_contract(Lib_AddressManager)12330": { + "encoding": "inplace", + "label": "contract Lib_AddressManager", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index d1508bf4b..33d977ad3 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "clean": "rm -rf ./artifacts ./build ./cache", "deploy": "hardhat deploy", + "verify": "hardhat etherscan-verify", "serve": "./bin/serve_dump.sh" }, "dependencies": { From 35514e262d6cd3e183022ad216c56bd74600e081 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 24 Feb 2021 17:19:03 -0800 Subject: [PATCH 03/41] Fix linting --- deploy/OVM_BondManager.deploy.ts | 4 ++-- deploy/OVM_CanonicalTransactionChain.deploy.ts | 4 ++-- deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts | 9 +++------ deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts | 9 +++------ deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts | 9 +++------ deploy/OVM_ExecutionManager.deploy.ts | 4 ++-- deploy/OVM_FraudVerifier.deploy.ts | 8 +++----- deploy/OVM_L1CrossDomainMessenger.deploy.ts | 4 ++-- deploy/OVM_L1MultiMessageRelayer.deploy.ts | 8 +++----- deploy/OVM_SafetyChecker.deploy.ts | 4 ++-- deploy/OVM_StateCommitmentChain.deploy.ts | 4 ++-- deploy/OVM_StateManagerFactory.deploy.ts | 4 ++-- deploy/OVM_StateTransitionerFactory.deploy.ts | 8 +++----- deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts | 9 +++------ hardhat.config.ts | 4 ++-- package.json | 2 +- 16 files changed, 38 insertions(+), 56 deletions(-) diff --git a/deploy/OVM_BondManager.deploy.ts b/deploy/OVM_BondManager.deploy.ts index fb003f6dd..522fba263 100644 --- a/deploy/OVM_BondManager.deploy.ts +++ b/deploy/OVM_BondManager.deploy.ts @@ -19,11 +19,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_BondManager', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_CanonicalTransactionChain.deploy.ts b/deploy/OVM_CanonicalTransactionChain.deploy.ts index 1cc7990d0..e24cb5507 100644 --- a/deploy/OVM_CanonicalTransactionChain.deploy.ts +++ b/deploy/OVM_CanonicalTransactionChain.deploy.ts @@ -21,11 +21,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_CanonicalTransactionChain', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts index eeb15cf81..2c02d8445 100644 --- a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -9,10 +9,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_ChainStorageContainer:CTC:batches', { contract: 'OVM_ChainStorageContainer', from: deployer, - args: [ - Lib_AddressManager.address, - 'OVM_CanonicalTransactionChain', - ], + args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], log: true, }) @@ -20,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_ChainStorageContainer:CTC:batches', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts index d45bec011..c79361c3f 100644 --- a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -9,10 +9,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_ChainStorageContainer:CTC:queue', { contract: 'OVM_ChainStorageContainer', from: deployer, - args: [ - Lib_AddressManager.address, - 'OVM_CanonicalTransactionChain', - ], + args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], log: true, }) @@ -20,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_ChainStorageContainer:CTC:queue', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts index 065cb42d9..33b387f3f 100644 --- a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -9,10 +9,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_ChainStorageContainer:SCC:batches', { contract: 'OVM_ChainStorageContainer', from: deployer, - args: [ - Lib_AddressManager.address, - 'OVM_StateCommitmentChain' - ], + args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'], log: true, }) @@ -20,11 +17,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_ChainStorageContainer:SCC:queue', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_ExecutionManager.deploy.ts b/deploy/OVM_ExecutionManager.deploy.ts index 8797bee99..a69dd5c32 100644 --- a/deploy/OVM_ExecutionManager.deploy.ts +++ b/deploy/OVM_ExecutionManager.deploy.ts @@ -27,11 +27,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_ChainStorageContainer:ctc:batches', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_FraudVerifier.deploy.ts b/deploy/OVM_FraudVerifier.deploy.ts index e95755fa4..108a24850 100644 --- a/deploy/OVM_FraudVerifier.deploy.ts +++ b/deploy/OVM_FraudVerifier.deploy.ts @@ -8,9 +8,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_FraudVerifier', { from: deployer, - args: [ - Lib_AddressManager.address, - ], + args: [Lib_AddressManager.address], log: true, }) @@ -18,11 +16,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_FraudVerifier', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_L1CrossDomainMessenger.deploy.ts b/deploy/OVM_L1CrossDomainMessenger.deploy.ts index 6565ae4f1..43f4b35e5 100644 --- a/deploy/OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/OVM_L1CrossDomainMessenger.deploy.ts @@ -14,11 +14,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_L1CrossDomainMessenger', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_L1MultiMessageRelayer.deploy.ts b/deploy/OVM_L1MultiMessageRelayer.deploy.ts index 16b87d853..c7fd04cea 100644 --- a/deploy/OVM_L1MultiMessageRelayer.deploy.ts +++ b/deploy/OVM_L1MultiMessageRelayer.deploy.ts @@ -8,9 +8,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_L1MultiMessageRelayer', { from: deployer, - args: [ - Lib_AddressManager.address, - ], + args: [Lib_AddressManager.address], log: true, }) @@ -18,11 +16,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_L1MultiMessageRelayer', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_SafetyChecker.deploy.ts b/deploy/OVM_SafetyChecker.deploy.ts index 0372475a2..9eee08c36 100644 --- a/deploy/OVM_SafetyChecker.deploy.ts +++ b/deploy/OVM_SafetyChecker.deploy.ts @@ -14,11 +14,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_SafetyChecker', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_StateCommitmentChain.deploy.ts b/deploy/OVM_StateCommitmentChain.deploy.ts index 5221fa118..f718af422 100644 --- a/deploy/OVM_StateCommitmentChain.deploy.ts +++ b/deploy/OVM_StateCommitmentChain.deploy.ts @@ -20,11 +20,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_StateCommitmentChain', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_StateManagerFactory.deploy.ts b/deploy/OVM_StateManagerFactory.deploy.ts index fe68907cf..8afe9d168 100644 --- a/deploy/OVM_StateManagerFactory.deploy.ts +++ b/deploy/OVM_StateManagerFactory.deploy.ts @@ -14,11 +14,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_StateManagerFactory', - contract.address, + contract.address ) } } diff --git a/deploy/OVM_StateTransitionerFactory.deploy.ts b/deploy/OVM_StateTransitionerFactory.deploy.ts index a65444526..c06132b91 100644 --- a/deploy/OVM_StateTransitionerFactory.deploy.ts +++ b/deploy/OVM_StateTransitionerFactory.deploy.ts @@ -8,9 +8,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('OVM_StateTransitionerFactory', { from: deployer, - args: [ - Lib_AddressManager.address, - ], + args: [Lib_AddressManager.address], log: true, }) @@ -18,11 +16,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'OVM_StateTransitionerFactory', - contract.address, + contract.address ) } } diff --git a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts index ab1ce1f05..6333f0663 100644 --- a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts @@ -8,10 +8,7 @@ const deployFn: DeployFunction = async (hre) => { const contract = await deploy('Lib_ResolvedDelegateProxy', { from: deployer, - args: [ - Lib_AddressManager.address, - 'OVM_L1CrossDomainMessenger' - ], + args: [Lib_AddressManager.address, 'OVM_L1CrossDomainMessenger'], log: true, }) @@ -19,11 +16,11 @@ const deployFn: DeployFunction = async (hre) => { await execute( 'Lib_AddressManager', { - from: deployer + from: deployer, }, 'setAddress', 'Proxy__OVM_L1CrossDomainMessenger', - contract.address, + contract.address ) } } diff --git a/hardhat.config.ts b/hardhat.config.ts index 7a4331d97..bcd694a68 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -23,12 +23,12 @@ const config: HardhatUserConfig = { tags: ['test', 'local'], }, kovan: { - url: "https://kovan.infura.io/v3/", + url: 'https://kovan.infura.io/v3/', accounts: [''], live: true, saveDeployments: true, tags: ['test', 'kovan'], - } + }, }, mocha: { timeout: 50000, diff --git a/package.json b/package.json index 33d977ad3..909af5e4c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "lint": "yarn run lint:typescript", "lint:typescript": "tslint --format stylish --project .", "lint:fix": "yarn run lint:fix:typescript", - "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", + "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy}/**/*.ts\"", "clean": "rm -rf ./artifacts ./build ./cache", "deploy": "hardhat deploy", "verify": "hardhat etherscan-verify", From 86826e14dd00d650e57de642ee30253b9d640f92 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 16:22:17 -0700 Subject: [PATCH 04/41] remove artifacts --- deployments/kovan/.chainId | 1 - deployments/kovan/Lib_AddressManager.json | 199 --- .../kovan/Lib_ResolvedDelegateProxy.json | 118 -- deployments/kovan/OVM_BondManager.json | 529 ------- .../kovan/OVM_CanonicalTransactionChain.json | 800 ----------- ...OVM_ChainStorageContainer:CTC:batches.json | 489 ------- .../OVM_ChainStorageContainer:CTC:queue.json | 489 ------- ...OVM_ChainStorageContainer:SCC:batches.json | 489 ------- deployments/kovan/OVM_ExecutionManager.json | 1246 ----------------- deployments/kovan/OVM_FraudVerifier.json | 552 -------- .../kovan/OVM_L1CrossDomainMessenger.json | 477 ------- .../kovan/OVM_L1MultiMessageRelayer.json | 205 --- deployments/kovan/OVM_SafetyChecker.json | 74 - .../kovan/OVM_StateCommitmentChain.json | 505 ------- .../kovan/OVM_StateManagerFactory.json | 74 - .../kovan/OVM_StateTransitionerFactory.json | 139 -- .../167e1592944606d9f946a16ee2ddffd3.json | 399 ------ 17 files changed, 6785 deletions(-) delete mode 100644 deployments/kovan/.chainId delete mode 100644 deployments/kovan/Lib_AddressManager.json delete mode 100644 deployments/kovan/Lib_ResolvedDelegateProxy.json delete mode 100644 deployments/kovan/OVM_BondManager.json delete mode 100644 deployments/kovan/OVM_CanonicalTransactionChain.json delete mode 100644 deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json delete mode 100644 deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json delete mode 100644 deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json delete mode 100644 deployments/kovan/OVM_ExecutionManager.json delete mode 100644 deployments/kovan/OVM_FraudVerifier.json delete mode 100644 deployments/kovan/OVM_L1CrossDomainMessenger.json delete mode 100644 deployments/kovan/OVM_L1MultiMessageRelayer.json delete mode 100644 deployments/kovan/OVM_SafetyChecker.json delete mode 100644 deployments/kovan/OVM_StateCommitmentChain.json delete mode 100644 deployments/kovan/OVM_StateManagerFactory.json delete mode 100644 deployments/kovan/OVM_StateTransitionerFactory.json delete mode 100644 deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json diff --git a/deployments/kovan/.chainId b/deployments/kovan/.chainId deleted file mode 100644 index f70d7bba4..000000000 --- a/deployments/kovan/.chainId +++ /dev/null @@ -1 +0,0 @@ -42 \ No newline at end of file diff --git a/deployments/kovan/Lib_AddressManager.json b/deployments/kovan/Lib_AddressManager.json deleted file mode 100644 index af56ec835..000000000 --- a/deployments/kovan/Lib_AddressManager.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "address": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "indexed": false, - "internalType": "address", - "name": "_newAddress", - "type": "address" - } - ], - "name": "AddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "address", - "name": "_address", - "type": "address" - } - ], - "name": "setAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "transactionIndex": 4, - "gasUsed": "412650", - "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000001000000000000000000000000000000000000020000000000000000000800000000000000020000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000400000000000080000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000080000000000000000000000", - "blockHash": "0xa2b4941db92d94093afe6dea21f51961f9029fd2eead1452dd8af1f3072f5c2f", - "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", - "logs": [ - { - "transactionIndex": 4, - "blockNumber": 23637091, - "transactionHash": "0x495525e1e824861d4944a2346e89373fe731f5a73def7af65cde699d38dcd5ed", - "address": "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "topics": [ - "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000003a953298098cadcb621a40c1efcfb7dd73b727af" - ], - "data": "0x", - "logIndex": 2, - "blockHash": "0xa2b4941db92d94093afe6dea21f51961f9029fd2eead1452dd8af1f3072f5c2f" - } - ], - "blockNumber": 23637091, - "cumulativeGasUsed": "687945", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newAddress\",\"type\":\"address\"}],\"name\":\"AddressSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"setAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Lib_AddressManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":\"Lib_AddressManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633178082556040516001600160a01b039190911691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3610614806100696000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102b0565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102bf9050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061040c945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661043b565b6000546001600160a01b03163314610266576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031681565b6000546001600160a01b0316331461031e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b7f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a180600160006103d68561053a565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b60006001600061041b8461053a565b81526020810191909152604001600020546001600160a01b031692915050565b6000546001600160a01b0316331461049a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104df5760405162461bcd60e51b815260040180806020018281038252602d8152602001806105b2602d913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816040516020018082805190602001908083835b6020831061056f5780518252601f199092019160209182019101610550565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e65722063616e6e6f7420626520746865207a65726f2061646472657373a264697066735822122095c5f4afd9a031cfa8d1d10d7d5bf3946b88905c7069f918a94beb35351bd59d64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b146100665780639b2ea4bd1461008a578063bf40fac11461013b578063f2fde38b146101e1575b600080fd5b610064610207565b005b61006e6102b0565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360408110156100a057600080fd5b8101906020810181356401000000008111156100bb57600080fd5b8201836020820111156100cd57600080fd5b803590602001918460018302840111640100000000831117156100ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505090356001600160a01b031691506102bf9050565b61006e6004803603602081101561015157600080fd5b81019060208101813564010000000081111561016c57600080fd5b82018360208201111561017e57600080fd5b803590602001918460018302840111640100000000831117156101a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061040c945050505050565b610064600480360360208110156101f757600080fd5b50356001600160a01b031661043b565b6000546001600160a01b03163314610266576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031681565b6000546001600160a01b0316331461031e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b7f188466739ff00cc68bfb2367d23ae4b855264264fe1624caa8884399af23454c82826040518080602001836001600160a01b03168152602001828103825284818151815260200191508051906020019080838360005b8381101561038d578181015183820152602001610375565b50505050905090810190601f1680156103ba5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a180600160006103d68561053a565b815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b60006001600061041b8461053a565b81526020810191909152604001600020546001600160a01b031692915050565b6000546001600160a01b0316331461049a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166104df5760405162461bcd60e51b815260040180806020018281038252602d8152602001806105b2602d913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816040516020018082805190602001908083835b6020831061056f5780518252601f199092019160209182019101610550565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905091905056fe4f776e61626c653a206e6577206f776e65722063616e6e6f7420626520746865207a65726f2061646472657373a264697066735822122095c5f4afd9a031cfa8d1d10d7d5bf3946b88905c7069f918a94beb35351bd59d64736f6c63430007060033", - "devdoc": { - "kind": "dev", - "methods": {}, - "title": "Lib_AddressManager", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12369, - "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", - "label": "owner", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12277, - "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol:Lib_AddressManager", - "label": "addresses", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_address)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_address)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => address)", - "numberOfBytes": "32", - "value": "t_address" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/Lib_ResolvedDelegateProxy.json b/deployments/kovan/Lib_ResolvedDelegateProxy.json deleted file mode 100644 index 566fdd741..000000000 --- a/deployments/kovan/Lib_ResolvedDelegateProxy.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "address": "0x8E41057ebbC501581dE5C3C73D38ef34Ca8422dD", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_implementationName", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "stateMutability": "nonpayable", - "type": "fallback" - } - ], - "transactionHash": "0x001bb76bb2c52fba9c599f3cb4993253f6f8aed5324ddc2764d892dcde96d2cb", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x8E41057ebbC501581dE5C3C73D38ef34Ca8422dD", - "transactionIndex": 2, - "gasUsed": "225652", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8f991a3cf39369752b6d61d7c02fb694e9eedb2aa50a60e1545f49b4bef87e80", - "transactionHash": "0x001bb76bb2c52fba9c599f3cb4993253f6f8aed5324ddc2764d892dcde96d2cb", - "logs": [], - "blockNumber": 23637150, - "cumulativeGasUsed": "300502", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "OVM_L1CrossDomainMessenger" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_implementationName\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_implementationName\":\"implementationName of the contract to proxy to.\",\"_libAddressManager\":\"Address of the Lib_AddressManager.\"}}},\"title\":\"Lib_ResolvedDelegateProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":\"Lib_ResolvedDelegateProxy\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_ResolvedDelegateProxy\\n */\\ncontract Lib_ResolvedDelegateProxy {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n\\n // Using mappings to store fields to avoid overwriting storage slots in the\\n // implementation contract. For example, instead of storing these fields at\\n // storage slot `0` & `1`, they are stored at `keccak256(key + slot)`.\\n // See: https://solidity.readthedocs.io/en/v0.7.0/internals/layout_in_storage.html\\n // NOTE: Do not use this code in your own contract system. \\n // There is a known flaw in this contract, and we will remove it from the repository\\n // in the near future. Due to the very limited way that we are using it, this flaw is\\n // not an issue in our system. \\n mapping(address=>string) private implementationName;\\n mapping(address=>Lib_AddressManager) private addressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n * @param _implementationName implementationName of the contract to proxy to.\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _implementationName\\n )\\n public\\n {\\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\\n implementationName[address(this)] = _implementationName;\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n address target = addressManager[address(this)].getAddress((implementationName[address(this)]));\\n require(\\n target != address(0),\\n \\\"Target address must be initialized.\\\"\\n );\\n\\n (bool success, bytes memory returndata) = target.delegatecall(msg.data);\\n\\n if (success == true) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b349c55f559e95b3e893321cc8603d1c4eb53c155023a8a4de329c48f30561c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516104173803806104178339818101604052604081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825164010000000081118282018810171561008957600080fd5b82525081516020918201929091019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b5060409081523060009081526001602090815282822080546001600160a01b0319166001600160a01b038a16179055818152919020855161012c95509093509085019150610134565b5050506101d5565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261016a57600085556101b0565b82601f1061018357805160ff19168380011785556101b0565b828001600101855582156101b0579182015b828111156101b0578251825591602001919060010190610195565b506101bc9291506101c0565b5090565b5b808211156101bc57600081556001016101c1565b610233806101e46000396000f3fe608060405234801561001057600080fd5b5030600090815260016020818152604080842054848352818520915163bf40fac160e01b815260048101938452825460026101009682161596909602600019011694909404602485018190526001600160a01b039091169363bf40fac19391829160440190849080156100c45780601f10610099576101008083540402835291602001916100c4565b820191906000526020600020905b8154815290600101906020018083116100a757829003601f168201915b50509250505060206040518083038186803b1580156100e257600080fd5b505afa1580156100f6573d6000803e3d6000fd5b505050506040513d602081101561010c57600080fd5b505190506001600160a01b0381166101555760405162461bcd60e51b81526004018080602001828103825260238152602001806101db6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101b4576040519150601f19603f3d011682016040523d82523d6000602084013e6101b9565b606091505b509092509050600182151514156101d257805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220fd3c10941281cebac2447ea154c74e2ae444a39652df5a90ac7eb30c6635b01a64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b5030600090815260016020818152604080842054848352818520915163bf40fac160e01b815260048101938452825460026101009682161596909602600019011694909404602485018190526001600160a01b039091169363bf40fac19391829160440190849080156100c45780601f10610099576101008083540402835291602001916100c4565b820191906000526020600020905b8154815290600101906020018083116100a757829003601f168201915b50509250505060206040518083038186803b1580156100e257600080fd5b505afa1580156100f6573d6000803e3d6000fd5b505050506040513d602081101561010c57600080fd5b505190506001600160a01b0381166101555760405162461bcd60e51b81526004018080602001828103825260238152602001806101db6023913960400191505060405180910390fd5b600080826001600160a01b03166000366040518083838082843760405192019450600093509091505080830381855af49150503d80600081146101b4576040519150601f19603f3d011682016040523d82523d6000602084013e6101b9565b606091505b509092509050600182151514156101d257805160208201f35b805160208201fdfe5461726765742061646472657373206d75737420626520696e697469616c697a65642ea2646970667358221220fd3c10941281cebac2447ea154c74e2ae444a39652df5a90ac7eb30c6635b01a64736f6c63430007060033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_implementationName": "implementationName of the contract to proxy to.", - "_libAddressManager": "Address of the Lib_AddressManager." - } - } - }, - "title": "Lib_ResolvedDelegateProxy", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12462, - "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", - "label": "implementationName", - "offset": 0, - "slot": "0", - "type": "t_mapping(t_address,t_string_storage)" - }, - { - "astId": 12466, - "contract": "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol:Lib_ResolvedDelegateProxy", - "label": "addressManager", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_contract(Lib_AddressManager)12330)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_contract(Lib_AddressManager)12330)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => contract Lib_AddressManager)", - "numberOfBytes": "32", - "value": "t_contract(Lib_AddressManager)12330" - }, - "t_mapping(t_address,t_string_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => string)", - "numberOfBytes": "32", - "value": "t_string_storage" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_BondManager.json b/deployments/kovan/OVM_BondManager.json deleted file mode 100644 index 131977266..000000000 --- a/deployments/kovan/OVM_BondManager.json +++ /dev/null @@ -1,529 +0,0 @@ -{ - "address": "0xEE7ff790277fF593282F3e4C2877966018788755", - "abi": [ - { - "inputs": [ - { - "internalType": "contract ERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bonds", - "outputs": [ - { - "internalType": "enum iOVM_BondManager.State", - "name": "state", - "type": "uint8" - }, - { - "internalType": "uint32", - "name": "withdrawalTimestamp", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "firstDisputeAt", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "earliestDisputedStateRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "earliestTimestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "who", - "type": "address" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "disputePeriodSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "publisher", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "finalize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "finalizeWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "preStateRoot", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "who", - "type": "address" - } - ], - "name": "getGasSpent", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "who", - "type": "address" - } - ], - "name": "isCollateralized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "multiFraudProofPeriod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_txHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "who", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasSpent", - "type": "uint256" - } - ], - "name": "recordGasSpent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requiredCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "startWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "witnessProviders", - "outputs": [ - { - "internalType": "bool", - "name": "canClaim", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x6bb948ad4d41530f9bde95dbc714a8e246a2985862b1ac1b5575ee30338d5015", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xEE7ff790277fF593282F3e4C2877966018788755", - "transactionIndex": 2, - "gasUsed": "1096239", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc2da57e6e305e720dc89808ed705d1af36f1c4e6d493eb044b429a56f8643c0a", - "transactionHash": "0x6bb948ad4d41530f9bde95dbc714a8e246a2985862b1ac1b5575ee30338d5015", - "logs": [], - "blockNumber": 23637093, - "cumulativeGasUsed": "2234758", - "status": 1, - "byzantium": true - }, - "args": [ - "0x0000000000000000000000000000000000000000", - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"enum iOVM_BondManager.State\",\"name\":\"state\",\"type\":\"uint8\"},{\"internalType\":\"uint32\",\"name\":\"withdrawalTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"firstDisputeAt\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"earliestDisputedStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"earliestTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disputePeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"publisher\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"finalize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizeWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"getGasSpent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"}],\"name\":\"isCollateralized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"multiFraudProofPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasSpent\",\"type\":\"uint256\"}],\"name\":\"recordGasSpent\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"requiredCollateral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract ERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"witnessProviders\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canClaim\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Bond Manager contract handles deposits in the form of an ERC20 token from bonded Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, and the Verifier's gas costs are refunded. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{},\"title\":\"OVM_BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bonds(address)\":{\"notice\":\"The bonds posted by each proposer\"},\"claim(address)\":{\"notice\":\"Claims the user's reward for the witnesses they provided for the earliest disputed state root of the designated publisher\"},\"constructor\":{\"notice\":\"Initializes with a ERC20 token to be used for the fidelity bonds and with the Address Manager\"},\"deposit()\":{\"notice\":\"Sequencers call this function to post collateral which will be used for the `appendBatch` call\"},\"disputePeriodSeconds()\":{\"notice\":\"The dispute period\"},\"finalize(bytes32,address,uint256)\":{\"notice\":\"Slashes + distributes rewards or frees up the sequencer's bond, only called by `FraudVerifier.finalizeFraudVerification`\"},\"finalizeWithdrawal()\":{\"notice\":\"Finalizes a pending withdrawal from a publisher\"},\"getGasSpent(bytes32,address)\":{\"notice\":\"Gets how many witnesses the user has provided for the state root\"},\"isCollateralized(address)\":{\"notice\":\"Checks if the user is collateralized\"},\"multiFraudProofPeriod()\":{\"notice\":\"The period to find the earliest fraud proof for a publisher\"},\"recordGasSpent(bytes32,bytes32,address,uint256)\":{\"notice\":\"Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\"},\"requiredCollateral()\":{\"notice\":\"The minimum collateral a sequencer must post\"},\"startWithdrawal()\":{\"notice\":\"Starts the withdrawal for a publisher\"},\"token()\":{\"notice\":\"The bond token\"},\"witnessProviders(bytes32)\":{\"notice\":\"For each pre-state root, there's an array of witnessProviders that must be rewarded for posting witnesses\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":\"OVM_BondManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_BondManager, Errors, ERC20 } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\n\\n/**\\n * @title OVM_BondManager\\n * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded \\n * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a\\n * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, \\n * and the Verifier's gas costs are refunded.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\\n\\n /****************************\\n * Constants and Parameters *\\n ****************************/\\n\\n /// The period to find the earliest fraud proof for a publisher\\n uint256 public constant multiFraudProofPeriod = 7 days;\\n\\n /// The dispute period\\n uint256 public constant disputePeriodSeconds = 7 days;\\n\\n /// The minimum collateral a sequencer must post\\n uint256 public constant requiredCollateral = 1 ether;\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n /// The bond token\\n ERC20 immutable public token;\\n\\n\\n /********************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n /// The bonds posted by each proposer\\n mapping(address => Bond) public bonds;\\n\\n /// For each pre-state root, there's an array of witnessProviders that must be rewarded\\n /// for posting witnesses\\n mapping(bytes32 => Rewards) public witnessProviders;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /// Initializes with a ERC20 token to be used for the fidelity bonds\\n /// and with the Address Manager\\n constructor(\\n ERC20 _token,\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n token = _token;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\\n function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public {\\n // The sender must be the transitioner that corresponds to the claimed pre-state root\\n address transitioner = address(iOVM_FraudVerifier(resolve(\\\"OVM_FraudVerifier\\\")).getStateTransitioner(_preStateRoot, _txHash));\\n require(transitioner == msg.sender, Errors.ONLY_TRANSITIONER);\\n\\n witnessProviders[_preStateRoot].total += gasSpent;\\n witnessProviders[_preStateRoot].gasSpent[who] += gasSpent;\\n }\\n\\n /// Slashes + distributes rewards or frees up the sequencer's bond, only called by\\n /// `FraudVerifier.finalizeFraudVerification`\\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {\\n require(msg.sender == resolve(\\\"OVM_FraudVerifier\\\"), Errors.ONLY_FRAUD_VERIFIER);\\n require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);\\n\\n // allow users to claim from that state root's\\n // pool of collateral (effectively slashing the sequencer)\\n witnessProviders[_preStateRoot].canClaim = true;\\n\\n Bond storage bond = bonds[publisher];\\n if (bond.firstDisputeAt == 0) {\\n bond.firstDisputeAt = block.timestamp;\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n } else if (\\n // only update the disputed state root for the publisher if it's within\\n // the dispute period _and_ if it's before the previous one\\n block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod &&\\n timestamp < bond.earliestTimestamp\\n ) {\\n bond.earliestDisputedStateRoot = _preStateRoot;\\n bond.earliestTimestamp = timestamp;\\n }\\n\\n // if the fraud proof's dispute period does not intersect with the \\n // withdrawal's timestamp, then the user should not be slashed\\n // e.g if a user at day 10 submits a withdrawal, and a fraud proof\\n // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d)\\n // is before the user started their withdrawal. on the contrary, if the user\\n // had started their withdrawal at, say, day 6, they would be slashed\\n if (\\n bond.withdrawalTimestamp != 0 && \\n uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds &&\\n bond.state == State.WITHDRAWING\\n ) {\\n return;\\n }\\n\\n // slash!\\n bond.state = State.NOT_COLLATERALIZED;\\n }\\n\\n /// Sequencers call this function to post collateral which will be used for\\n /// the `appendBatch` call\\n function deposit() override public {\\n require(\\n token.transferFrom(msg.sender, address(this), requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n\\n // This cannot overflow\\n bonds[msg.sender].state = State.COLLATERALIZED;\\n }\\n\\n /// Starts the withdrawal for a publisher\\n function startWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n require(bond.withdrawalTimestamp == 0, Errors.WITHDRAWAL_PENDING);\\n require(bond.state == State.COLLATERALIZED, Errors.WRONG_STATE);\\n\\n bond.state = State.WITHDRAWING;\\n bond.withdrawalTimestamp = uint32(block.timestamp);\\n }\\n\\n /// Finalizes a pending withdrawal from a publisher\\n function finalizeWithdrawal() override public {\\n Bond storage bond = bonds[msg.sender];\\n\\n require(\\n block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, \\n Errors.TOO_EARLY\\n );\\n require(bond.state == State.WITHDRAWING, Errors.SLASHED);\\n \\n // refunds!\\n bond.state = State.NOT_COLLATERALIZED;\\n bond.withdrawalTimestamp = 0;\\n \\n require(\\n token.transfer(msg.sender, requiredCollateral),\\n Errors.ERC20_ERR\\n );\\n }\\n\\n /// Claims the user's reward for the witnesses they provided for the earliest\\n /// disputed state root of the designated publisher\\n function claim(address who) override public {\\n Bond storage bond = bonds[who];\\n require(\\n block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod,\\n Errors.WAIT_FOR_DISPUTES\\n );\\n\\n // reward the earliest state root for this publisher\\n bytes32 _preStateRoot = bond.earliestDisputedStateRoot;\\n Rewards storage rewards = witnessProviders[_preStateRoot];\\n\\n // only allow claiming if fraud was proven in `finalize`\\n require(rewards.canClaim, Errors.CANNOT_CLAIM);\\n\\n // proportional allocation - only reward 50% (rest gets locked in the\\n // contract forever\\n uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total);\\n\\n // reset the user's spent gas so they cannot double claim\\n rewards.gasSpent[msg.sender] = 0;\\n\\n // transfer\\n require(token.transfer(msg.sender, amount), Errors.ERC20_ERR);\\n }\\n\\n /// Checks if the user is collateralized\\n function isCollateralized(address who) override public view returns (bool) {\\n return bonds[who].state == State.COLLATERALIZED;\\n }\\n\\n /// Gets how many witnesses the user has provided for the state root\\n function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) {\\n return witnessProviders[preStateRoot].gasSpent[who];\\n }\\n}\\n\",\"keccak256\":\"0xad36f4e83cc43072164586ecb272fd444057a95026ab60cf04d51837a82b2020\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161130b38038061130b8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b0319166001600160a01b03928316178155606083901b6001600160601b031916608052911690611278906100939039806106f45280610d6d5280610ea15280610fe252506112786000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c8063abfbbe1311610097578063d0e30db011610066578063d0e30db0146102f2578063dc6453dc146102fa578063fc0c546a14610326578063fe10d7741461032e576100f5565b8063abfbbe13146102a8578063b53105a3146102da578063bc2f8dd8146102e2578063c5b6aa2f146102ea576100f5565b80631e16e92f116100d35780631e16e92f1461014e5780631e83409a14610188578063461a4478146101ae5780635b7c615f14610270576100f5565b806302ad4d2a146100fa5780630756183b146101345780631e0983bd14610134575b600080fd5b6101206004803603602081101561011057600080fd5b50356001600160a01b0316610397565b604080519115158252519081900360200190f35b61013c6103c9565b60408051918252519081900360200190f35b6101866004803603608081101561016457600080fd5b508035906020810135906001600160a01b0360408201351690606001356103d0565b005b6101866004803603602081101561019e57600080fd5b50356001600160a01b0316610569565b610254600480360360208110156101c457600080fd5b8101906020810181356401000000008111156101df57600080fd5b8201836020820111156101f157600080fd5b8035906020019184600183028401116401000000008311171561021357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107f6945050505050565b604080516001600160a01b039092168252519081900360200190f35b61028d6004803603602081101561028657600080fd5b50356108d2565b60408051921515835260208301919091528051918290030190f35b610186600480360360608110156102be57600080fd5b508035906001600160a01b0360208201351690604001356108f1565b61013c610afc565b610186610b08565b610186610c2e565b610186610e6d565b61013c6004803603604081101561031057600080fd5b50803590602001356001600160a01b0316610fb5565b610254610fe0565b6103546004803603602081101561034457600080fd5b50356001600160a01b0316611004565b6040518086600281111561036457fe5b81526020018563ffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390f35b600060016001600160a01b03831660009081526001602052604090205460ff1660028111156103c257fe5b1492915050565b62093a8081565b60006104046040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b031663b48ec82086866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051604080516080810190915260518082529192506001600160a01b03831633149161112d60208301399061052c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104f15781810151838201526020016104d9565b50505050905090810190601f16801561051e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50506000938452600260208181526040808720600181018054860190556001600160a01b0390951687529390910190529220805490920190915550565b600060016000836001600160a01b03166001600160a01b03168152602001908152602001600020905062093a808160010154014210156040518060600160405280602e81526020016111b0602e9139906106045760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50600280820154600081815260209283526040908190208054825160608101909352603e8084529394919360ff909116929161103c90830139906106895760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060018101543360009081526002808401602052604082205491920290670de0b6b3a764000002816106b757fe5b3360008181526002860160209081526040808320839055805163a9059cbb60e01b81526004810194909452949093046024830181905293519394507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169363a9059cbb936044808501949193918390030190829087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b505050506040513d602081101561076c57600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e6490820152906107ee5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561085657818101518382015260200161083e565b50505050905090810190601f1680156108835780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156108a057600080fd5b505afa1580156108b4573d6000803e3d6000fd5b505050506040513d60208110156108ca57600080fd5b505192915050565b6002602052600090815260409020805460019091015460ff9091169082565b6109236040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b0316336001600160a01b0316146040518060600160405280603b8152602001611208603b91399061099c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060008381526002602090815260409182902054825160808101909352604b80845260ff9091161592916110bb9083013990610a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506000838152600260209081526040808320805460ff191660019081179091556001600160a01b03861684529182905290912090810154610a6d574260018201556002810184905560038101829055610a9c565b62093a8081600101540142108015610a885750806003015482105b15610a9c5760028101849055600381018290555b8054610100900463ffffffff1615801590610ac85750805462093a80830161010090910463ffffffff16115b8015610ae357506002815460ff166002811115610ae157fe5b145b15610aee5750610af7565b805460ff191690555b505050565b670de0b6b3a764000081565b3360009081526001602090815260409182902080548351606081019094526027808552919361010090910463ffffffff1615929091906111069083013990610b915760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506001815460ff166002811115610ba457fe5b146040518060600160405280602a81526020016111de602a913990610c0a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b508054600260ff199091161764ffffffff0019166101004263ffffffff1602179055565b3360009081526001602090815260409182902080548351606081019094526032808552919363ffffffff6101009092049190911662093a80014210159290919061117e9083013990610cc15760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506002815460ff166002811115610cd457fe5b1460405180608001604052806041815260200161107a6041913990610d3a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50805464ffffffffff191681556040805163a9059cbb60e01b8152336004820152670de0b6b3a7640000602482015290517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163a9059cbb9160448083019260209291908290030181600087803b158015610dbd57600080fd5b505af1158015610dd1573d6000803e3d6000fd5b505050506040513d6020811015610de757600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610e695760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5050565b604080516323b872dd60e01b8152336004820152306024820152670de0b6b3a7640000604482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916323b872dd9160648083019260209291908290030181600087803b158015610ee957600080fd5b505af1158015610efd573d6000803e3d6000fd5b505050506040513d6020811015610f1357600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610f955760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50336000908152600160208190526040909120805460ff19169091179055565b60008281526002602081815260408084206001600160a01b0386168552909201905290205492915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602081905260009182526040909120805491810154600282015460039092015460ff841693610100900463ffffffff1692908556fe426f6e644d616e616765723a2043616e6e6f7420636c61696d207965742e2044697370757465206d7573742062652066696e616c697a6564206669727374426f6e644d616e616765723a2043616e6e6f742066696e616c697a65207769746864726177616c2c20796f752070726f6261626c7920676f7420736c6173686564426f6e644d616e616765723a2046726175642070726f6f6620666f722074686973207072652d737461746520726f6f742068617320616c7265616479206265656e2066696e616c697a6564426f6e644d616e616765723a205769746864726177616c20616c72656164792070656e64696e67426f6e644d616e616765723a204f6e6c7920746865207472616e736974696f6e657220666f722074686973207072652d737461746520726f6f74206d61792063616c6c20746869732066756e6374696f6e426f6e644d616e616765723a20546f6f206561726c7920746f2066696e616c697a6520796f7572207769746864726177616c426f6e644d616e616765723a205761697420666f72206f7468657220706f74656e7469616c206469737075746573426f6e644d616e616765723a2057726f6e6720626f6e6420737461746520666f722070726f706f736572426f6e644d616e616765723a204f6e6c7920746865206672617564207665726966696572206d61792063616c6c20746869732066756e6374696f6ea2646970667358221220812f7206bb4779720cf03f1e4ab5e1deb0c906eb92fc96852dc855750584dcdb64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063abfbbe1311610097578063d0e30db011610066578063d0e30db0146102f2578063dc6453dc146102fa578063fc0c546a14610326578063fe10d7741461032e576100f5565b8063abfbbe13146102a8578063b53105a3146102da578063bc2f8dd8146102e2578063c5b6aa2f146102ea576100f5565b80631e16e92f116100d35780631e16e92f1461014e5780631e83409a14610188578063461a4478146101ae5780635b7c615f14610270576100f5565b806302ad4d2a146100fa5780630756183b146101345780631e0983bd14610134575b600080fd5b6101206004803603602081101561011057600080fd5b50356001600160a01b0316610397565b604080519115158252519081900360200190f35b61013c6103c9565b60408051918252519081900360200190f35b6101866004803603608081101561016457600080fd5b508035906020810135906001600160a01b0360408201351690606001356103d0565b005b6101866004803603602081101561019e57600080fd5b50356001600160a01b0316610569565b610254600480360360208110156101c457600080fd5b8101906020810181356401000000008111156101df57600080fd5b8201836020820111156101f157600080fd5b8035906020019184600183028401116401000000008311171561021357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506107f6945050505050565b604080516001600160a01b039092168252519081900360200190f35b61028d6004803603602081101561028657600080fd5b50356108d2565b60408051921515835260208301919091528051918290030190f35b610186600480360360608110156102be57600080fd5b508035906001600160a01b0360208201351690604001356108f1565b61013c610afc565b610186610b08565b610186610c2e565b610186610e6d565b61013c6004803603604081101561031057600080fd5b50803590602001356001600160a01b0316610fb5565b610254610fe0565b6103546004803603602081101561034457600080fd5b50356001600160a01b0316611004565b6040518086600281111561036457fe5b81526020018563ffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390f35b600060016001600160a01b03831660009081526001602052604090205460ff1660028111156103c257fe5b1492915050565b62093a8081565b60006104046040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b031663b48ec82086866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561044f57600080fd5b505afa158015610463573d6000803e3d6000fd5b505050506040513d602081101561047957600080fd5b5051604080516080810190915260518082529192506001600160a01b03831633149161112d60208301399061052c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156104f15781810151838201526020016104d9565b50505050905090810190601f16801561051e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50506000938452600260208181526040808720600181018054860190556001600160a01b0390951687529390910190529220805490920190915550565b600060016000836001600160a01b03166001600160a01b03168152602001908152602001600020905062093a808160010154014210156040518060600160405280602e81526020016111b0602e9139906106045760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50600280820154600081815260209283526040908190208054825160608101909352603e8084529394919360ff909116929161103c90830139906106895760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060018101543360009081526002808401602052604082205491920290670de0b6b3a764000002816106b757fe5b3360008181526002860160209081526040808320839055805163a9059cbb60e01b81526004810194909452949093046024830181905293519394507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169363a9059cbb936044808501949193918390030190829087803b15801561074257600080fd5b505af1158015610756573d6000803e3d6000fd5b505050506040513d602081101561076c57600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e6490820152906107ee5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561085657818101518382015260200161083e565b50505050905090810190601f1680156108835780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156108a057600080fd5b505afa1580156108b4573d6000803e3d6000fd5b505050506040513d60208110156108ca57600080fd5b505192915050565b6002602052600090815260409020805460019091015460ff9091169082565b6109236040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b8152506107f6565b6001600160a01b0316336001600160a01b0316146040518060600160405280603b8152602001611208603b91399061099c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5060008381526002602090815260409182902054825160808101909352604b80845260ff9091161592916110bb9083013990610a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506000838152600260209081526040808320805460ff191660019081179091556001600160a01b03861684529182905290912090810154610a6d574260018201556002810184905560038101829055610a9c565b62093a8081600101540142108015610a885750806003015482105b15610a9c5760028101849055600381018290555b8054610100900463ffffffff1615801590610ac85750805462093a80830161010090910463ffffffff16115b8015610ae357506002815460ff166002811115610ae157fe5b145b15610aee5750610af7565b805460ff191690555b505050565b670de0b6b3a764000081565b3360009081526001602090815260409182902080548351606081019094526027808552919361010090910463ffffffff1615929091906111069083013990610b915760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506001815460ff166002811115610ba457fe5b146040518060600160405280602a81526020016111de602a913990610c0a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b508054600260ff199091161764ffffffff0019166101004263ffffffff1602179055565b3360009081526001602090815260409182902080548351606081019094526032808552919363ffffffff6101009092049190911662093a80014210159290919061117e9083013990610cc15760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b506002815460ff166002811115610cd457fe5b1460405180608001604052806041815260200161107a6041913990610d3a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50805464ffffffffff191681556040805163a9059cbb60e01b8152336004820152670de0b6b3a7640000602482015290517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169163a9059cbb9160448083019260209291908290030181600087803b158015610dbd57600080fd5b505af1158015610dd1573d6000803e3d6000fd5b505050506040513d6020811015610de757600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610e695760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b5050565b604080516323b872dd60e01b8152336004820152306024820152670de0b6b3a7640000604482015290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916323b872dd9160648083019260209291908290030181600087803b158015610ee957600080fd5b505af1158015610efd573d6000803e3d6000fd5b505050506040513d6020811015610f1357600080fd5b50516040805180820190915260208082527f426f6e644d616e616765723a20436f756c64206e6f7420706f737420626f6e649082015290610f955760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156104f15781810151838201526020016104d9565b50336000908152600160208190526040909120805460ff19169091179055565b60008281526002602081815260408084206001600160a01b0386168552909201905290205492915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001602081905260009182526040909120805491810154600282015460039092015460ff841693610100900463ffffffff1692908556fe426f6e644d616e616765723a2043616e6e6f7420636c61696d207965742e2044697370757465206d7573742062652066696e616c697a6564206669727374426f6e644d616e616765723a2043616e6e6f742066696e616c697a65207769746864726177616c2c20796f752070726f6261626c7920676f7420736c6173686564426f6e644d616e616765723a2046726175642070726f6f6620666f722074686973207072652d737461746520726f6f742068617320616c7265616479206265656e2066696e616c697a6564426f6e644d616e616765723a205769746864726177616c20616c72656164792070656e64696e67426f6e644d616e616765723a204f6e6c7920746865207472616e736974696f6e657220666f722074686973207072652d737461746520726f6f74206d61792063616c6c20746869732066756e6374696f6e426f6e644d616e616765723a20546f6f206561726c7920746f2066696e616c697a6520796f7572207769746864726177616c426f6e644d616e616765723a205761697420666f72206f7468657220706f74656e7469616c206469737075746573426f6e644d616e616765723a2057726f6e6720626f6e6420737461746520666f722070726f706f736572426f6e644d616e616765723a204f6e6c7920746865206672617564207665726966696572206d61792063616c6c20746869732066756e6374696f6ea2646970667358221220812f7206bb4779720cf03f1e4ab5e1deb0c906eb92fc96852dc855750584dcdb64736f6c63430007060033", - "devdoc": { - "details": "The Bond Manager contract handles deposits in the form of an ERC20 token from bonded Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, and the Verifier's gas costs are refunded. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": {}, - "title": "OVM_BondManager", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "bonds(address)": { - "notice": "The bonds posted by each proposer" - }, - "claim(address)": { - "notice": "Claims the user's reward for the witnesses they provided for the earliest disputed state root of the designated publisher" - }, - "constructor": { - "notice": "Initializes with a ERC20 token to be used for the fidelity bonds and with the Address Manager" - }, - "deposit()": { - "notice": "Sequencers call this function to post collateral which will be used for the `appendBatch` call" - }, - "disputePeriodSeconds()": { - "notice": "The dispute period" - }, - "finalize(bytes32,address,uint256)": { - "notice": "Slashes + distributes rewards or frees up the sequencer's bond, only called by `FraudVerifier.finalizeFraudVerification`" - }, - "finalizeWithdrawal()": { - "notice": "Finalizes a pending withdrawal from a publisher" - }, - "getGasSpent(bytes32,address)": { - "notice": "Gets how many witnesses the user has provided for the state root" - }, - "isCollateralized(address)": { - "notice": "Checks if the user is collateralized" - }, - "multiFraudProofPeriod()": { - "notice": "The period to find the earliest fraud proof for a publisher" - }, - "recordGasSpent(bytes32,bytes32,address,uint256)": { - "notice": "Adds `who` to the list of witnessProviders for the provided `preStateRoot`." - }, - "requiredCollateral()": { - "notice": "The minimum collateral a sequencer must post" - }, - "startWithdrawal()": { - "notice": "Starts the withdrawal for a publisher" - }, - "token()": { - "notice": "The bond token" - }, - "witnessProviders(bytes32)": { - "notice": "For each pre-state root, there's an array of witnessProviders that must be rewarded for posting witnesses" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 8405, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "bonds", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_struct(Bond)11292_storage)" - }, - { - "astId": 8410, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "witnessProviders", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_struct(Rewards)11301_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_enum(State)11281": { - "encoding": "inplace", - "label": "enum iOVM_BondManager.State", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_struct(Bond)11292_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct iOVM_BondManager.Bond)", - "numberOfBytes": "32", - "value": "t_struct(Bond)11292_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_bytes32,t_struct(Rewards)11301_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct iOVM_BondManager.Rewards)", - "numberOfBytes": "32", - "value": "t_struct(Rewards)11301_storage" - }, - "t_struct(Bond)11292_storage": { - "encoding": "inplace", - "label": "struct iOVM_BondManager.Bond", - "members": [ - { - "astId": 11283, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "state", - "offset": 0, - "slot": "0", - "type": "t_enum(State)11281" - }, - { - "astId": 11285, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "withdrawalTimestamp", - "offset": 1, - "slot": "0", - "type": "t_uint32" - }, - { - "astId": 11287, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "firstDisputeAt", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 11289, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "earliestDisputedStateRoot", - "offset": 0, - "slot": "2", - "type": "t_bytes32" - }, - { - "astId": 11291, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "earliestTimestamp", - "offset": 0, - "slot": "3", - "type": "t_uint256" - } - ], - "numberOfBytes": "128" - }, - "t_struct(Rewards)11301_storage": { - "encoding": "inplace", - "label": "struct iOVM_BondManager.Rewards", - "members": [ - { - "astId": 11294, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "canClaim", - "offset": 0, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 11296, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "total", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 11300, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol:OVM_BondManager", - "label": "gasSpent", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint32": { - "encoding": "inplace", - "label": "uint32", - "numberOfBytes": "4" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_CanonicalTransactionChain.json b/deployments/kovan/OVM_CanonicalTransactionChain.json deleted file mode 100644 index a1011697b..000000000 --- a/deployments/kovan/OVM_CanonicalTransactionChain.json +++ /dev/null @@ -1,800 +0,0 @@ -{ - "address": "0x2886C4650fC8aC07bF672046c9F90C47Ce581964", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_forceInclusionPeriodSeconds", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_forceInclusionPeriodBlocks", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxTransactionGasLimit", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_startingQueueIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_numQueueElements", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_totalElements", - "type": "uint256" - } - ], - "name": "QueueBatchAppended", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_startingQueueIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_numQueueElements", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_totalElements", - "type": "uint256" - } - ], - "name": "SequencerBatchAppended", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_batchIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "_batchRoot", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_batchSize", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_prevTotalElements", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_extraData", - "type": "bytes" - } - ], - "name": "TransactionBatchAppended", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_l1TxOrigin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_data", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_queueIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_timestamp", - "type": "uint256" - } - ], - "name": "TransactionEnqueued", - "type": "event" - }, - { - "inputs": [], - "name": "L2_GAS_DISCOUNT_DIVISOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_ROLLUP_TX_SIZE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_ROLLUP_TX_GAS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_numQueuedTransactions", - "type": "uint256" - } - ], - "name": "appendQueueBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "appendSequencerBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "batches", - "outputs": [ - { - "internalType": "contract iOVM_ChainStorageContainer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "enqueue", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "forceInclusionPeriodBlocks", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "forceInclusionPeriodSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLastBlockNumber", - "outputs": [ - { - "internalType": "uint40", - "name": "", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLastTimestamp", - "outputs": [ - { - "internalType": "uint40", - "name": "", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNextQueueIndex", - "outputs": [ - { - "internalType": "uint40", - "name": "", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNumPendingQueueElements", - "outputs": [ - { - "internalType": "uint40", - "name": "", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "getQueueElement", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "queueRoot", - "type": "bytes32" - }, - { - "internalType": "uint40", - "name": "timestamp", - "type": "uint40" - }, - { - "internalType": "uint40", - "name": "blockNumber", - "type": "uint40" - } - ], - "internalType": "struct Lib_OVMCodec.QueueElement", - "name": "_element", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getQueueLength", - "outputs": [ - { - "internalType": "uint40", - "name": "", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalBatches", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalBatches", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalElements", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalElements", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxTransactionGasLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "queue", - "outputs": [ - { - "internalType": "contract iOVM_ChainStorageContainer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "enum Lib_OVMCodec.QueueOrigin", - "name": "l1QueueOrigin", - "type": "uint8" - }, - { - "internalType": "address", - "name": "l1TxOrigin", - "type": "address" - }, - { - "internalType": "address", - "name": "entrypoint", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.Transaction", - "name": "_transaction", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isSequenced", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "queueIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "txData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.TransactionChainElement", - "name": "_txChainElement", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_batchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_inclusionProof", - "type": "tuple" - } - ], - "name": "verifyTransaction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x812d2607ab53ea9743c4b34e065e6df0f788f130ef44dae7d51e102542ef9506", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x2886C4650fC8aC07bF672046c9F90C47Ce581964", - "transactionIndex": 4, - "gasUsed": "2859140", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x68ce91e64698d8626ec602bf796e037699aff0a3223bbff632d8dc8d42cebfbb", - "transactionHash": "0x812d2607ab53ea9743c4b34e065e6df0f788f130ef44dae7d51e102542ef9506", - "logs": [], - "blockNumber": 23637097, - "cumulativeGasUsed": "3175403", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - 600, - 10, - 9000000 - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_forceInclusionPeriodSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_forceInclusionPeriodBlocks\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_startingQueueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numQueueElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"name\":\"QueueBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_startingQueueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numQueueElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"name\":\"SequencerBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_prevTotalElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"TransactionBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_l1TxOrigin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timestamp\",\"type\":\"uint256\"}],\"name\":\"TransactionEnqueued\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"L2_GAS_DISCOUNT_DIVISOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_ROLLUP_TX_SIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_ROLLUP_TX_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numQueuedTransactions\",\"type\":\"uint256\"}],\"name\":\"appendQueueBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"appendSequencerBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batches\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"enqueue\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forceInclusionPeriodBlocks\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"forceInclusionPeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastBlockNumber\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastTimestamp\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNextQueueIndex\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNumPendingQueueElements\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getQueueElement\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"queueRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint40\",\"name\":\"timestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"blockNumber\",\"type\":\"uint40\"}],\"internalType\":\"struct Lib_OVMCodec.QueueElement\",\"name\":\"_element\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getQueueLength\",\"outputs\":[{\"internalType\":\"uint40\",\"name\":\"\",\"type\":\"uint40\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalBatches\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBatches\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalElements\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"queue\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"isSequenced\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"txData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.TransactionChainElement\",\"name\":\"_txChainElement\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_inclusionProof\",\"type\":\"tuple\"}],\"name\":\"verifyTransaction\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Canonical Transaction Chain (CTC) contract is an append-only log of transactions which must be applied to the rollup state. It defines the ordering of rollup transactions by writing them to the 'CTC:batches' instance of the Chain Storage Container. The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer will eventually append it to the rollup state. If the Sequencer does not include an enqueued transaction within the 'force inclusion period', then any account may force it to be included by calling appendQueueBatch(). Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"appendQueueBatch(uint256)\":{\"params\":{\"_numQueuedTransactions\":\"Number of transactions to append.\"}},\"appendSequencerBatch()\":{\"details\":\"This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch contexts. .param _transactionDataFields Array of raw transaction data.\"},\"batches()\":{\"returns\":{\"_0\":\"Reference to the batch storage container.\"}},\"enqueue(address,uint256,bytes)\":{\"params\":{\"_data\":\"Transaction data.\",\"_gasLimit\":\"Gas limit for the enqueued L2 transaction.\",\"_target\":\"Target L2 contract to send the transaction to.\"}},\"getLastBlockNumber()\":{\"returns\":{\"_0\":\"Blocknumber for the last transaction.\"}},\"getLastTimestamp()\":{\"returns\":{\"_0\":\"Timestamp for the last transaction.\"}},\"getNextQueueIndex()\":{\"returns\":{\"_0\":\"Index for the next queue element.\"}},\"getNumPendingQueueElements()\":{\"returns\":{\"_0\":\"Number of pending queue elements.\"}},\"getQueueElement(uint256)\":{\"params\":{\"_index\":\"Index of the queue element to access.\"},\"returns\":{\"_element\":\"Queue element at the given index.\"}},\"getQueueLength()\":{\"returns\":{\"_0\":\"Length of the queue.\"}},\"getTotalBatches()\":{\"returns\":{\"_totalBatches\":\"Total submitted batches.\"}},\"getTotalElements()\":{\"returns\":{\"_totalElements\":\"Total submitted elements.\"}},\"queue()\":{\"returns\":{\"_0\":\"Reference to the queue storage container.\"}},\"verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_batchHeader\":\"Header of the batch the transaction was included in.\",\"_inclusionProof\":\"Inclusion proof for the provided transaction chain element.\",\"_transaction\":\"Transaction to verify.\",\"_txChainElement\":\"Transaction chain element corresponding to the transaction.\"},\"returns\":{\"_0\":\"True if the transaction exists in the CTC, false if not.\"}}},\"title\":\"OVM_CanonicalTransactionChain\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"appendQueueBatch(uint256)\":{\"notice\":\"Appends a given number of queued transactions as a single batch.\"},\"appendSequencerBatch()\":{\"notice\":\"Allows the sequencer to append a batch of transactions.\"},\"batches()\":{\"notice\":\"Accesses the batch storage container.\"},\"enqueue(address,uint256,bytes)\":{\"notice\":\"Adds a transaction to the queue.\"},\"getLastBlockNumber()\":{\"notice\":\"Returns the blocknumber of the last transaction.\"},\"getLastTimestamp()\":{\"notice\":\"Returns the timestamp of the last transaction.\"},\"getNextQueueIndex()\":{\"notice\":\"Returns the index of the next element to be enqueued.\"},\"getNumPendingQueueElements()\":{\"notice\":\"Get the number of queue elements which have not yet been included.\"},\"getQueueElement(uint256)\":{\"notice\":\"Gets the queue element at a particular index.\"},\"getQueueLength()\":{\"notice\":\"Retrieves the length of the queue, including both pending and canonical transactions.\"},\"getTotalBatches()\":{\"notice\":\"Retrieves the total number of batches submitted.\"},\"getTotalElements()\":{\"notice\":\"Retrieves the total number of elements submitted.\"},\"queue()\":{\"notice\":\"Accesses the queue storage container.\"},\"verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Verifies whether a transaction is included in the chain.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol\":\"OVM_CanonicalTransactionChain\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_ECDSAContractAccount } from \\\"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\nimport { Lib_SafeMathWrapper } from \\\"../../libraries/wrappers/Lib_SafeMathWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ECDSAContractAccount\\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \\n * providing eth_sign and EIP155 formatted transaction encodings.\\n *\\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\\n\\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Executes a signed transaction.\\n * @param _transaction Signed EOA transaction.\\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\\n\\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\\n // recovered address of the user who signed this message. This is how we manage to shim\\n // account abstraction even though the user isn't a contract.\\n // Need to make sure that the transaction nonce is right and bump it if so.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_ECDSAUtils.recover(\\n _transaction,\\n isEthSign,\\n _v,\\n _r,\\n _s\\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\\n \\\"Signature provided for EOA transaction execution is invalid.\\\"\\n );\\n\\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\\n\\n // Need to make sure that the transaction chainId is correct.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n \\\"Transaction chainId does not match expected OVM chainId.\\\"\\n );\\n\\n // Need to make sure that the transaction nonce is right.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\\n \\\"Transaction nonce does not match the expected nonce.\\\"\\n );\\n\\n // TEMPORARY: Disable gas checks for minnet.\\n // // Need to make sure that the gas is sufficient to execute the transaction.\\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\\n // \\\"Gas is not sufficient to execute the transaction.\\\"\\n // );\\n\\n // Transfer fee to relayer.\\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\\n gasleft(),\\n ETH_ERC20_ADDRESS,\\n abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", relayer, fee)\\n );\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n success == true,\\n \\\"Fee was not transferred to relayer.\\\"\\n );\\n\\n // Contract creations are signalled by sending a transaction to the zero address.\\n if (decodedTx.to == address(0)) {\\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\\n decodedTx.gasLimit,\\n decodedTx.data\\n );\\n\\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\\n // initialization. Always return `true` for our success value here.\\n return (true, abi.encode(created));\\n } else {\\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\\n // cases, but since this is a contract we'd end up bumping the nonce twice.\\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\\n\\n return Lib_SafeExecutionManagerWrapper.safeCALL(\\n decodedTx.gasLimit,\\n decodedTx.to,\\n decodedTx.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9eaaad64d70fb465dd323504f34ba44861dfe738621fce48e8a1e697405e592e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ProxyEOA\\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \\n * 'account abstraction' on layer 2. \\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ProxyEOA {\\n\\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _implementation\\n )\\n public\\n {\\n _setImplementation(_implementation);\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\\n gasleft(),\\n getImplementation(),\\n msg.data\\n );\\n\\n if (success) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n Lib_SafeExecutionManagerWrapper.safeREVERT(\\n string(returndata)\\n );\\n }\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function upgrade(\\n address _implementation\\n )\\n external\\n {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\\n \\\"EOAs can only upgrade their own EOA implementation\\\"\\n );\\n\\n _setImplementation(_implementation);\\n }\\n\\n function getImplementation()\\n public\\n returns (\\n address _implementation\\n )\\n {\\n return address(uint160(uint256(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n IMPLEMENTATION_KEY\\n )\\n )));\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n IMPLEMENTATION_KEY,\\n bytes32(uint256(uint160(_implementation)))\\n );\\n }\\n}\",\"keccak256\":\"0xfbc7e9737d04824f9c1b63fc2151a591c768e3b643d9b3c44405559c3ef19e5e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_MerkleTree } from \\\"../../libraries/utils/Lib_MerkleTree.sol\\\";\\nimport { Lib_Math } from \\\"../../libraries/utils/Lib_Math.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ExecutionManager } from \\\"../execution/OVM_ExecutionManager.sol\\\";\\n\\n\\n/**\\n * @title OVM_CanonicalTransactionChain\\n * @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions\\n * which must be applied to the rollup state. It defines the ordering of rollup transactions by\\n * writing them to the 'CTC:batches' instance of the Chain Storage Container.\\n * The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer\\n * will eventually append it to the rollup state.\\n * If the Sequencer does not include an enqueued transaction within the 'force inclusion period',\\n * then any account may force it to be included by calling appendQueueBatch().\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_AddressResolver {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n // L2 tx gas-related\\n uint256 constant public MIN_ROLLUP_TX_GAS = 100000;\\n uint256 constant public MAX_ROLLUP_TX_SIZE = 10000;\\n uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 32;\\n\\n // Encoding-related (all in bytes)\\n uint256 constant internal BATCH_CONTEXT_SIZE = 16;\\n uint256 constant internal BATCH_CONTEXT_LENGTH_POS = 12;\\n uint256 constant internal BATCH_CONTEXT_START_POS = 15;\\n uint256 constant internal TX_DATA_HEADER_SIZE = 3;\\n uint256 constant internal BYTES_TILL_TX_DATA = 65;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n uint256 public forceInclusionPeriodSeconds;\\n uint256 public forceInclusionPeriodBlocks;\\n uint256 public maxTransactionGasLimit;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager,\\n uint256 _forceInclusionPeriodSeconds,\\n uint256 _forceInclusionPeriodBlocks,\\n uint256 _maxTransactionGasLimit\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds;\\n forceInclusionPeriodBlocks = _forceInclusionPeriodBlocks;\\n maxTransactionGasLimit = _maxTransactionGasLimit;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n override\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:CTC:batches\\\")\\n );\\n }\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n override\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:CTC:queue\\\")\\n );\\n }\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n override\\n public\\n view\\n returns (\\n uint256 _totalElements\\n )\\n {\\n (uint40 totalElements,,,) = _getBatchExtraData();\\n return uint256(totalElements);\\n }\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n override\\n public\\n view\\n returns (\\n uint256 _totalBatches\\n )\\n {\\n return batches().length();\\n }\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,uint40 nextQueueIndex,,) = _getBatchExtraData();\\n return nextQueueIndex;\\n }\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,,uint40 lastTimestamp,) = _getBatchExtraData();\\n return lastTimestamp;\\n }\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n (,,,uint40 lastBlockNumber) = _getBatchExtraData();\\n return lastBlockNumber;\\n }\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n )\\n {\\n iOVM_ChainStorageContainer queue = queue();\\n\\n uint40 trueIndex = uint40(_index * 2);\\n bytes32 queueRoot = queue.get(trueIndex);\\n bytes32 timestampAndBlockNumber = queue.get(trueIndex + 1);\\n\\n uint40 elementTimestamp;\\n uint40 elementBlockNumber;\\n assembly {\\n elementTimestamp := and(timestampAndBlockNumber, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n elementBlockNumber := shr(40, and(timestampAndBlockNumber, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\\n }\\n\\n return Lib_OVMCodec.QueueElement({\\n queueRoot: queueRoot,\\n timestamp: elementTimestamp,\\n blockNumber: elementBlockNumber\\n });\\n }\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n return getQueueLength() - getNextQueueIndex();\\n }\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n override\\n public\\n view\\n returns (\\n uint40\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the real queue length we need\\n // to divide by 2. See the usage of `push2(..)`.\\n return uint40(queue().length() / 2);\\n }\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target L2 contract to send the transaction to.\\n * @param _gasLimit Gas limit for the enqueued L2 transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n override\\n public\\n {\\n require(\\n _data.length <= MAX_ROLLUP_TX_SIZE,\\n \\\"Transaction data size exceeds maximum for rollup transaction.\\\"\\n );\\n\\n require(\\n _gasLimit <= maxTransactionGasLimit,\\n \\\"Transaction gas limit exceeds maximum for rollup transaction.\\\"\\n );\\n\\n require(\\n _gasLimit >= MIN_ROLLUP_TX_GAS,\\n \\\"Transaction gas limit too low to enqueue.\\\"\\n );\\n\\n // We need to consume some amount of L1 gas in order to rate limit transactions going into\\n // L2. However, L2 is cheaper than L1 so we only need to burn some small proportion of the\\n // provided L1 gas.\\n uint256 gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;\\n uint256 startingGas = gasleft();\\n\\n // Although this check is not necessary (burn below will run out of gas if not true), it\\n // gives the user an explicit reason as to why the enqueue attempt failed.\\n require(\\n startingGas > gasToConsume,\\n \\\"Insufficient gas for L2 rate limiting burn.\\\"\\n );\\n\\n // Here we do some \\\"dumb\\\" work in order to burn gas, although we should probably replace\\n // this with something like minting gas token later on.\\n uint256 i;\\n while(startingGas - gasleft() < gasToConsume) {\\n i++;\\n }\\n\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data\\n )\\n );\\n\\n bytes32 timestampAndBlockNumber;\\n assembly {\\n timestampAndBlockNumber := timestamp()\\n timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))\\n }\\n\\n iOVM_ChainStorageContainer queue = queue();\\n\\n queue.push2(\\n transactionHash,\\n timestampAndBlockNumber\\n );\\n\\n uint256 queueIndex = queue.length() / 2;\\n emit TransactionEnqueued(\\n msg.sender,\\n _target,\\n _gasLimit,\\n _data,\\n queueIndex - 1,\\n block.timestamp\\n );\\n }\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n override\\n public\\n {\\n // Disable `appendQueueBatch` for minnet\\n revert(\\\"appendQueueBatch is currently disabled.\\\");\\n\\n _numQueuedTransactions = Lib_Math.min(_numQueuedTransactions, getNumPendingQueueElements());\\n require(\\n _numQueuedTransactions > 0,\\n \\\"Must append more than zero transactions.\\\"\\n );\\n\\n bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);\\n uint40 nextQueueIndex = getNextQueueIndex();\\n\\n for (uint256 i = 0; i < _numQueuedTransactions; i++) {\\n if (msg.sender != resolve(\\\"OVM_Sequencer\\\")) {\\n Lib_OVMCodec.QueueElement memory el = getQueueElement(nextQueueIndex);\\n require(\\n el.timestamp + forceInclusionPeriodSeconds < block.timestamp,\\n \\\"Queue transactions cannot be submitted during the sequencer inclusion period.\\\"\\n );\\n }\\n leaves[i] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n }\\n\\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\\n\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n _numQueuedTransactions,\\n _numQueuedTransactions,\\n lastElement.timestamp,\\n lastElement.blockNumber\\n );\\n\\n emit QueueBatchAppended(\\n nextQueueIndex - _numQueuedTransactions,\\n _numQueuedTransactions,\\n getTotalElements()\\n );\\n }\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch()\\n override\\n public\\n {\\n uint40 shouldStartAtElement;\\n uint24 totalElementsToAppend;\\n uint24 numContexts;\\n assembly {\\n shouldStartAtElement := shr(216, calldataload(4))\\n totalElementsToAppend := shr(232, calldataload(9))\\n numContexts := shr(232, calldataload(12))\\n }\\n\\n require(\\n shouldStartAtElement == getTotalElements(),\\n \\\"Actual batch start index does not match expected start index.\\\"\\n );\\n\\n require(\\n msg.sender == resolve(\\\"OVM_Sequencer\\\"),\\n \\\"Function can only be called by the Sequencer.\\\"\\n );\\n\\n require(\\n numContexts > 0,\\n \\\"Must provide at least one batch context.\\\"\\n );\\n\\n require(\\n totalElementsToAppend > 0,\\n \\\"Must append at least one element.\\\"\\n );\\n\\n uint40 nextTransactionPtr = uint40(BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts);\\n uint256 calldataSize;\\n assembly {\\n calldataSize := calldatasize()\\n }\\n\\n require(\\n calldataSize >= nextTransactionPtr,\\n \\\"Not enough BatchContexts provided.\\\"\\n );\\n\\n // Get queue length for future comparison/\\n uint40 queueLength = getQueueLength();\\n\\n // Initialize the array of canonical chain leaves that we will append.\\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\\n uint32 leafIndex = 0;\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n // We will sequentially append leaves which are pointers to the queue.\\n // The initial queue index is what is currently in storage.\\n uint40 nextQueueIndex = getNextQueueIndex();\\n\\n BatchContext memory curContext;\\n\\n for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n if (i == 0) {\\n _validateFirstBatchContext(nextContext);\\n }\\n _validateNextBatchContext(curContext, nextContext, nextQueueIndex);\\n\\n curContext = nextContext;\\n\\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\\n uint256 txDataLength;\\n assembly {\\n txDataLength := shr(232, calldataload(nextTransactionPtr))\\n }\\n\\n leaves[leafIndex] = _getSequencerLeafHash(curContext, nextTransactionPtr, txDataLength);\\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\\n numSequencerTransactions++;\\n leafIndex++;\\n }\\n\\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\\n require(nextQueueIndex < queueLength, \\\"Not enough queued transactions to append.\\\");\\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\\n nextQueueIndex++;\\n leafIndex++;\\n }\\n }\\n\\n _validateFinalBatchContext(curContext);\\n\\n require(\\n calldataSize == nextTransactionPtr,\\n \\\"Not all sequencer transactions were processed.\\\"\\n );\\n\\n require(\\n leafIndex == totalElementsToAppend,\\n \\\"Actual transaction index does not match expected total elements to append.\\\"\\n );\\n\\n // Generate the required metadata that we need to append this batch\\n uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions;\\n uint40 timestamp;\\n uint40 blockNumber;\\n if (curContext.numSubsequentQueueTransactions == 0) {\\n // The last element is a sequencer tx, therefore pull timestamp and block number from the last context.\\n timestamp = uint40(curContext.timestamp);\\n blockNumber = uint40(curContext.blockNumber);\\n } else {\\n // The last element is a queue tx, therefore pull timestamp and block number from the queue element.\\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\\n timestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n _appendBatch(\\n Lib_MerkleTree.getMerkleRoot(leaves),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n timestamp,\\n blockNumber\\n );\\n\\n emit SequencerBatchAppended(\\n nextQueueIndex - numQueuedTransactions,\\n numQueuedTransactions,\\n getTotalElements()\\n );\\n }\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n if (_txChainElement.isSequenced == true) {\\n return _verifySequencerTransaction(\\n _transaction,\\n _txChainElement,\\n _batchHeader,\\n _inclusionProof\\n );\\n } else {\\n return _verifyQueueTransaction(\\n _transaction,\\n _txChainElement.queueIndex,\\n _batchHeader,\\n _inclusionProof\\n );\\n }\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Returns the BatchContext located at a particular index.\\n * @param _index The index of the BatchContext\\n * @return The BatchContext at the specified index.\\n */\\n function _getBatchContext(\\n uint256 _index\\n )\\n internal\\n pure\\n returns (\\n BatchContext memory\\n )\\n {\\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 ctxTimestamp;\\n uint256 ctxBlockNumber;\\n\\n assembly {\\n numSequencedTransactions := shr(232, calldataload(contextPtr))\\n numSubsequentQueueTransactions := shr(232, calldataload(add(contextPtr, 3)))\\n ctxTimestamp := shr(216, calldataload(add(contextPtr, 6)))\\n ctxBlockNumber := shr(216, calldataload(add(contextPtr, 11)))\\n }\\n\\n return BatchContext({\\n numSequencedTransactions: numSequencedTransactions,\\n numSubsequentQueueTransactions: numSubsequentQueueTransactions,\\n timestamp: ctxTimestamp,\\n blockNumber: ctxBlockNumber\\n });\\n }\\n\\n /**\\n * Parses the batch context from the extra data.\\n * @return Total number of elements submitted.\\n * @return Index of the next queue element.\\n */\\n function _getBatchExtraData()\\n internal\\n view\\n returns (\\n uint40,\\n uint40,\\n uint40,\\n uint40\\n )\\n {\\n bytes27 extraData = batches().getGlobalMetadata();\\n\\n uint40 totalElements;\\n uint40 nextQueueIndex;\\n uint40 lastTimestamp;\\n uint40 lastBlockNumber;\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n nextQueueIndex := shr(40, and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000))\\n lastTimestamp := shr(80, and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000))\\n lastBlockNumber := shr(120, and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000))\\n }\\n\\n return (\\n totalElements,\\n nextQueueIndex,\\n lastTimestamp,\\n lastBlockNumber\\n );\\n }\\n\\n /**\\n * Encodes the batch context for the extra data.\\n * @param _totalElements Total number of elements submitted.\\n * @param _nextQueueIndex Index of the next queue element.\\n * @param _timestamp Timestamp for the last batch.\\n * @param _blockNumber Block number of the last batch.\\n * @return Encoded batch context.\\n */\\n function _makeBatchExtraData(\\n uint40 _totalElements,\\n uint40 _nextQueueIndex,\\n uint40 _timestamp,\\n uint40 _blockNumber\\n )\\n internal\\n pure\\n returns (\\n bytes27\\n )\\n {\\n bytes27 extraData;\\n assembly {\\n extraData := _totalElements\\n extraData := or(extraData, shl(40, _nextQueueIndex))\\n extraData := or(extraData, shl(80, _timestamp))\\n extraData := or(extraData, shl(120, _blockNumber))\\n extraData := shl(40, extraData)\\n }\\n\\n return extraData;\\n }\\n\\n /**\\n * Retrieves the hash of a queue element.\\n * @param _index Index of the queue element to retrieve a hash for.\\n * @return Hash of the queue element.\\n */\\n function _getQueueLeafHash(\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n return _hashTransactionChainElement(\\n Lib_OVMCodec.TransactionChainElement({\\n isSequenced: false,\\n queueIndex: _index,\\n timestamp: 0,\\n blockNumber: 0,\\n txData: hex\\\"\\\"\\n })\\n );\\n }\\n\\n /**\\n * Retrieves the length of the queue.\\n * @return Length of the queue.\\n */\\n function _getQueueLength()\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n // The underlying queue data structure stores 2 elements\\n // per insertion, so to get the real queue length we need\\n // to divide by 2. See the usage of `push2(..)`.\\n return uint40(queue().length() / 2);\\n }\\n\\n /**\\n * Retrieves the hash of a sequencer element.\\n * @param _context Batch context for the given element.\\n * @param _nextTransactionPtr Pointer to the next transaction in the calldata.\\n * @param _txDataLength Length of the transaction item.\\n * @return Hash of the sequencer element.\\n */\\n function _getSequencerLeafHash(\\n BatchContext memory _context,\\n uint256 _nextTransactionPtr,\\n uint256 _txDataLength\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n\\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\\n uint256 ctxTimestamp = _context.timestamp;\\n uint256 ctxBlockNumber = _context.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(chainElement, 0x20)\\n\\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\\n // This distinguishes sequencer ChainElements from queue ChainElements because\\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\\n // elements is always zero\\n mstore8(chainElementStart, 1)\\n\\n mstore(add(chainElementStart, 1), ctxTimestamp)\\n mstore(add(chainElementStart, 33), ctxBlockNumber)\\n\\n calldatacopy(add(chainElementStart, BYTES_TILL_TX_DATA), add(_nextTransactionPtr, 3), _txDataLength)\\n\\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, _txDataLength))\\n }\\n\\n return leafHash;\\n }\\n\\n /**\\n * Retrieves the hash of a sequencer element.\\n * @param _txChainElement The chain element which is hashed to calculate the leaf.\\n * @return Hash of the sequencer element.\\n */\\n function _getSequencerLeafHash(\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement\\n )\\n internal\\n view\\n returns(\\n bytes32\\n )\\n {\\n bytes memory txData = _txChainElement.txData;\\n uint256 txDataLength = _txChainElement.txData.length;\\n\\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + txDataLength);\\n uint256 ctxTimestamp = _txChainElement.timestamp;\\n uint256 ctxBlockNumber = _txChainElement.blockNumber;\\n\\n bytes32 leafHash;\\n assembly {\\n let chainElementStart := add(chainElement, 0x20)\\n\\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\\n // This distinguishes sequencer ChainElements from queue ChainElements because\\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\\n // elements is always zero\\n mstore8(chainElementStart, 1)\\n\\n mstore(add(chainElementStart, 1), ctxTimestamp)\\n mstore(add(chainElementStart, 33), ctxBlockNumber)\\n\\n pop(staticcall(gas(), 0x04, add(txData, 0x20), txDataLength, add(chainElementStart, BYTES_TILL_TX_DATA), txDataLength))\\n\\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, txDataLength))\\n }\\n\\n return leafHash;\\n }\\n\\n /**\\n * Inserts a batch into the chain of batches.\\n * @param _transactionRoot Root of the transaction tree for this batch.\\n * @param _batchSize Number of elements in the batch.\\n * @param _numQueuedTransactions Number of queue transactions in the batch.\\n * @param _timestamp The latest batch timestamp.\\n * @param _blockNumber The latest batch blockNumber.\\n */\\n function _appendBatch(\\n bytes32 _transactionRoot,\\n uint256 _batchSize,\\n uint256 _numQueuedTransactions,\\n uint40 _timestamp,\\n uint40 _blockNumber\\n )\\n internal\\n {\\n (uint40 totalElements, uint40 nextQueueIndex, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n\\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: batches().length(),\\n batchRoot: _transactionRoot,\\n batchSize: _batchSize,\\n prevTotalElements: totalElements,\\n extraData: hex\\\"\\\"\\n });\\n\\n emit TransactionBatchAppended(\\n header.batchIndex,\\n header.batchRoot,\\n header.batchSize,\\n header.prevTotalElements,\\n header.extraData\\n );\\n\\n bytes32 batchHeaderHash = Lib_OVMCodec.hashBatchHeader(header);\\n bytes27 latestBatchContext = _makeBatchExtraData(\\n totalElements + uint40(header.batchSize),\\n nextQueueIndex + uint40(_numQueuedTransactions),\\n _timestamp,\\n _blockNumber\\n );\\n\\n batches().push(batchHeaderHash, latestBatchContext);\\n }\\n\\n /**\\n * Checks that the first batch context in a sequencer submission is valid\\n * @param _firstContext The batch context to validate.\\n */\\n function _validateFirstBatchContext(\\n BatchContext memory _firstContext\\n )\\n internal\\n view\\n {\\n // If there are existing elements, this batch must come later.\\n if (getTotalElements() > 0) {\\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\\n require(_firstContext.blockNumber >= lastBlockNumber, \\\"Context block number is lower than last submitted.\\\");\\n require(_firstContext.timestamp >= lastTimestamp, \\\"Context timestamp is lower than last submitted.\\\");\\n }\\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\\n require(_firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp, \\\"Context timestamp too far in the past.\\\");\\n require(_firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number, \\\"Context block number too far in the past.\\\");\\n }\\n\\n /**\\n * Checks that a given batch context is valid based on its previous context, and the next queue elemtent.\\n * @param _prevContext The previously validated batch context.\\n * @param _nextContext The batch context to validate with this call.\\n * @param _nextQueueIndex Index of the next queue element to process for the _nextContext's subsequentQueueElements.\\n */\\n function _validateNextBatchContext(\\n BatchContext memory _prevContext,\\n BatchContext memory _nextContext,\\n uint40 _nextQueueIndex\\n )\\n internal\\n view\\n {\\n // All sequencer transactions' times must increase from the previous ones.\\n require(\\n _nextContext.timestamp >= _prevContext.timestamp,\\n \\\"Context timestamp values must monotonically increase.\\\"\\n );\\n\\n require(\\n _nextContext.blockNumber >= _prevContext.blockNumber,\\n \\\"Context blockNumber values must monotonically increase.\\\"\\n );\\n\\n // If there are some queue elements pending:\\n if (getQueueLength() - _nextQueueIndex > 0) {\\n Lib_OVMCodec.QueueElement memory nextQueueElement = getQueueElement(_nextQueueIndex);\\n\\n // If the force inclusion period has passed for an enqueued transaction, it MUST be the next chain element.\\n require(\\n block.timestamp < nextQueueElement.timestamp + forceInclusionPeriodSeconds,\\n \\\"Previously enqueued batches have expired and must be appended before a new sequencer batch.\\\"\\n );\\n\\n // Just like sequencer transaction times must be increasing relative to each other,\\n // We also require that they be increasing relative to any interspersed queue elements.\\n require(\\n _nextContext.timestamp <= nextQueueElement.timestamp,\\n \\\"Sequencer transaction timestamp exceeds that of next queue element.\\\"\\n );\\n\\n require(\\n _nextContext.blockNumber <= nextQueueElement.blockNumber,\\n \\\"Sequencer transaction blockNumber exceeds that of next queue element.\\\"\\n );\\n }\\n }\\n\\n /**\\n * Checks that the final batch context in a sequencer submission is valid.\\n * @param _finalContext The batch context to validate.\\n */\\n function _validateFinalBatchContext(\\n BatchContext memory _finalContext\\n )\\n internal\\n view\\n {\\n // Batches cannot be added from the future, or subsequent enqueue() contexts would violate monotonicity.\\n require(_finalContext.timestamp <= block.timestamp, \\\"Context timestamp is from the future.\\\");\\n require(_finalContext.blockNumber <= block.number, \\\"Context block number is from the future.\\\");\\n }\\n\\n /**\\n * Hashes a transaction chain element.\\n * @param _element Chain element to hash.\\n * @return Hash of the chain element.\\n */\\n function _hashTransactionChainElement(\\n Lib_OVMCodec.TransactionChainElement memory _element\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _element.isSequenced,\\n _element.queueIndex,\\n _element.timestamp,\\n _element.blockNumber,\\n _element.txData\\n )\\n );\\n }\\n\\n /**\\n * Verifies a sequencer transaction, returning true if it was indeed included in the CTC\\n * @param _transaction The transaction we are verifying inclusion of.\\n * @param _txChainElement The chain element that the transaction is claimed to be a part of.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof An inclusion proof into the CTC at a particular index.\\n * @return True if the transaction was included in the specified location, else false.\\n */\\n function _verifySequencerTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n OVM_ExecutionManager ovmExecutionManager = OVM_ExecutionManager(resolve(\\\"OVM_ExecutionManager\\\"));\\n uint256 gasLimit = ovmExecutionManager.getMaxTransactionGasLimit();\\n bytes32 leafHash = _getSequencerLeafHash(_txChainElement);\\n\\n require(\\n _verifyElement(\\n leafHash,\\n _batchHeader,\\n _inclusionProof\\n ),\\n \\\"Invalid Sequencer transaction inclusion proof.\\\"\\n );\\n\\n require(\\n _transaction.blockNumber == _txChainElement.blockNumber\\n && _transaction.timestamp == _txChainElement.timestamp\\n && _transaction.entrypoint == resolve(\\\"OVM_DecompressionPrecompileAddress\\\")\\n && _transaction.gasLimit == gasLimit\\n && _transaction.l1TxOrigin == address(0)\\n && _transaction.l1QueueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE\\n && keccak256(_transaction.data) == keccak256(_txChainElement.txData),\\n \\\"Invalid Sequencer transaction.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * Verifies a queue transaction, returning true if it was indeed included in the CTC\\n * @param _transaction The transaction we are verifying inclusion of.\\n * @param _queueIndex The queueIndex of the queued transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof An inclusion proof into the CTC at a particular index (should point to queue tx).\\n * @return True if the transaction was included in the specified location, else false.\\n */\\n function _verifyQueueTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n uint256 _queueIndex,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 leafHash = _getQueueLeafHash(_queueIndex);\\n\\n require(\\n _verifyElement(\\n leafHash,\\n _batchHeader,\\n _inclusionProof\\n ),\\n \\\"Invalid Queue transaction inclusion proof.\\\"\\n );\\n\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n )\\n );\\n\\n Lib_OVMCodec.QueueElement memory el = getQueueElement(_queueIndex);\\n require(\\n el.queueRoot == transactionHash\\n && el.timestamp == _transaction.timestamp\\n && el.blockNumber == _transaction.blockNumber,\\n \\\"Invalid Queue transaction.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function _verifyElement(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n require(\\n Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(uint32(_batchHeader.batchIndex)),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n Lib_MerkleTree.verify(\\n _batchHeader.batchRoot,\\n _element,\\n _proof.index,\\n _proof.siblings,\\n _batchHeader.batchSize\\n ),\\n \\\"Invalid inclusion proof.\\\"\\n );\\n\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0xdc14bda01b44a00fa571cac5f2b5b2d8add7f05f5bc0b44abc129d1cec6c59c6\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ECDSAContractAccount } from \\\"../accounts/OVM_ECDSAContractAccount.sol\\\";\\nimport { OVM_ProxyEOA } from \\\"../accounts/OVM_ProxyEOA.sol\\\";\\nimport { OVM_DeployerWhitelist } from \\\"../precompiles/OVM_DeployerWhitelist.sol\\\";\\n\\n/**\\n * @title OVM_ExecutionManager\\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\\n * Layer 2.\\n * The EM's run() function is the first function called during the execution of any\\n * transaction on L2.\\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\\n * OVM operation, which will read state from the State Manager contract.\\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\\n * context-dependent operations.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n iOVM_SafetyChecker internal ovmSafetyChecker;\\n iOVM_StateManager internal ovmStateManager;\\n\\n\\n /*******************************\\n * Execution Context Variables *\\n *******************************/\\n\\n GasMeterConfig internal gasMeterConfig;\\n GlobalContext internal globalContext;\\n TransactionContext internal transactionContext;\\n MessageContext internal messageContext;\\n TransactionRecord internal transactionRecord;\\n MessageRecord internal messageRecord;\\n\\n\\n /**************************\\n * Gas Metering Constants *\\n **************************/\\n\\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n GasMeterConfig memory _gasMeterConfig,\\n GlobalContext memory _globalContext\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\\n * @param _cost Desired gas cost for the function after the refund.\\n */\\n modifier netGasCost(\\n uint256 _cost\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund everything *except* the specified cost.\\n if (_cost < gasUsed) {\\n transactionRecord.ovmGasRefund += gasUsed - _cost;\\n }\\n }\\n\\n /**\\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\\n */\\n modifier fixedGasDiscount(\\n uint256 _discount\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund the specified _discount, unless this risks underflow.\\n if (_discount < gasUsed) {\\n transactionRecord.ovmGasRefund += _discount;\\n } else {\\n // refund all we can without risking underflow.\\n transactionRecord.ovmGasRefund += gasUsed;\\n }\\n }\\n\\n /**\\n * Makes sure we're not inside a static context.\\n */\\n modifier notStatic() {\\n if (messageContext.isStatic == true) {\\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\\n }\\n _;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n /**\\n * Starts the execution of a transaction via the OVM_ExecutionManager.\\n * @param _transaction Transaction data to be executed.\\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\\n */\\n function run(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _ovmStateManager\\n )\\n override\\n public\\n {\\n require(transactionContext.ovmNUMBER == 0, \\\"Only be callable at the start of a transaction\\\");\\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\\n // address around in calldata).\\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\\n\\n // Make sure this function can't be called by anyone except the owner of the\\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\\n // this would make the `run` itself invalid.\\n require(\\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\\n ovmStateManager.isAuthenticated(msg.sender),\\n \\\"Only authenticated addresses in ovmStateManager can call this function\\\"\\n );\\n\\n // Initialize the execution context, must be initialized before we perform any gas metering\\n // or we'll throw a nuisance gas error.\\n _initContext(_transaction);\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Check whether we need to start a new epoch, do so if necessary.\\n // _checkNeedsNewEpoch(_transaction.timestamp);\\n\\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\\n // reverts for INVALID_STATE_ACCESS.\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return;\\n }\\n\\n // Check gas right before the call to get total gas consumed by OVM transaction.\\n uint256 gasProvided = gasleft();\\n\\n // Run the transaction, make sure to meter the gas usage.\\n ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************\\n * Opcodes: Execution Context *\\n ******************************/\\n\\n /**\\n * @notice Overrides CALLER.\\n * @return _CALLER Address of the CALLER within the current message context.\\n */\\n function ovmCALLER()\\n override\\n public\\n view\\n returns (\\n address _CALLER\\n )\\n {\\n return messageContext.ovmCALLER;\\n }\\n\\n /**\\n * @notice Overrides ADDRESS.\\n * @return _ADDRESS Active ADDRESS within the current message context.\\n */\\n function ovmADDRESS()\\n override\\n public\\n view\\n returns (\\n address _ADDRESS\\n )\\n {\\n return messageContext.ovmADDRESS;\\n }\\n\\n /**\\n * @notice Overrides TIMESTAMP.\\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\\n */\\n function ovmTIMESTAMP()\\n override\\n public\\n view\\n returns (\\n uint256 _TIMESTAMP\\n )\\n {\\n return transactionContext.ovmTIMESTAMP;\\n }\\n\\n /**\\n * @notice Overrides NUMBER.\\n * @return _NUMBER Value of the NUMBER within the transaction context.\\n */\\n function ovmNUMBER()\\n override\\n public\\n view\\n returns (\\n uint256 _NUMBER\\n )\\n {\\n return transactionContext.ovmNUMBER;\\n }\\n\\n /**\\n * @notice Overrides GASLIMIT.\\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\\n */\\n function ovmGASLIMIT()\\n override\\n public\\n view\\n returns (\\n uint256 _GASLIMIT\\n )\\n {\\n return transactionContext.ovmGASLIMIT;\\n }\\n\\n /**\\n * @notice Overrides CHAINID.\\n * @return _CHAINID Value of the chain's CHAINID within the global context.\\n */\\n function ovmCHAINID()\\n override\\n public\\n view\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n return globalContext.ovmCHAINID;\\n }\\n\\n /*********************************\\n * Opcodes: L2 Execution Context *\\n *********************************/\\n\\n /**\\n * @notice Specifies from which L1 rollup queue this transaction originated from.\\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n {\\n return transactionContext.ovmL1QUEUEORIGIN;\\n }\\n\\n /**\\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\\n */\\n function ovmL1TXORIGIN()\\n override\\n public\\n view\\n returns (\\n address _l1TxOrigin\\n )\\n {\\n return transactionContext.ovmL1TXORIGIN;\\n }\\n\\n /********************\\n * Opcodes: Halting *\\n ********************/\\n\\n /**\\n * @notice Overrides REVERT.\\n * @param _data Bytes data to pass along with the REVERT.\\n */\\n function ovmREVERT(\\n bytes memory _data\\n )\\n override\\n public\\n {\\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\\n }\\n\\n\\n /******************************\\n * Opcodes: Contract Creation *\\n ******************************/\\n\\n /**\\n * @notice Overrides CREATE.\\n * @param _bytecode Code to be used to CREATE a new contract.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\\n creator,\\n _getAccountNonce(creator)\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n /**\\n * @notice Overrides CREATE2.\\n * @param _bytecode Code to be used to CREATE2 a new contract.\\n * @param _salt Value used to determine the contract's address.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE2 address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\\n creator,\\n _bytecode,\\n _salt\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n /**\\n * Retrieves the nonce of the current ovmADDRESS.\\n * @return _nonce Nonce of the current contract.\\n */\\n function ovmGETNONCE()\\n override\\n public\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Sets the nonce of the current ovmADDRESS.\\n * @param _nonce New nonce for the current contract.\\n */\\n function ovmSETNONCE(\\n uint256 _nonce\\n )\\n override\\n public\\n notStatic\\n {\\n _setAccountNonce(ovmADDRESS(), _nonce);\\n }\\n\\n /**\\n * Creates a new EOA contract account, for account abstraction.\\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\\n * because the contract we're creating is trusted (no need to do safety checking or to\\n * handle unexpected reverts). Doesn't need to return an address because the address is\\n * assumed to be the user's actual address.\\n * @param _messageHash Hash of a message signed by some user, for verification.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n */\\n function ovmCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n notStatic\\n {\\n // Recover the EOA address from the message hash and signature parameters. Since we do the\\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\\n // function were to return the wrong address (rather than explicitly returning the zero\\n // address), the rest of the transaction would simply fail (since there's no EOA account to\\n // actually execute the transaction).\\n address eoa = ecrecover(\\n _messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n\\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\\n // have this function return a `success` boolean, but this is just easier.\\n if (eoa == address(0)) {\\n ovmREVERT(bytes(\\\"Signature provided for EOA contract creation is invalid.\\\"));\\n }\\n\\n // If the user already has an EOA account, then there's no need to perform this operation.\\n if (_hasEmptyAccount(eoa) == false) {\\n return;\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(eoa);\\n\\n // Temporarily set the current address so it's easier to access on L2.\\n address prevADDRESS = messageContext.ovmADDRESS;\\n messageContext.ovmADDRESS = eoa;\\n\\n // Now actually create the account and get its bytecode. We're not worried about reverts\\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\\n\\n // Reset the address now that we're done deploying.\\n messageContext.ovmADDRESS = prevADDRESS;\\n\\n // Commit the account with its final values.\\n _commitPendingAccount(\\n eoa,\\n address(proxyEOA),\\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\\n );\\n\\n _setAccountNonce(eoa, 0);\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Interaction *\\n *********************************/\\n\\n /**\\n * @notice Overrides CALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(100000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // CALL updates the CALLER and ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides STATICCALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmSTATICCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(80000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides DELEGATECALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmDELEGATECALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(40000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // DELEGATECALL does not change anything about the message context.\\n MessageContext memory nextMessageContext = messageContext;\\n bool isStaticEntrypoint = false;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n\\n /************************************\\n * Opcodes: Contract Storage Access *\\n ************************************/\\n\\n /**\\n * @notice Overrides SLOAD.\\n * @param _key 32 byte key of the storage slot to load.\\n * @return _value 32 byte value of the requested storage slot.\\n */\\n function ovmSLOAD(\\n bytes32 _key\\n )\\n override\\n public\\n netGasCost(40000)\\n returns (\\n bytes32 _value\\n )\\n {\\n // We always SLOAD from the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n return _getContractStorage(\\n contractAddress,\\n _key\\n );\\n }\\n\\n /**\\n * @notice Overrides SSTORE.\\n * @param _key 32 byte key of the storage slot to set.\\n * @param _value 32 byte value for the storage slot.\\n */\\n function ovmSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n notStatic\\n netGasCost(60000)\\n {\\n // We always SSTORE to the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n _putContractStorage(\\n contractAddress,\\n _key,\\n _value\\n );\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Code Access *\\n *********************************/\\n\\n /**\\n * @notice Overrides EXTCODECOPY.\\n * @param _contract Address of the contract to copy code from.\\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\\n * @param _length Total number of bytes to copy from the contract's code.\\n * @return _code Bytes of code copied from the requested contract.\\n */\\n function ovmEXTCODECOPY(\\n address _contract,\\n uint256 _offset,\\n uint256 _length\\n )\\n override\\n public\\n returns (\\n bytes memory _code\\n )\\n {\\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\\n // return data. By blocking reads of one byte, we're able to use the condition that an\\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\\n // an error without an explicit revert. If users were able to read a single byte, they\\n // could forcibly trigger behavior that should only be available to this contract.\\n uint256 length = _length == 1 ? 2 : _length;\\n\\n return Lib_EthUtils.getCode(\\n _getAccountEthAddress(_contract),\\n _offset,\\n length\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODESIZE.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function ovmEXTCODESIZE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n return Lib_EthUtils.getCodeSize(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODEHASH.\\n * @param _contract Address of the contract to query the hash of.\\n * @return _EXTCODEHASH Hash of the requested contract.\\n */\\n function ovmEXTCODEHASH(\\n address _contract\\n )\\n override\\n public\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n /**\\n * Performs the logic to create a contract and revert under various potential conditions.\\n * @dev This function is implemented as `public` because we need to be able to revert a\\n * contract creation without losing information about exactly *why* the contract reverted.\\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\\n * flag and then revert to reset the flag. We're able to do this by making an external\\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\\n * information before reverting.\\n * @param _address Address of the contract to associate with the one being created.\\n * @param _bytecode Code to be used to create the new contract.\\n */\\n function safeCREATE(\\n address _address,\\n bytes memory _bytecode\\n )\\n override\\n public\\n {\\n // Since this function is public, anyone can attempt to directly call it. We need to make\\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\\n // call this function.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n\\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\\n // some existing contract. On L1, users will prove that no contract exists at the address\\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\\n // value that represents \\\"known to be an empty account.\\\"\\n if (_hasEmptyAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\\n // complexity because we need to ensure that contract creation *never* reverts by itself.\\n // We cover this partially by storing a revert flag and returning (instead of reverting)\\n // when we know that we're inside a contract's creation code.\\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\\n\\n // Contract creation returns the zero address when it fails, which should only be possible\\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\\n // explicitly handle this case here.\\n if (ethAddress == address(0)) {\\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\\n }\\n\\n // Here we pull out the revert flag that would've been set during creation code. Now that\\n // we're out of creation code again, we can just revert normally while passing the flag\\n // through the revert data.\\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\\n _revertWithFlag(messageRecord.revertFlag);\\n }\\n\\n // Again simply checking that the deployed code is safe too. Contracts can generate\\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\\n // associating the desired address with the newly created contract's code hash and address.\\n _commitPendingAccount(\\n _address,\\n ethAddress,\\n Lib_EthUtils.getCodeHash(ethAddress)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit()\\n external\\n view\\n override\\n returns (\\n uint256 _maxTransactionGasLimit\\n )\\n {\\n return gasMeterConfig.maxTransactionGasLimit;\\n }\\n\\n /********************************************\\n * Public Functions: Deployment Witelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\\n * @param _deployerAddress Address attempting to deploy a contract.\\n */\\n function _checkDeployerAllowed(\\n address _deployerAddress\\n )\\n internal\\n {\\n // From an OVM semanitcs perspectibe, this will appear the identical to\\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\\n (bool success, bytes memory data) = ovmCALL(\\n gasleft(),\\n 0x4200000000000000000000000000000000000002,\\n abi.encodeWithSignature(\\\"isDeployerAllowed(address)\\\", _deployerAddress)\\n );\\n bool isAllowed = abi.decode(data, (bool));\\n\\n if (!isAllowed || !success) {\\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\\n }\\n }\\n\\n /********************************************\\n * Internal Functions: Contract Interaction *\\n ********************************************/\\n\\n /**\\n * Creates a new contract and associates it with some contract address.\\n * @param _contractAddress Address to associate the created contract with.\\n * @param _bytecode Bytecode to be used to create the contract.\\n * @return _created Final OVM contract address.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n // We always update the nonce of the creating account, even if the creation fails.\\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\\n\\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _contractAddress;\\n\\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\\n // `safeCREATE` reverts.\\n (bool _success, ) = _handleExternalInteraction(\\n nextMessageContext,\\n gasleft(),\\n address(this),\\n abi.encodeWithSignature(\\n \\\"safeCREATE(address,bytes)\\\",\\n _contractAddress,\\n _bytecode\\n )\\n );\\n\\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\\n // some parent EVM message.\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return _success ? _contractAddress : address(0);\\n }\\n\\n /**\\n * Calls the deployed contract associated with a given address.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _contract OVM address to be called.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _callContract(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\\n if (\\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\\n ) {\\n return (true, hex'');\\n }\\n\\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalInteraction(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata\\n );\\n }\\n\\n /**\\n * Handles the logic of making an external call and parsing revert information.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _target Address of the contract to call.\\n * @param _data Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _handleExternalInteraction(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _data\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We need to switch over to our next message context for the duration of this call.\\n MessageContext memory prevMessageContext = messageContext;\\n _switchMessageContext(prevMessageContext, _nextMessageContext);\\n\\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\\n // factor.\\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\\n\\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\\n // behavior can be controlled. In particular, we enforce that flags are passed through\\n // revert data as to retrieve execution metadata that would normally be reverted out of\\n // existence.\\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\\n\\n // Switch back to the original message context now that we're out of the call.\\n _switchMessageContext(_nextMessageContext, prevMessageContext);\\n\\n // Assuming there were no reverts, the message record should be accurate here. We'll update\\n // this value in the case of a revert.\\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n\\n // Reverts at this point are completely OK, but we need to make a few updates based on the\\n // information passed through the revert.\\n if (success == false) {\\n (\\n RevertFlag flag,\\n uint256 nuisanceGasLeftPostRevert,\\n uint256 ovmGasRefund,\\n bytes memory returndataFromFlag\\n ) = _decodeRevertData(returndata);\\n\\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\\n // halt any further transaction execution that could impact the execution result.\\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\\n _revertWithFlag(flag);\\n }\\n\\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\\n // is to record the gas refund reported by the call (enforced by safety checking).\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n || flag == RevertFlag.STATIC_VIOLATION\\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\\n ) {\\n transactionRecord.ovmGasRefund = ovmGasRefund;\\n }\\n\\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\\n // flag, *not* the full encoded flag. All other revert types return no data.\\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\\n returndata = returndataFromFlag;\\n } else {\\n returndata = hex'';\\n }\\n\\n // Reverts mean we need to use up whatever \\\"nuisance gas\\\" was used by the call.\\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\\n // to zero. OUT_OF_GAS is a \\\"pseudo\\\" flag given that messages return no data when they\\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\\n // will simply pass up the remaining nuisance gas.\\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\\n }\\n\\n // We need to reset the nuisance gas back to its original value minus the amount used here.\\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\\n\\n return (\\n success,\\n returndata\\n );\\n }\\n\\n\\n /******************************************\\n * Internal Functions: State Manipulation *\\n ******************************************/\\n\\n /**\\n * Checks whether an account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account exists.\\n */\\n function _hasAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasAccount(_address);\\n }\\n\\n /**\\n * Checks whether a known empty account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account empty exists.\\n */\\n function _hasEmptyAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasEmptyAccount(_address);\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function _setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.setAccountNonce(_address, _nonce);\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function _getAccountNonce(\\n address _address\\n )\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountNonce(_address);\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function _getAccountEthAddress(\\n address _address\\n )\\n internal\\n returns (\\n address _ethAddress\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountEthAddress(_address);\\n }\\n\\n /**\\n * Creates the default account object for the given address.\\n * @param _address Address of the account create.\\n */\\n function _initPendingAccount(\\n address _address\\n )\\n internal\\n {\\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\\n // actually consider an account \\\"changed\\\" until it's inserted into the state (in this case\\n // by `_commitPendingAccount`).\\n _checkAccountLoad(_address);\\n ovmStateManager.initPendingAccount(_address);\\n }\\n\\n /**\\n * Stores additional relevant data for a new account, thereby \\\"committing\\\" it to the state.\\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\\n * creation.\\n * @param _address Address of the account to commit.\\n * @param _ethAddress Address of the associated deployed contract.\\n * @param _codeHash Hash of the code stored at the address.\\n */\\n function _commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.commitPendingAccount(\\n _address,\\n _ethAddress,\\n _codeHash\\n );\\n }\\n\\n /**\\n * Retrieves the value of a storage slot.\\n * @param _contract Address of the contract to query.\\n * @param _key 32 byte key of the storage slot.\\n * @return _value 32 byte storage slot value.\\n */\\n function _getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32 _value\\n )\\n {\\n _checkContractStorageLoad(_contract, _key);\\n return ovmStateManager.getContractStorage(_contract, _key);\\n }\\n\\n /**\\n * Sets the value of a storage slot.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte key of the storage slot.\\n * @param _value 32 byte storage slot value.\\n */\\n function _putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n // We don't set storage if the value didn't change. Although this acts as a convenient\\n // optimization, it's also necessary to avoid the case in which a contract with no storage\\n // attempts to store the value \\\"0\\\" at any key. Putting this value (and therefore requiring\\n // that the value be committed into the storage trie after execution) would incorrectly\\n // modify the storage root.\\n if (_getContractStorage(_contract, _key) == _value) {\\n return;\\n }\\n\\n _checkContractStorageChange(_contract, _key);\\n ovmStateManager.putContractStorage(_contract, _key, _value);\\n }\\n\\n /**\\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been loaded before.\\n * @param _address Address of the account to load.\\n */\\n function _checkAccountLoad(\\n address _address\\n )\\n internal\\n {\\n // See `_checkContractStorageLoad` for more information.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // See `_checkContractStorageLoad` for more information.\\n if (ovmStateManager.hasAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the account has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is loaded.\\n (\\n bool _wasAccountAlreadyLoaded\\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyLoaded == false) {\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been changed before.\\n * @param _address Address of the account to change.\\n */\\n function _checkAccountChange(\\n address _address\\n )\\n internal\\n {\\n // Start by checking for a load as we only want to charge nuisance gas proportional to\\n // contract size once.\\n _checkAccountLoad(_address);\\n\\n // Check whether the account has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is changed.\\n (\\n bool _wasAccountAlreadyChanged\\n ) = ovmStateManager.testAndSetAccountChanged(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyChanged == false) {\\n ovmStateManager.incrementTotalUncommittedAccounts();\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been loaded before.\\n * @param _contract Address of the account to load from.\\n * @param _key 32 byte key to load.\\n */\\n function _checkContractStorageLoad(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\\n // on L1 but not on L2. A contract could use this behavior to prevent the\\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\\n // allows us to also charge for the full message nuisance gas, because you deserve that for\\n // trying to break the contract in this way.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // We need to make sure that the transaction isn't trying to access storage that hasn't\\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\\n // We know that we have enough gas to do this check because of the above test.\\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is loaded.\\n (\\n bool _wasContractStorageAlreadyLoaded\\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\\n\\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyLoaded == false) {\\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been changed before.\\n * @param _contract Address of the account to change.\\n * @param _key 32 byte key to change.\\n */\\n function _checkContractStorageChange(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Start by checking for load to make sure we have the storage slot and that we charge the\\n // \\\"nuisance gas\\\" necessary to prove the storage slot state.\\n _checkContractStorageLoad(_contract, _key);\\n\\n // Check whether the slot has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is changed.\\n (\\n bool _wasContractStorageAlreadyChanged\\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\\n\\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyChanged == false) {\\n // Changing a storage slot means that we're also going to have to change the\\n // corresponding account, so do an account change check.\\n _checkAccountChange(_contract);\\n\\n ovmStateManager.incrementTotalUncommittedContractStorage();\\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\\n }\\n }\\n\\n\\n /************************************\\n * Internal Functions: Revert Logic *\\n ************************************/\\n\\n /**\\n * Simple encoding for revert data.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided revert data.\\n * @return _revertdata Encoded revert data.\\n */\\n function _encodeRevertData(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n view\\n returns (\\n bytes memory _revertdata\\n )\\n {\\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\\n if (\\n _flag == RevertFlag.OUT_OF_GAS\\n || _flag == RevertFlag.CREATE_EXCEPTION\\n ) {\\n return bytes('');\\n }\\n\\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\\n return abi.encode(\\n _flag,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // Just ABI encode the rest of the parameters.\\n return abi.encode(\\n _flag,\\n messageRecord.nuisanceGasLeft,\\n transactionRecord.ovmGasRefund,\\n _data\\n );\\n }\\n\\n /**\\n * Simple decoding for revert data.\\n * @param _revertdata Revert data to decode.\\n * @return _flag Flag used to revert.\\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\\n * @return _ovmGasRefund Amount of gas refunded during the message.\\n * @return _data Additional user-provided revert data.\\n */\\n function _decodeRevertData(\\n bytes memory _revertdata\\n )\\n internal\\n pure\\n returns (\\n RevertFlag _flag,\\n uint256 _nuisanceGasLeft,\\n uint256 _ovmGasRefund,\\n bytes memory _data\\n )\\n {\\n // A length of zero means the call ran out of gas, just return empty data.\\n if (_revertdata.length == 0) {\\n return (\\n RevertFlag.OUT_OF_GAS,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // ABI decode the incoming data.\\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided data.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n {\\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\\n // thinking there was a failure.\\n bool isCreation;\\n assembly {\\n isCreation := eq(extcodesize(caller()), 0)\\n }\\n\\n if (isCreation) {\\n messageRecord.revertFlag = _flag;\\n\\n assembly {\\n return(0, 1)\\n }\\n }\\n\\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\\n // revert normally.\\n bytes memory revertdata = _encodeRevertData(\\n _flag,\\n _data\\n );\\n\\n assembly {\\n revert(add(revertdata, 0x20), mload(revertdata))\\n }\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag\\n )\\n internal\\n {\\n _revertWithFlag(_flag, bytes(''));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Nuisance Gas Logic *\\n ******************************************/\\n\\n /**\\n * Computes the nuisance gas limit from the gas limit.\\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\\n * this implementation is perfectly fine, but we may change this formula later.\\n * @param _gasLimit Gas limit to compute from.\\n * @return _nuisanceGasLimit Computed nuisance gas limit.\\n */\\n function _getNuisanceGasLimit(\\n uint256 _gasLimit\\n )\\n internal\\n view\\n returns (\\n uint256 _nuisanceGasLimit\\n )\\n {\\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\\n }\\n\\n /**\\n * Uses a certain amount of nuisance gas.\\n * @param _amount Amount of nuisance gas to use.\\n */\\n function _useNuisanceGas(\\n uint256 _amount\\n )\\n internal\\n {\\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\\n // refund to be given at the end of the transaction.\\n if (messageRecord.nuisanceGasLeft < _amount) {\\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\\n }\\n\\n messageRecord.nuisanceGasLeft -= _amount;\\n }\\n\\n\\n /************************************\\n * Internal Functions: Gas Metering *\\n ************************************/\\n\\n /**\\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\\n * @param _timestamp Transaction timestamp.\\n */\\n function _checkNeedsNewEpoch(\\n uint256 _timestamp\\n )\\n internal\\n {\\n if (\\n _timestamp >= (\\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\\n + gasMeterConfig.secondsPerEpoch\\n )\\n ) {\\n _putGasMetadata(\\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\\n _timestamp\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\\n )\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\\n )\\n );\\n }\\n }\\n\\n /**\\n * Validates the gas limit for a given transaction.\\n * @param _gasLimit Gas limit provided by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n * @return _valid Whether or not the gas limit is valid.\\n */\\n function _isValidGasLimit(\\n uint256 _gasLimit,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n returns (\\n bool _valid\\n )\\n {\\n // Always have to be below the maximum gas limit.\\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\\n return false;\\n }\\n\\n // Always have to be above the minimum gas limit.\\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\\n return false;\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n return true;\\n // GasMetadataKey cumulativeGasKey;\\n // GasMetadataKey prevEpochGasKey;\\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\\n // } else {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\\n // }\\n\\n // return (\\n // (\\n // _getGasMetadata(cumulativeGasKey)\\n // - _getGasMetadata(prevEpochGasKey)\\n // + _gasLimit\\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\\n // );\\n }\\n\\n /**\\n * Updates the cumulative gas after a transaction.\\n * @param _gasUsed Gas used by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n */\\n function _updateCumulativeGas(\\n uint256 _gasUsed,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n {\\n GasMetadataKey cumulativeGasKey;\\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n } else {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n }\\n\\n _putGasMetadata(\\n cumulativeGasKey,\\n (\\n _getGasMetadata(cumulativeGasKey)\\n + gasMeterConfig.minTransactionGasLimit\\n + _gasUsed\\n - transactionRecord.ovmGasRefund\\n )\\n );\\n }\\n\\n /**\\n * Retrieves the value of a gas metadata key.\\n * @param _key Gas metadata key to retrieve.\\n * @return _value Value stored at the given key.\\n */\\n function _getGasMetadata(\\n GasMetadataKey _key\\n )\\n internal\\n returns (\\n uint256 _value\\n )\\n {\\n return uint256(_getContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key))\\n ));\\n }\\n\\n /**\\n * Sets the value of a gas metadata key.\\n * @param _key Gas metadata key to set.\\n * @param _value Value to store at the given key.\\n */\\n function _putGasMetadata(\\n GasMetadataKey _key,\\n uint256 _value\\n )\\n internal\\n {\\n _putContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key)),\\n bytes32(uint256(_value))\\n );\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Execution Context *\\n *****************************************/\\n\\n /**\\n * Swaps over to a new message context.\\n * @param _prevMessageContext Context we're switching from.\\n * @param _nextMessageContext Context we're switching to.\\n */\\n function _switchMessageContext(\\n MessageContext memory _prevMessageContext,\\n MessageContext memory _nextMessageContext\\n )\\n internal\\n {\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n }\\n\\n /**\\n * Initializes the execution context.\\n * @param _transaction OVM transaction being executed.\\n */\\n function _initContext(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n internal\\n {\\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\\n transactionContext.ovmNUMBER = _transaction.blockNumber;\\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\\n\\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\\n }\\n\\n /**\\n * Resets the transaction and message context.\\n */\\n function _resetContext()\\n internal\\n {\\n transactionContext.ovmL1TXORIGIN = address(0);\\n transactionContext.ovmTIMESTAMP = 0;\\n transactionContext.ovmNUMBER = 0;\\n transactionContext.ovmGASLIMIT = 0;\\n transactionContext.ovmTXGASLIMIT = 0;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = 0;\\n\\n messageContext.ovmCALLER = address(0);\\n messageContext.ovmADDRESS = address(0);\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = 0;\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n }\\n\\n /*****************************\\n * L2-only Helper Functions *\\n *****************************/\\n\\n /**\\n * Unreachable helper function for simulating eth_calls with an OVM message context.\\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\\n * @param _transaction the message transaction to simulate.\\n * @param _from the OVM account the simulated call should be from.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n // Prevent this call from having any effect unless in a custom-set VM frame\\n require(msg.sender == address(0));\\n\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n\\n messageRecord.nuisanceGasLeft = uint(-1);\\n messageContext.ovmADDRESS = _transaction.entrypoint;\\n messageContext.ovmCALLER = _from;\\n\\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\\n }\\n}\\n\",\"keccak256\":\"0x5432ac3e92c78d3bc9faf52e4081cd95b4b6d7858ce14636822f1b2c41cfcc43\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_DeployerWhitelist\\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \\n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n \\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n address owner = Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\\n \\\"Function can only be called by the owner of this contract.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n \\n /**\\n * Initializes the whitelist.\\n * @param _owner Address of the owner for this contract.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function initialize(\\n address _owner,\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == true) {\\n return;\\n }\\n\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_INITIALIZED,\\n Lib_Bytes32Utils.fromBool(true)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Gets the owner of the whitelist.\\n */\\n function getOwner()\\n override\\n public\\n returns(\\n address\\n )\\n {\\n return Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n }\\n\\n /**\\n * Adds or removes an address from the deployment whitelist.\\n * @param _deployer Address to update permissions for.\\n * @param _isWhitelisted Whether or not the address is whitelisted.\\n */\\n function setWhitelistedDeployer(\\n address _deployer,\\n bool _isWhitelisted\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n Lib_Bytes32Utils.fromAddress(_deployer),\\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\\n );\\n }\\n\\n /**\\n * Updates the owner of this contract.\\n * @param _owner Address of the new owner.\\n */\\n function setOwner(\\n address _owner\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n }\\n\\n /**\\n * Updates the arbitrary deployment flag.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function setAllowArbitraryDeployment(\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n public\\n onlyOwner\\n {\\n setAllowArbitraryDeployment(true);\\n setOwner(address(0));\\n }\\n\\n /**\\n * Checks whether an address is allowed to deploy contracts.\\n * @param _deployer Address to check.\\n * @return _allowed Whether or not the address can deploy contracts.\\n */\\n function isDeployerAllowed(\\n address _deployer\\n )\\n override\\n public\\n returns (\\n bool _allowed\\n )\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == false) {\\n return true;\\n }\\n\\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\\n );\\n\\n if (allowArbitraryDeployment == true) {\\n return true;\\n }\\n\\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n Lib_Bytes32Utils.fromAddress(_deployer)\\n )\\n );\\n\\n return isWhitelisted; \\n }\\n}\\n\",\"keccak256\":\"0x8737cfb9c47bf262eb16b80ca9111e0b347b1fe06c517569907056b8e2f28aaf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_ECDSAContractAccount\\n */\\ninterface iOVM_ECDSAContractAccount {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external returns (bool _success, bytes memory _returndata);\\n}\\n\",\"keccak256\":\"0x308729bc62dcffb11ff1d840781105cf1bf0dd4cbcfb1af704b800bb0cfe9b85\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_DeployerWhitelist\\n */\\ninterface iOVM_DeployerWhitelist {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\\n function getOwner() external returns (address _owner);\\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\\n function setOwner(address _newOwner) external;\\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\\n function enableArbitraryContractDeployment() external;\\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\\n}\\n\",\"keccak256\":\"0x969394371cacfc36493230150b6d629173ea72dfdf729330bede475b91d0f004\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_ECDSAUtils\\n */\\nlibrary Lib_ECDSAUtils {\\n\\n /**************************************\\n * Internal Functions: ECDSA Recovery *\\n **************************************/\\n\\n /**\\n * Recovers a signed address given a message and signature.\\n * @param _message Message that was originally signed.\\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _sender Signer address.\\n */\\n function recover(\\n bytes memory _message,\\n bool _isEthSignedMessage,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n pure\\n returns (\\n address _sender\\n )\\n {\\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\\n\\n return ecrecover(\\n messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n }\\n\\n function getMessageHash(\\n bytes memory _message,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (bytes32) {\\n if (_isEthSignedMessage) {\\n return getEthSignedMessageHash(_message);\\n }\\n return getNativeMessageHash(_message);\\n }\\n\\n\\n /*************************************\\n * Private Functions: ECDSA Recovery *\\n *************************************/\\n\\n /**\\n * Gets the native message hash (simple keccak256) for a message.\\n * @param _message Message to hash.\\n * @return _messageHash Native message hash.\\n */\\n function getNativeMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n return keccak256(_message);\\n }\\n\\n /**\\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\\n * @param _message Message to hash.\\n * @return _messageHash Prefixed message hash.\\n */\\n function getEthSignedMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n bytes memory prefix = \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\";\\n bytes32 messageHash = keccak256(_message);\\n return keccak256(abi.encodePacked(prefix, messageHash));\\n }\\n}\",\"keccak256\":\"0xda865d8cc014940a4755e329db9c6272a31bd9a340000a4ecc005d46299a585c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Math\\n */\\nlibrary Lib_Math {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates the minumum of two numbers.\\n * @param _x First number to compare.\\n * @param _y Second number to compare.\\n * @return Lesser of the two numbers.\\n */\\n function min(\\n uint256 _x,\\n uint256 _y\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n if (_x < _y) {\\n return _x;\\n }\\n\\n return _y;\\n }\\n}\\n\",\"keccak256\":\"0xcc36559529e708e99b8fd2ab0078fcba5a1f81787b08c1cf4cd46288ad64ee58\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_MerkleTree\\n * @author River Keefer\\n */\\nlibrary Lib_MerkleTree {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\\n * If you do not know the original length of elements for the tree you are verifying,\\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\\n * @param _elements Array of hashes from which to generate a merkle root.\\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\\n */\\n function getMerkleRoot(\\n bytes32[] memory _elements\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _elements.length > 0,\\n \\\"Lib_MerkleTree: Must provide at least one leaf hash.\\\"\\n );\\n\\n if (_elements.length == 0) {\\n return _elements[0];\\n }\\n\\n uint256[16] memory defaults = [\\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\\n ];\\n\\n // Reserve memory space for our hashes.\\n bytes memory buf = new bytes(64);\\n\\n // We'll need to keep track of left and right siblings.\\n bytes32 leftSibling;\\n bytes32 rightSibling;\\n\\n // Number of non-empty nodes at the current depth.\\n uint256 rowSize = _elements.length;\\n\\n // Current depth, counting from 0 at the leaves\\n uint256 depth = 0;\\n\\n // Common sub-expressions\\n uint256 halfRowSize; // rowSize / 2\\n bool rowSizeIsOdd; // rowSize % 2 == 1\\n\\n while (rowSize > 1) {\\n halfRowSize = rowSize / 2;\\n rowSizeIsOdd = rowSize % 2 == 1;\\n\\n for (uint256 i = 0; i < halfRowSize; i++) {\\n leftSibling = _elements[(2 * i) ];\\n rightSibling = _elements[(2 * i) + 1];\\n assembly {\\n mstore(add(buf, 32), leftSibling )\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[i] = keccak256(buf);\\n }\\n\\n if (rowSizeIsOdd) {\\n leftSibling = _elements[rowSize - 1];\\n rightSibling = bytes32(defaults[depth]);\\n assembly {\\n mstore(add(buf, 32), leftSibling)\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[halfRowSize] = keccak256(buf);\\n }\\n\\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\\n depth++;\\n }\\n\\n return _elements[0];\\n }\\n\\n /**\\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\\n * of leaves generated is a known, correct input, and does not return true for indices \\n * extending past that index (even if _siblings would be otherwise valid.)\\n * @param _root The Merkle root to verify against.\\n * @param _leaf The leaf hash to verify inclusion of.\\n * @param _index The index in the tree of this leaf.\\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \\n * @param _totalLeaves The total number of leaves originally passed into.\\n * @return Whether or not the merkle branch and leaf passes verification.\\n */\\n function verify(\\n bytes32 _root,\\n bytes32 _leaf,\\n uint256 _index,\\n bytes32[] memory _siblings,\\n uint256 _totalLeaves\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _totalLeaves > 0,\\n \\\"Lib_MerkleTree: Total leaves must be greater than zero.\\\"\\n );\\n\\n require(\\n _index < _totalLeaves,\\n \\\"Lib_MerkleTree: Index out of bounds.\\\"\\n );\\n\\n require(\\n _siblings.length == _ceilLog2(_totalLeaves),\\n \\\"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\\\"\\n );\\n\\n bytes32 computedRoot = _leaf;\\n\\n for (uint256 i = 0; i < _siblings.length; i++) {\\n if ((_index & 1) == 1) {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n _siblings[i],\\n computedRoot\\n )\\n );\\n } else {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n computedRoot,\\n _siblings[i]\\n )\\n );\\n }\\n\\n _index >>= 1;\\n }\\n\\n return _root == computedRoot;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Calculates the integer ceiling of the log base 2 of an input.\\n * @param _in Unsigned input to calculate the log.\\n * @return ceil(log_base_2(_in))\\n */\\n function _ceilLog2(\\n uint256 _in\\n )\\n private\\n pure\\n returns (\\n uint256\\n )\\n { \\n require(\\n _in > 0,\\n \\\"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\\\"\\n );\\n\\n if (_in == 1) {\\n return 0;\\n }\\n\\n // Find the highest set bit (will be floor(log_2)).\\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\\n uint256 val = _in;\\n uint256 highest = 0;\\n for (uint8 i = 128; i >= 1; i >>= 1) {\\n if (val & (uint(1) << i) - 1 << i != 0) {\\n highest += i;\\n val >>= i;\\n }\\n }\\n\\n // Increment by one if this is not a perfect logarithm.\\n if ((uint(1) << highest) != _in) {\\n highest += 1;\\n }\\n\\n return highest;\\n }\\n}\\n\",\"keccak256\":\"0xd7459ac196122e9ba672802d2726708a206dac46efbf9820fb66f5f1c53f89bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\\n// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"./Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_SafeMathWrapper\\n */\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\n\\nlibrary Lib_SafeMathWrapper {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal returns (uint256) {\\n uint256 c = a + b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \\\"Lib_SafeMathWrapper: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal returns (uint256) {\\n return sub(a, b, \\\"Lib_SafeMathWrapper: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \\\"Lib_SafeMathWrapper: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal returns (uint256) {\\n return div(a, b, \\\"Lib_SafeMathWrapper: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal returns (uint256) {\\n return mod(a, b, \\\"Lib_SafeMathWrapper: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0xc58aa064894677f65fc8205f79252d15e59a0f5e2794e5c2d069c7b2bc97a9e2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620031f8380380620031f8833981016040819052620000349162000067565b600080546001600160a01b0319166001600160a01b039590951694909417909355600191909155600255600355620000b2565b600080600080608085870312156200007d578384fd5b84516001600160a01b038116811462000094578485fd5b60208601516040870151606090970151919890975090945092505050565b61313680620000c26000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461022c578063d0f8934414610234578063e10d29ee1461023c578063e561dddc14610244578063f722b41a1461024c578063facdc5da1461025457610137565b8063876ed5cb146102045780638d38c6c11461020c578063b8f7700514610214578063c139eb151461021c578063c2cf696f1461022457610137565b80635ae6256d116100ff5780635ae6256d146101cf5780636fee07e0146101d757806378f4b2f2146101ec5780637a167a8a146101f45780637aa63a86146101fc57610137565b8063138387a41461013c5780632a7f18be1461015a578063378997701461017a578063461a44781461018f5780634de569ce146101af575b600080fd5b610144610267565b6040516101519190612f02565b60405180910390f35b61016d610168366004612396565b61026d565b6040516101519190612ed4565b6101826103bc565b6040516101519190612f32565b6101a261019d366004612229565b6103d0565b60405161015191906123f9565b6101c26101bd36600461226f565b6104ac565b6040516101519190612492565b6101826104e6565b6101ea6101e5366004612196565b6104fa565b005b61014461071d565b610182610724565b610144610739565b610144610754565b61014461075a565b610182610760565b6101446107e9565b6101446107ef565b6101a26107f4565b6101ea61081c565b6101a2610c03565b610144610c26565b610182610ca0565b6101ea610262366004612396565b610cb8565b60025481565b610275611ee7565b600061027f610c03565b604051634a83e9cd60e11b815290915060028402906000906001600160a01b03841690639507d39a906102b6908590600401612f32565b60206040518083038186803b1580156102ce57600080fd5b505afa1580156102e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103069190612211565b90506000836001600160a01b0316639507d39a846001016040518263ffffffff1660e01b81526004016103399190612f32565b60206040518083038186803b15801561035157600080fd5b505afa158015610365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103899190612211565b6040805160608101825293845264ffffffffff808316602086015260289290921c9091169083015250925050505b919050565b6000806103c7610e1b565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610430578181015183820152602001610418565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b505192915050565b82516000901515600114156104ce576104c785858585610ec9565b90506104de565b6104c78585602001518585611094565b949350505050565b6000806104f1610e1b565b94505050505090565b612710815111156105265760405162461bcd60e51b815260040161051d906125ae565b60405180910390fd5b6003548211156105485760405162461bcd60e51b815260040161051d906127b4565b620186a082101561056b5760405162461bcd60e51b815260040161051d90612996565b6020820460005a90508181116105935760405162461bcd60e51b815260040161051d90612c10565b60005b825a830310156105a857600101610596565b6000338787876040516020016105c1949392919061240d565b60408051601f19818403018152919052805160209091012090504360281b421760006105eb610c03565b604051631a83804360e31b81529091506001600160a01b0382169063d41c02189061061c90869086906004016124eb565b600060405180830381600087803b15801561063657600080fd5b505af115801561064a573d6000803e3d6000fd5b5050505060006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190612211565b816106ca57fe5b0490507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b60018603426040516107099695949392919061244a565b60405180910390a150505050505050505050565b620186a081565b60008061072f610e1b565b5090935050505090565b600080610744610e1b565b50505064ffffffffff1692915050565b61271081565b60035481565b6000600261076c610c03565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc9190612211565b816107e357fe5b04905090565b60015481565b602081565b60006108176040518060600160405280602581526020016130a8602591396103d0565b905090565b60043560d81c60093560e890811c90600c35901c610838610739565b8364ffffffffff161461085d5760405162461bcd60e51b815260040161051d90612abb565b61088b6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b0316146108bb5760405162461bcd60e51b815260040161051d90612b18565b60008162ffffff16116108e05760405162461bcd60e51b815260040161051d90612811565b60008262ffffff16116109055760405162461bcd60e51b815260040161051d90612d65565b600f601062ffffff831602013664ffffffffff82168110156109395760405162461bcd60e51b815260040161051d90612dec565b6000610943610760565b905060008562ffffff1667ffffffffffffffff8111801561096357600080fd5b5060405190808252806020026020018201604052801561098d578160200160208202803683370190505b509050600080600061099d610724565b90506109a7611f07565b60005b8962ffffff168163ffffffff161015610ada5760006109ce8263ffffffff16611169565b905063ffffffff82166109e4576109e4816111b9565b6109ef838286611286565b80925060005b835163ffffffff82161015610a50578a3560e81c610a1b8564ffffffffff8e1683611396565b898963ffffffff1681518110610a2d57fe5b60209081029190910101529a909a016003019960019687019695860195016109f5565b5060005b83602001518163ffffffff161015610ad0578864ffffffffff168564ffffffffff1610610a935760405162461bcd60e51b815260040161051d90612e2e565b610aa38564ffffffffff16611420565b888863ffffffff1681518110610ab557fe5b60209081029190910101526001968701969485019401610a54565b50506001016109aa565b50610ae48161146b565b8764ffffffffff168714610b0a5760405162461bcd60e51b815260040161051d90612859565b8962ffffff168463ffffffff1614610b345760405162461bcd60e51b815260040161051d906128a7565b6000838b62ffffff160363ffffffff169050600080836020015160001415610b6757505060408201516060830151610b8e565b6000610b7c6001870364ffffffffff1661026d565b90508060200151925080604001519150505b610baf610b9a896114b3565b8e62ffffff168564ffffffffff1685856118e3565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610bdc610739565b604051610beb93929190612f44565b60405180910390a15050505050505050505050505050565b6000610817604051806060016040528060238152602001612f8b602391396103d0565b6000610c306107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6857600080fd5b505afa158015610c7c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108179190612211565b6000610caa610724565b610cb2610760565b03905090565b60405162461bcd60e51b815260040161051d9061251e565b83811015610d9557610d066040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b031614610d62576000610d308364ffffffffff1661026d565b905042600154826020015164ffffffffff160110610d605760405162461bcd60e51b815260040161051d90612a48565b505b610d728264ffffffffff16611420565b838281518110610d7e57fe5b602090810291909101015260019182019101610cd0565b506000610dab6001830364ffffffffff1661026d565b9050610dca610db9846114b3565b8586846020015185604001516118e3565b7f64d7f508348c70dea42d5302a393987e4abc20e45954ab3f9d320207751956f0848364ffffffffff160385610dfe610739565b604051610e0d93929190612f0b565b60405180910390a150505050565b6000806000806000610e2b6107f4565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9b91906121eb565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610f016040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506103d0565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f3e57600080fd5b505afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f769190612211565b90506000610f8387611a9d565b9050610f90818787611b36565b610fac5760405162461bcd60e51b815260040161051d906126dd565b86606001518860200151148015610fc7575060408701518851145b80156110085750610fef604051806060016040528060228152602001612fae602291396103d0565b6001600160a01b031688608001516001600160a01b0316145b80156110175750818860a00151145b801561102e575060608801516001600160a01b0316155b8015611049575060008860400151600181111561104757fe5b145b801561106a57508660800151805190602001208860c0015180519060200120145b6110865760405162461bcd60e51b815260040161051d9061277d565b506001979650505050505050565b6000806110a085611420565b90506110ad818585611b36565b6110c95760405162461bcd60e51b815260040161051d90612cb0565b6000866060015187608001518860a001518960c001516040516020016110f2949392919061240d565b60405160208183030381529060405280519060200120905060006111158761026d565b80519091508214801561113357508751602082015164ffffffffff16145b801561114d57508760200151816040015164ffffffffff16145b6110865760405162461bcd60e51b815260040161051d90612b65565b611171611f07565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111c3610739565b1115611233576000806111d4610e1b565b9350935050508064ffffffffff16836060015110156112055760405162461bcd60e51b815260040161051d9061272b565b8164ffffffffff16836040015110156112305760405162461bcd60e51b815260040161051d9061260b565b50505b42600154826040015101101561125b5760405162461bcd60e51b815260040161051d90612da6565b4360025482606001510110156112835760405162461bcd60e51b815260040161051d90612565565b50565b8260400151826040015110156112ae5760405162461bcd60e51b815260040161051d90612c5b565b8260600151826060015110156112d65760405162461bcd60e51b815260040161051d90612e77565b6000816112e1610760565b0364ffffffffff1611156113915760006113018264ffffffffff1661026d565b9050600154816020015164ffffffffff160142106113315760405162461bcd60e51b815260040161051d9061265a565b806020015164ffffffffff16836040015111156113605760405162461bcd60e51b815260040161051d906129df565b806040015164ffffffffff168360600151111561138f5760405162461bcd60e51b815260040161051d90612cfa565b505b505050565b6000808260410167ffffffffffffffff811180156113b357600080fd5b506040519080825280601f01601f1916602001820160405280156113de576020820181803683370190505b50604086015160608701519192509060006020840160018153836001820152826021820152866003890160418301376041870190209450505050509392505050565b60006114656040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c27565b92915050565b428160400151111561148f5760405162461bcd60e51b815260040161051d90612bcb565b43816060015111156112835760405162461bcd60e51b815260040161051d90612917565b6000808251116114f45760405162461bcd60e51b81526004018080602001828103825260348152602001806130cd6034913960400191505060405180910390fd5b8151611516578160008151811061150757fe5b602002602001015190506103b7565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118bf5750506002820460018084161460005b8281101561183b578a81600202815181106117e257fe5b602002602001015196508a81600202600101815181106117fe57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061182857fe5b60209081029190910101526001016117cb565b50801561189e5789600185038151811061185157fe5b6020026020010151955087836010811061186757fe5b602002015160001b945085602088015284604088015286805190602001208a838151811061189157fe5b6020026020010181815250505b806118aa5760006118ad565b60015b60ff16820193506001909201916117b3565b896000815181106118cc57fe5b602002602001015198505050505050505050919050565b6000806000806118f1610e1b565b935093509350935060006040518060a0016040528061190e6107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561194657600080fd5b505afa15801561195a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197e9190612211565b81526020018b81526020018a81526020018664ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516119fb94939291906124f9565b60405180910390a26000611a0e82611c6f565b90506000611a26836040015188018b88018b8b611c98565b9050611a306107f4565b6001600160a01b0316632015276c83836040518363ffffffff1660e01b8152600401611a5d9291906124d5565b600060405180830381600087803b158015611a7757600080fd5b505af1158015611a8b573d6000803e3d6000fd5b50505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611ac357600080fd5b506040519080825280601f01601f191660200182016040528015611aee576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611b406107f4565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611b6e91600401612f21565b60206040518083038186803b158015611b8657600080fd5b505afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190612211565b611bc784611c6f565b14611be45760405162461bcd60e51b815260040161051d90612b9c565b611c01836020015185846000015185602001518760400151611cb7565b611c1d5760405162461bcd60e51b815260040161051d9061295f565b5060019392505050565b8051602080830151604080850151606086015160808701519251600096611c5296909594910161249d565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5294939291906124f9565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cf75760405162461bcd60e51b81526004018080602001828103825260378152602001806130246037913960400191505060405180910390fd5b818410611d355760405162461bcd60e51b8152600401808060200182810382526024815260200180612fd06024913960400191505060405180910390fd5b611d3e82611e3c565b835114611d7c5760405162461bcd60e51b815260040180806020018281038252604d81526020018061305b604d913960600191505060405180910390fd5b8460005b8451811015611e2f578560011660011415611dde57848181518110611da157fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e23565b81858281518110611deb57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d80565b5090951495945050505050565b6000808211611e7c5760405162461bcd60e51b8152600401808060200182810382526030815260200180612ff46030913960400191505060405180910390fd5b8160011415611e8d575060006103b7565b81600060805b60018160ff1610611ed1578060ff1660018260ff166001901b03901b8316600014611ec65760ff811692831c9291909101905b60011c607f16611e93565b506001811b8414611ee0576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f4357fe5b611f56601f8401601f1916602001612f66565b9050828152838383011115611f6a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146103b757600080fd5b600082601f830112611fa8578081fd5b611ee083833560208501611f2f565b8035600281106103b757600080fd5b600060a08284031215611fd7578081fd5b60405160a0810167ffffffffffffffff8282108183111715611ff557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b5061203f85828601611f98565b6080830152505092915050565b60006040828403121561205d578081fd5b6040516040810167ffffffffffffffff828210818311171561207b57fe5b816040528293508435835260209150818501358181111561209b57600080fd5b8501601f810187136120ac57600080fd5b8035828111156120b857fe5b83810292506120c8848401612f66565b8181528481019083860185850187018b10156120e357600080fd5b600095505b838610156121065780358352600195909501949186019186016120e8565b5080868801525050505050505092915050565b600060a0828403121561212a578081fd5b60405160a0810167ffffffffffffffff828210818311171561214857fe5b8160405282935084359150811515821461216157600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b6000806000606084860312156121aa578283fd5b6121b384611f81565b925060208401359150604084013567ffffffffffffffff8111156121d5578182fd5b6121e186828701611f98565b9150509250925092565b6000602082840312156121fc578081fd5b815164ffffffffff1981168114611ee0578182fd5b600060208284031215612222578081fd5b5051919050565b60006020828403121561223a578081fd5b813567ffffffffffffffff811115612250578182fd5b8201601f81018413612260578182fd5b6104de84823560208401611f2f565b60008060008060808587031215612284578081fd5b843567ffffffffffffffff8082111561229b578283fd5b9086019060e082890312156122ae578283fd5b6122b860e0612f66565b82358152602083013560208201526122d260408401611fb7565b60408201526122e360608401611f81565b60608201526122f460808401611f81565b608082015260a083013560a082015260c083013582811115612314578485fd5b6123208a828601611f98565b60c0830152509550602087013591508082111561233b578283fd5b61234788838901612119565b9450604087013591508082111561235c578283fd5b61236888838901611fc6565b9350606087013591508082111561237d578283fd5b5061238a8782880161204c565b91505092959194509250565b6000602082840312156123a7578081fd5b5035919050565b60008151808452815b818110156123d3576020818501810151868301820152016123b7565b818111156123e45782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612440908301846123ae565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061247d908301866123ae565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124ca60a08301846123ae565b979650505050505050565b91825264ffffffffff1916602082015260400190565b918252602082015260400190565b60008582528460208301528360408301526080606083015261244060808301846123ae565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252604d908201527f5175657565207472616e73616374696f6e732063616e6e6f742062652073756260408201527f6d697474656420647572696e67207468652073657175656e63657220696e636c60608201526c3ab9b4b7b7103832b934b7b21760991b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b90815260200190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612f8257fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212207e50b0918881377d2fd55a74570ccb494f88c5b34ae4306e6344457f0356744664736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063876ed5cb116100b8578063cfdf677e1161007c578063cfdf677e1461022c578063d0f8934414610234578063e10d29ee1461023c578063e561dddc14610244578063f722b41a1461024c578063facdc5da1461025457610137565b8063876ed5cb146102045780638d38c6c11461020c578063b8f7700514610214578063c139eb151461021c578063c2cf696f1461022457610137565b80635ae6256d116100ff5780635ae6256d146101cf5780636fee07e0146101d757806378f4b2f2146101ec5780637a167a8a146101f45780637aa63a86146101fc57610137565b8063138387a41461013c5780632a7f18be1461015a578063378997701461017a578063461a44781461018f5780634de569ce146101af575b600080fd5b610144610267565b6040516101519190612f02565b60405180910390f35b61016d610168366004612396565b61026d565b6040516101519190612ed4565b6101826103bc565b6040516101519190612f32565b6101a261019d366004612229565b6103d0565b60405161015191906123f9565b6101c26101bd36600461226f565b6104ac565b6040516101519190612492565b6101826104e6565b6101ea6101e5366004612196565b6104fa565b005b61014461071d565b610182610724565b610144610739565b610144610754565b61014461075a565b610182610760565b6101446107e9565b6101446107ef565b6101a26107f4565b6101ea61081c565b6101a2610c03565b610144610c26565b610182610ca0565b6101ea610262366004612396565b610cb8565b60025481565b610275611ee7565b600061027f610c03565b604051634a83e9cd60e11b815290915060028402906000906001600160a01b03841690639507d39a906102b6908590600401612f32565b60206040518083038186803b1580156102ce57600080fd5b505afa1580156102e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103069190612211565b90506000836001600160a01b0316639507d39a846001016040518263ffffffff1660e01b81526004016103399190612f32565b60206040518083038186803b15801561035157600080fd5b505afa158015610365573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103899190612211565b6040805160608101825293845264ffffffffff808316602086015260289290921c9091169083015250925050505b919050565b6000806103c7610e1b565b50935050505090565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015610430578181015183820152602001610418565b50505050905090810190601f16801561045d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b505192915050565b82516000901515600114156104ce576104c785858585610ec9565b90506104de565b6104c78585602001518585611094565b949350505050565b6000806104f1610e1b565b94505050505090565b612710815111156105265760405162461bcd60e51b815260040161051d906125ae565b60405180910390fd5b6003548211156105485760405162461bcd60e51b815260040161051d906127b4565b620186a082101561056b5760405162461bcd60e51b815260040161051d90612996565b6020820460005a90508181116105935760405162461bcd60e51b815260040161051d90612c10565b60005b825a830310156105a857600101610596565b6000338787876040516020016105c1949392919061240d565b60408051601f19818403018152919052805160209091012090504360281b421760006105eb610c03565b604051631a83804360e31b81529091506001600160a01b0382169063d41c02189061061c90869086906004016124eb565b600060405180830381600087803b15801561063657600080fd5b505af115801561064a573d6000803e3d6000fd5b5050505060006002826001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190612211565b816106ca57fe5b0490507f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb5338b8b8b60018603426040516107099695949392919061244a565b60405180910390a150505050505050505050565b620186a081565b60008061072f610e1b565b5090935050505090565b600080610744610e1b565b50505064ffffffffff1692915050565b61271081565b60035481565b6000600261076c610c03565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc9190612211565b816107e357fe5b04905090565b60015481565b602081565b60006108176040518060600160405280602581526020016130a8602591396103d0565b905090565b60043560d81c60093560e890811c90600c35901c610838610739565b8364ffffffffff161461085d5760405162461bcd60e51b815260040161051d90612abb565b61088b6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b0316146108bb5760405162461bcd60e51b815260040161051d90612b18565b60008162ffffff16116108e05760405162461bcd60e51b815260040161051d90612811565b60008262ffffff16116109055760405162461bcd60e51b815260040161051d90612d65565b600f601062ffffff831602013664ffffffffff82168110156109395760405162461bcd60e51b815260040161051d90612dec565b6000610943610760565b905060008562ffffff1667ffffffffffffffff8111801561096357600080fd5b5060405190808252806020026020018201604052801561098d578160200160208202803683370190505b509050600080600061099d610724565b90506109a7611f07565b60005b8962ffffff168163ffffffff161015610ada5760006109ce8263ffffffff16611169565b905063ffffffff82166109e4576109e4816111b9565b6109ef838286611286565b80925060005b835163ffffffff82161015610a50578a3560e81c610a1b8564ffffffffff8e1683611396565b898963ffffffff1681518110610a2d57fe5b60209081029190910101529a909a016003019960019687019695860195016109f5565b5060005b83602001518163ffffffff161015610ad0578864ffffffffff168564ffffffffff1610610a935760405162461bcd60e51b815260040161051d90612e2e565b610aa38564ffffffffff16611420565b888863ffffffff1681518110610ab557fe5b60209081029190910101526001968701969485019401610a54565b50506001016109aa565b50610ae48161146b565b8764ffffffffff168714610b0a5760405162461bcd60e51b815260040161051d90612859565b8962ffffff168463ffffffff1614610b345760405162461bcd60e51b815260040161051d906128a7565b6000838b62ffffff160363ffffffff169050600080836020015160001415610b6757505060408201516060830151610b8e565b6000610b7c6001870364ffffffffff1661026d565b90508060200151925080604001519150505b610baf610b9a896114b3565b8e62ffffff168564ffffffffff1685856118e3565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f89983860384610bdc610739565b604051610beb93929190612f44565b60405180910390a15050505050505050505050505050565b6000610817604051806060016040528060238152602001612f8b602391396103d0565b6000610c306107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6857600080fd5b505afa158015610c7c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108179190612211565b6000610caa610724565b610cb2610760565b03905090565b60405162461bcd60e51b815260040161051d9061251e565b83811015610d9557610d066040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b8152506103d0565b6001600160a01b0316336001600160a01b031614610d62576000610d308364ffffffffff1661026d565b905042600154826020015164ffffffffff160110610d605760405162461bcd60e51b815260040161051d90612a48565b505b610d728264ffffffffff16611420565b838281518110610d7e57fe5b602090810291909101015260019182019101610cd0565b506000610dab6001830364ffffffffff1661026d565b9050610dca610db9846114b3565b8586846020015185604001516118e3565b7f64d7f508348c70dea42d5302a393987e4abc20e45954ab3f9d320207751956f0848364ffffffffff160385610dfe610739565b604051610e0d93929190612f0b565b60405180910390a150505050565b6000806000806000610e2b6107f4565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6357600080fd5b505afa158015610e77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9b91906121eb565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b600080610f016040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b8152506103d0565b90506000816001600160a01b0316631c4712a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f3e57600080fd5b505afa158015610f52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f769190612211565b90506000610f8387611a9d565b9050610f90818787611b36565b610fac5760405162461bcd60e51b815260040161051d906126dd565b86606001518860200151148015610fc7575060408701518851145b80156110085750610fef604051806060016040528060228152602001612fae602291396103d0565b6001600160a01b031688608001516001600160a01b0316145b80156110175750818860a00151145b801561102e575060608801516001600160a01b0316155b8015611049575060008860400151600181111561104757fe5b145b801561106a57508660800151805190602001208860c0015180519060200120145b6110865760405162461bcd60e51b815260040161051d9061277d565b506001979650505050505050565b6000806110a085611420565b90506110ad818585611b36565b6110c95760405162461bcd60e51b815260040161051d90612cb0565b6000866060015187608001518860a001518960c001516040516020016110f2949392919061240d565b60405160208183030381529060405280519060200120905060006111158761026d565b80519091508214801561113357508751602082015164ffffffffff16145b801561114d57508760200151816040015164ffffffffff16145b6110865760405162461bcd60e51b815260040161051d90612b65565b611171611f07565b5060408051608081018252601092909202600f81013560e890811c84526012820135901c6020840152601581013560d890811c92840192909252601a0135901c606082015290565b60006111c3610739565b1115611233576000806111d4610e1b565b9350935050508064ffffffffff16836060015110156112055760405162461bcd60e51b815260040161051d9061272b565b8164ffffffffff16836040015110156112305760405162461bcd60e51b815260040161051d9061260b565b50505b42600154826040015101101561125b5760405162461bcd60e51b815260040161051d90612da6565b4360025482606001510110156112835760405162461bcd60e51b815260040161051d90612565565b50565b8260400151826040015110156112ae5760405162461bcd60e51b815260040161051d90612c5b565b8260600151826060015110156112d65760405162461bcd60e51b815260040161051d90612e77565b6000816112e1610760565b0364ffffffffff1611156113915760006113018264ffffffffff1661026d565b9050600154816020015164ffffffffff160142106113315760405162461bcd60e51b815260040161051d9061265a565b806020015164ffffffffff16836040015111156113605760405162461bcd60e51b815260040161051d906129df565b806040015164ffffffffff168360600151111561138f5760405162461bcd60e51b815260040161051d90612cfa565b505b505050565b6000808260410167ffffffffffffffff811180156113b357600080fd5b506040519080825280601f01601f1916602001820160405280156113de576020820181803683370190505b50604086015160608701519192509060006020840160018153836001820152826021820152866003890160418301376041870190209450505050509392505050565b60006114656040518060a00160405280600015158152602001848152602001600081526020016000815260200160405180602001604052806000815250815250611c27565b92915050565b428160400151111561148f5760405162461bcd60e51b815260040161051d90612bcb565b43816060015111156112835760405162461bcd60e51b815260040161051d90612917565b6000808251116114f45760405162461bcd60e51b81526004018080602001828103825260348152602001806130cd6034913960400191505060405180910390fd5b8151611516578160008151811061150757fe5b602002602001015190506103b7565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118bf5750506002820460018084161460005b8281101561183b578a81600202815181106117e257fe5b602002602001015196508a81600202600101815181106117fe57fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061182857fe5b60209081029190910101526001016117cb565b50801561189e5789600185038151811061185157fe5b6020026020010151955087836010811061186757fe5b602002015160001b945085602088015284604088015286805190602001208a838151811061189157fe5b6020026020010181815250505b806118aa5760006118ad565b60015b60ff16820193506001909201916117b3565b896000815181106118cc57fe5b602002602001015198505050505050505050919050565b6000806000806118f1610e1b565b935093509350935060006040518060a0016040528061190e6107f4565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561194657600080fd5b505afa15801561195a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197e9190612211565b81526020018b81526020018a81526020018664ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516119fb94939291906124f9565b60405180910390a26000611a0e82611c6f565b90506000611a26836040015188018b88018b8b611c98565b9050611a306107f4565b6001600160a01b0316632015276c83836040518363ffffffff1660e01b8152600401611a5d9291906124d5565b600060405180830381600087803b158015611a7757600080fd5b505af1158015611a8b573d6000803e3d6000fd5b50505050505050505050505050505050565b6080810151805160009190826041820167ffffffffffffffff81118015611ac357600080fd5b506040519080825280601f01601f191660200182016040528015611aee576020820181803683370190505b5060408601516060870151919250906000602084016001815383600182015282602182015285604182018760208a0160045afa50604190950190942095505050505050919050565b6000611b406107f4565b8351604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a91611b6e91600401612f21565b60206040518083038186803b158015611b8657600080fd5b505afa158015611b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbe9190612211565b611bc784611c6f565b14611be45760405162461bcd60e51b815260040161051d90612b9c565b611c01836020015185846000015185602001518760400151611cb7565b611c1d5760405162461bcd60e51b815260040161051d9061295f565b5060019392505050565b8051602080830151604080850151606086015160808701519251600096611c5296909594910161249d565b604051602081830303815290604052805190602001209050919050565b60008160200151826040015183606001518460800151604051602001611c5294939291906124f9565b602892831b9390931760509190911b1760789290921b91909117901b90565b6000808211611cf75760405162461bcd60e51b81526004018080602001828103825260378152602001806130246037913960400191505060405180910390fd5b818410611d355760405162461bcd60e51b8152600401808060200182810382526024815260200180612fd06024913960400191505060405180910390fd5b611d3e82611e3c565b835114611d7c5760405162461bcd60e51b815260040180806020018281038252604d81526020018061305b604d913960600191505060405180910390fd5b8460005b8451811015611e2f578560011660011415611dde57848181518110611da157fe5b6020026020010151826040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209150611e23565b81858281518110611deb57fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c9501611d80565b5090951495945050505050565b6000808211611e7c5760405162461bcd60e51b8152600401808060200182810382526030815260200180612ff46030913960400191505060405180910390fd5b8160011415611e8d575060006103b7565b81600060805b60018160ff1610611ed1578060ff1660018260ff166001901b03901b8316600014611ec65760ff811692831c9291909101905b60011c607f16611e93565b506001811b8414611ee0576001015b9392505050565b604080516060810182526000808252602082018190529181019190915290565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b600067ffffffffffffffff831115611f4357fe5b611f56601f8401601f1916602001612f66565b9050828152838383011115611f6a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146103b757600080fd5b600082601f830112611fa8578081fd5b611ee083833560208501611f2f565b8035600281106103b757600080fd5b600060a08284031215611fd7578081fd5b60405160a0810167ffffffffffffffff8282108183111715611ff557fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b5061203f85828601611f98565b6080830152505092915050565b60006040828403121561205d578081fd5b6040516040810167ffffffffffffffff828210818311171561207b57fe5b816040528293508435835260209150818501358181111561209b57600080fd5b8501601f810187136120ac57600080fd5b8035828111156120b857fe5b83810292506120c8848401612f66565b8181528481019083860185850187018b10156120e357600080fd5b600095505b838610156121065780358352600195909501949186019186016120e8565b5080868801525050505050505092915050565b600060a0828403121561212a578081fd5b60405160a0810167ffffffffffffffff828210818311171561214857fe5b8160405282935084359150811515821461216157600080fd5b818352602085013560208401526040850135604084015260608501356060840152608085013591508082111561203257600080fd5b6000806000606084860312156121aa578283fd5b6121b384611f81565b925060208401359150604084013567ffffffffffffffff8111156121d5578182fd5b6121e186828701611f98565b9150509250925092565b6000602082840312156121fc578081fd5b815164ffffffffff1981168114611ee0578182fd5b600060208284031215612222578081fd5b5051919050565b60006020828403121561223a578081fd5b813567ffffffffffffffff811115612250578182fd5b8201601f81018413612260578182fd5b6104de84823560208401611f2f565b60008060008060808587031215612284578081fd5b843567ffffffffffffffff8082111561229b578283fd5b9086019060e082890312156122ae578283fd5b6122b860e0612f66565b82358152602083013560208201526122d260408401611fb7565b60408201526122e360608401611f81565b60608201526122f460808401611f81565b608082015260a083013560a082015260c083013582811115612314578485fd5b6123208a828601611f98565b60c0830152509550602087013591508082111561233b578283fd5b61234788838901612119565b9450604087013591508082111561235c578283fd5b61236888838901611fc6565b9350606087013591508082111561237d578283fd5b5061238a8782880161204c565b91505092959194509250565b6000602082840312156123a7578081fd5b5035919050565b60008151808452815b818110156123d3576020818501810151868301820152016123b7565b818111156123e45782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612440908301846123ae565b9695505050505050565b6001600160a01b038781168252861660208201526040810185905260c06060820181905260009061247d908301866123ae565b60808301949094525060a00152949350505050565b901515815260200190565b6000861515825285602083015284604083015283606083015260a060808301526124ca60a08301846123ae565b979650505050505050565b91825264ffffffffff1916602082015260400190565b918252602082015260400190565b60008582528460208301528360408301526080606083015261244060808301846123ae565b60208082526027908201527f617070656e64517565756542617463682069732063757272656e746c7920646960408201526639b0b13632b21760c91b606082015260800190565b60208082526029908201527f436f6e7465787420626c6f636b206e756d62657220746f6f2066617220696e206040820152683a3432903830b9ba1760b91b606082015260800190565b6020808252603d908201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b6020808252602f908201527f436f6e746578742074696d657374616d70206973206c6f776572207468616e2060408201526e3630b9ba1039bab136b4ba3a32b21760891b606082015260800190565b6020808252605b908201527f50726576696f75736c7920656e7175657565642062617463686573206861766560408201527f206578706972656420616e64206d75737420626520617070656e64656420626560608201527f666f72652061206e65772073657175656e6365722062617463682e0000000000608082015260a00190565b6020808252602e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e20696e60408201526d31b63ab9b4b7b710383937b7b31760911b606082015260800190565b60208082526032908201527f436f6e7465787420626c6f636b206e756d626572206973206c6f77657220746860408201527130b7103630b9ba1039bab136b4ba3a32b21760711b606082015260800190565b6020808252601e908201527f496e76616c69642053657175656e636572207472616e73616374696f6e2e0000604082015260600190565b6020808252603d908201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160408201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e000000606082015260800190565b60208082526028908201527f4d7573742070726f76696465206174206c65617374206f6e652062617463682060408201526731b7b73a32bc3a1760c11b606082015260800190565b6020808252602e908201527f4e6f7420616c6c2073657175656e636572207472616e73616374696f6e73207760408201526d32b93290383937b1b2b9b9b2b21760911b606082015260800190565b6020808252604a908201527f41637475616c207472616e73616374696f6e20696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420746f74616c20656c656d656e7473206060820152693a379030b83832b7321760b11b608082015260a00190565b60208082526028908201527f436f6e7465787420626c6f636b206e756d6265722069732066726f6d2074686560408201526710333aba3ab9329760c11b606082015260800190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b60208082526029908201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f6040820152681032b738bab2bab29760b91b606082015260800190565b60208082526043908201527f53657175656e636572207472616e73616374696f6e2074696d657374616d702060408201527f657863656564732074686174206f66206e65787420717565756520656c656d65606082015262373a1760e91b608082015260a00190565b6020808252604d908201527f5175657565207472616e73616374696f6e732063616e6e6f742062652073756260408201527f6d697474656420647572696e67207468652073657175656e63657220696e636c60608201526c3ab9b4b7b7103832b934b7b21760991b608082015260a00190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6020808252602d908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460408201526c34329029b2b8bab2b731b2b91760991b606082015260800190565b6020808252601a908201527f496e76616c6964205175657565207472616e73616374696f6e2e000000000000604082015260600190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b60208082526025908201527f436f6e746578742074696d657374616d702069732066726f6d207468652066756040820152643a3ab9329760d91b606082015260800190565b6020808252602b908201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60408201526a34ba34b73390313ab9371760a91b606082015260800190565b60208082526035908201527f436f6e746578742074696d657374616d702076616c756573206d757374206d6f6040820152743737ba37b734b1b0b6363c9034b731b932b0b9b29760591b606082015260800190565b6020808252602a908201527f496e76616c6964205175657565207472616e73616374696f6e20696e636c757360408201526934b7b710383937b7b31760b11b606082015260800190565b60208082526045908201527f53657175656e636572207472616e73616374696f6e20626c6f636b4e756d626560408201527f7220657863656564732074686174206f66206e65787420717565756520656c6560608201526436b2b73a1760d91b608082015260a00190565b60208082526021908201527f4d75737420617070656e64206174206c65617374206f6e6520656c656d656e746040820152601760f91b606082015260800190565b60208082526026908201527f436f6e746578742074696d657374616d7020746f6f2066617220696e20746865604082015265103830b9ba1760d11b606082015260800190565b60208082526022908201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f76696465604082015261321760f11b606082015260800190565b60208082526029908201527f4e6f7420656e6f75676820717565756564207472616e73616374696f6e732074604082015268379030b83832b7321760b91b606082015260800190565b60208082526037908201527f436f6e7465787420626c6f636b4e756d6265722076616c756573206d7573742060408201527f6d6f6e6f746f6e6963616c6c7920696e6372656173652e000000000000000000606082015260800190565b8151815260208083015164ffffffffff90811691830191909152604092830151169181019190915260600190565b90815260200190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b64ffffffffff91909116815260200190565b64ffffffffff9384168152919092166020820152604081019190915260600190565b60405181810167ffffffffffffffff81118282101715612f8257fe5b60405291905056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a71756575654f564d5f4465636f6d7072657373696f6e507265636f6d70696c65416464726573734c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a4354433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212207e50b0918881377d2fd55a74570ccb494f88c5b34ae4306e6344457f0356744664736f6c63430007060033", - "devdoc": { - "details": "The Canonical Transaction Chain (CTC) contract is an append-only log of transactions which must be applied to the rollup state. It defines the ordering of rollup transactions by writing them to the 'CTC:batches' instance of the Chain Storage Container. The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer will eventually append it to the rollup state. If the Sequencer does not include an enqueued transaction within the 'force inclusion period', then any account may force it to be included by calling appendQueueBatch(). Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "appendQueueBatch(uint256)": { - "params": { - "_numQueuedTransactions": "Number of transactions to append." - } - }, - "appendSequencerBatch()": { - "details": "This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch contexts. .param _transactionDataFields Array of raw transaction data." - }, - "batches()": { - "returns": { - "_0": "Reference to the batch storage container." - } - }, - "enqueue(address,uint256,bytes)": { - "params": { - "_data": "Transaction data.", - "_gasLimit": "Gas limit for the enqueued L2 transaction.", - "_target": "Target L2 contract to send the transaction to." - } - }, - "getLastBlockNumber()": { - "returns": { - "_0": "Blocknumber for the last transaction." - } - }, - "getLastTimestamp()": { - "returns": { - "_0": "Timestamp for the last transaction." - } - }, - "getNextQueueIndex()": { - "returns": { - "_0": "Index for the next queue element." - } - }, - "getNumPendingQueueElements()": { - "returns": { - "_0": "Number of pending queue elements." - } - }, - "getQueueElement(uint256)": { - "params": { - "_index": "Index of the queue element to access." - }, - "returns": { - "_element": "Queue element at the given index." - } - }, - "getQueueLength()": { - "returns": { - "_0": "Length of the queue." - } - }, - "getTotalBatches()": { - "returns": { - "_totalBatches": "Total submitted batches." - } - }, - "getTotalElements()": { - "returns": { - "_totalElements": "Total submitted elements." - } - }, - "queue()": { - "returns": { - "_0": "Reference to the queue storage container." - } - }, - "verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "params": { - "_batchHeader": "Header of the batch the transaction was included in.", - "_inclusionProof": "Inclusion proof for the provided transaction chain element.", - "_transaction": "Transaction to verify.", - "_txChainElement": "Transaction chain element corresponding to the transaction." - }, - "returns": { - "_0": "True if the transaction exists in the CTC, false if not." - } - } - }, - "title": "OVM_CanonicalTransactionChain", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "appendQueueBatch(uint256)": { - "notice": "Appends a given number of queued transactions as a single batch." - }, - "appendSequencerBatch()": { - "notice": "Allows the sequencer to append a batch of transactions." - }, - "batches()": { - "notice": "Accesses the batch storage container." - }, - "enqueue(address,uint256,bytes)": { - "notice": "Adds a transaction to the queue." - }, - "getLastBlockNumber()": { - "notice": "Returns the blocknumber of the last transaction." - }, - "getLastTimestamp()": { - "notice": "Returns the timestamp of the last transaction." - }, - "getNextQueueIndex()": { - "notice": "Returns the index of the next element to be enqueued." - }, - "getNumPendingQueueElements()": { - "notice": "Get the number of queue elements which have not yet been included." - }, - "getQueueElement(uint256)": { - "notice": "Gets the queue element at a particular index." - }, - "getQueueLength()": { - "notice": "Retrieves the length of the queue, including both pending and canonical transactions." - }, - "getTotalBatches()": { - "notice": "Retrieves the total number of batches submitted." - }, - "getTotalElements()": { - "notice": "Retrieves the total number of elements submitted." - }, - "queue()": { - "notice": "Accesses the queue storage container." - }, - "verifyTransaction((uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "notice": "Verifies whether a transaction is included in the chain." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 1991, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", - "label": "forceInclusionPeriodSeconds", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 1993, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", - "label": "forceInclusionPeriodBlocks", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 1995, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol:OVM_CanonicalTransactionChain", - "label": "maxTransactionGasLimit", - "offset": 0, - "slot": "3", - "type": "t_uint256" - } - ], - "types": { - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json b/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json deleted file mode 100644 index 991a4f619..000000000 --- a/deployments/kovan/OVM_ChainStorageContainer:CTC:batches.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "address": "0x25879DC7C9a069B747e52e72c6082573aF6310ee", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_owner", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "get", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGlobalMetadata", - "outputs": [ - { - "internalType": "bytes27", - "name": "", - "type": "bytes27" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "setGlobalMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x8601555569a384783bbc7859ec5fc559f7f8d62127d04705d3930e439f925847", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x25879DC7C9a069B747e52e72c6082573aF6310ee", - "transactionIndex": 3, - "gasUsed": "1101114", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xeab28cfdf6068d35688766c5b72acce4bdc09c4dfb97ad4de607fdb2eff385c5", - "transactionHash": "0x8601555569a384783bbc7859ec5fc559f7f8d62127d04705d3930e439f925847", - "logs": [], - "blockNumber": 23637102, - "cumulativeGasUsed": "1347009", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "OVM_CanonicalTransactionChain" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "devdoc": { - "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager.", - "_owner": "Name of the contract that owns this container (will be resolved later)." - } - }, - "deleteElementsAfterInclusive(uint256)": { - "params": { - "_index": "Object index to delete from." - } - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_index": "Object index to delete from." - } - }, - "get(uint256)": { - "params": { - "_index": "Index of the particular object to access." - }, - "returns": { - "_0": "32 byte object value." - } - }, - "getGlobalMetadata()": { - "returns": { - "_0": "Container global metadata field." - } - }, - "length()": { - "returns": { - "_0": "Number of objects in the container." - } - }, - "push(bytes32)": { - "params": { - "_object": "A 32 byte value to insert into the container." - } - }, - "push(bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_object": "A 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32)": { - "params": { - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "setGlobalMetadata(bytes27)": { - "params": { - "_globalMetadata": "New global metadata to set." - } - } - }, - "title": "OVM_ChainStorageContainer", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "deleteElementsAfterInclusive(uint256)": { - "notice": "Removes all objects after and including a given index." - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." - }, - "get(uint256)": { - "notice": "Retrieves an object from the container." - }, - "getGlobalMetadata()": { - "notice": "Retrieves the container's global metadata field." - }, - "length()": { - "notice": "Retrieves the number of objects stored in the container." - }, - "push(bytes32)": { - "notice": "Pushes an object into the container." - }, - "push(bytes32,bytes27)": { - "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." - }, - "push2(bytes32,bytes32)": { - "notice": "Pushes two objects into the container at the same time. A useful optimization." - }, - "push2(bytes32,bytes32,bytes27)": { - "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." - }, - "setGlobalMetadata(bytes27)": { - "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." - }, - "setNextOverwritableIndex(uint256)": { - "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 3530, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "owner", - "offset": 0, - "slot": "1", - "type": "t_string_storage" - }, - { - "astId": 3532, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buffer", - "offset": 0, - "slot": "2", - "type": "t_struct(RingBuffer)17592_storage" - } - ], - "types": { - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_uint256,t_bytes32)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bytes32)", - "numberOfBytes": "32", - "value": "t_bytes32" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(Buffer)17581_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", - "members": [ - { - "astId": 17576, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 17580, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buf", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_uint256,t_bytes32)" - } - ], - "numberOfBytes": "64" - }, - "t_struct(RingBuffer)17592_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17583, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17585, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17587, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17589, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17591, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "nextOverwritableIndex", - "offset": 0, - "slot": "6", - "type": "t_uint256" - } - ], - "numberOfBytes": "224" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json b/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json deleted file mode 100644 index b700c2ce1..000000000 --- a/deployments/kovan/OVM_ChainStorageContainer:CTC:queue.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "address": "0x06Ce68b7798B51f70bC7b3789927DE5aE1E8553E", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_owner", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "get", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGlobalMetadata", - "outputs": [ - { - "internalType": "bytes27", - "name": "", - "type": "bytes27" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "setGlobalMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x9e3b086de80db8af2a94823deefb325bf61c411a1c7b1678246760261c98c675", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x06Ce68b7798B51f70bC7b3789927DE5aE1E8553E", - "transactionIndex": 3, - "gasUsed": "1101114", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xec69dd8429213b45eb9c69842f4baeb4b80b1b81ee37e474bbcfe9a93d441551", - "transactionHash": "0x9e3b086de80db8af2a94823deefb325bf61c411a1c7b1678246760261c98c675", - "logs": [], - "blockNumber": 23637105, - "cumulativeGasUsed": "1337417", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "OVM_CanonicalTransactionChain" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "devdoc": { - "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager.", - "_owner": "Name of the contract that owns this container (will be resolved later)." - } - }, - "deleteElementsAfterInclusive(uint256)": { - "params": { - "_index": "Object index to delete from." - } - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_index": "Object index to delete from." - } - }, - "get(uint256)": { - "params": { - "_index": "Index of the particular object to access." - }, - "returns": { - "_0": "32 byte object value." - } - }, - "getGlobalMetadata()": { - "returns": { - "_0": "Container global metadata field." - } - }, - "length()": { - "returns": { - "_0": "Number of objects in the container." - } - }, - "push(bytes32)": { - "params": { - "_object": "A 32 byte value to insert into the container." - } - }, - "push(bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_object": "A 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32)": { - "params": { - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "setGlobalMetadata(bytes27)": { - "params": { - "_globalMetadata": "New global metadata to set." - } - } - }, - "title": "OVM_ChainStorageContainer", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "deleteElementsAfterInclusive(uint256)": { - "notice": "Removes all objects after and including a given index." - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." - }, - "get(uint256)": { - "notice": "Retrieves an object from the container." - }, - "getGlobalMetadata()": { - "notice": "Retrieves the container's global metadata field." - }, - "length()": { - "notice": "Retrieves the number of objects stored in the container." - }, - "push(bytes32)": { - "notice": "Pushes an object into the container." - }, - "push(bytes32,bytes27)": { - "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." - }, - "push2(bytes32,bytes32)": { - "notice": "Pushes two objects into the container at the same time. A useful optimization." - }, - "push2(bytes32,bytes32,bytes27)": { - "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." - }, - "setGlobalMetadata(bytes27)": { - "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." - }, - "setNextOverwritableIndex(uint256)": { - "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 3530, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "owner", - "offset": 0, - "slot": "1", - "type": "t_string_storage" - }, - { - "astId": 3532, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buffer", - "offset": 0, - "slot": "2", - "type": "t_struct(RingBuffer)17592_storage" - } - ], - "types": { - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_uint256,t_bytes32)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bytes32)", - "numberOfBytes": "32", - "value": "t_bytes32" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(Buffer)17581_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", - "members": [ - { - "astId": 17576, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 17580, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buf", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_uint256,t_bytes32)" - } - ], - "numberOfBytes": "64" - }, - "t_struct(RingBuffer)17592_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17583, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17585, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17587, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17589, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17591, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "nextOverwritableIndex", - "offset": 0, - "slot": "6", - "type": "t_uint256" - } - ], - "numberOfBytes": "224" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json b/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json deleted file mode 100644 index 9d83ae699..000000000 --- a/deployments/kovan/OVM_ChainStorageContainer:SCC:batches.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "address": "0xAF1C94a7602557Ae77d868ed5a595904A6CD5DdA", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "string", - "name": "_owner", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "deleteElementsAfterInclusive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "get", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGlobalMetadata", - "outputs": [ - { - "internalType": "bytes27", - "name": "", - "type": "bytes27" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "length", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_object", - "type": "bytes32" - } - ], - "name": "push", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - }, - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_objectA", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_objectB", - "type": "bytes32" - } - ], - "name": "push2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes27", - "name": "_globalMetadata", - "type": "bytes27" - } - ], - "name": "setGlobalMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - } - ], - "name": "setNextOverwritableIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x48a5aea3621e8e9061a2a94f5388aecb58703dd0967b0b8b115f86fc9305861a", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xAF1C94a7602557Ae77d868ed5a595904A6CD5DdA", - "transactionIndex": 6, - "gasUsed": "1101054", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x082e88c2590d6c9055c0069b9ebd79a957477bb192600be997649a4987b64205", - "transactionHash": "0x48a5aea3621e8e9061a2a94f5388aecb58703dd0967b0b8b115f86fc9305861a", - "logs": [], - "blockNumber": 23637109, - "cumulativeGasUsed": "2021601", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - "OVM_StateCommitmentChain" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_objectA\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_objectB\",\"type\":\"bytes32\"}],\"name\":\"push2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"setNextOverwritableIndex\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_owner\":\"Name of the contract that owns this container (will be resolved later).\"}},\"deleteElementsAfterInclusive(uint256)\":{\"params\":{\"_index\":\"Object index to delete from.\"}},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_index\":\"Object index to delete from.\"}},\"get(uint256)\":{\"params\":{\"_index\":\"Index of the particular object to access.\"},\"returns\":{\"_0\":\"32 byte object value.\"}},\"getGlobalMetadata()\":{\"returns\":{\"_0\":\"Container global metadata field.\"}},\"length()\":{\"returns\":{\"_0\":\"Number of objects in the container.\"}},\"push(bytes32)\":{\"params\":{\"_object\":\"A 32 byte value to insert into the container.\"}},\"push(bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_object\":\"A 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32)\":{\"params\":{\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"push2(bytes32,bytes32,bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata for the container.\",\"_objectA\":\"First 32 byte value to insert into the container.\",\"_objectB\":\"Second 32 byte value to insert into the container.\"}},\"setGlobalMetadata(bytes27)\":{\"params\":{\"_globalMetadata\":\"New global metadata to set.\"}}},\"title\":\"OVM_ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"push2(bytes32,bytes32)\":{\"notice\":\"Pushes two objects into the container at the same time. A useful optimization.\"},\"push2(bytes32,bytes32,bytes27)\":{\"notice\":\"Pushes two objects into the container at the same time. Also allows setting the global metadata field.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"},\"setNextOverwritableIndex(uint256)\":{\"notice\":\"Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":\"OVM_ChainStorageContainer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_RingBuffer } from \\\"../../libraries/utils/Lib_RingBuffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title OVM_ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\\n * transactions being finalized.\\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\\n * 1. Stores transaction batches for the Canonical Transaction Chain\\n * 2. Stores queued transactions for the Canonical Transaction Chain\\n * 3. Stores chain state batches for the State Commitment Chain\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\\n\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\\n\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_RingBuffer.RingBuffer internal buffer;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _owner Name of the contract that owns this container (will be resolved later).\\n */\\n constructor(\\n address _libAddressManager,\\n string memory _owner\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"OVM_ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function getGlobalMetadata()\\n override\\n public\\n view\\n returns (\\n bytes27\\n )\\n {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function length()\\n override\\n public\\n view\\n returns (\\n uint256\\n )\\n {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.push2(_objectA, _objectB, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function get(\\n uint256 _index\\n )\\n override\\n public\\n view\\n returns (\\n bytes32\\n )\\n {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(\\n uint40(_index),\\n _globalMetadata\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_ChainStorageContainer\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n override\\n public\\n onlyOwner\\n {\\n buffer.nextOverwritableIndex = _index;\\n }\\n}\\n\",\"keccak256\":\"0x2444ce2c2b1e3fd22611db21d165258c75d9068cca65d45480c757e366844bd2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nlibrary Lib_RingBuffer {\\n using Lib_RingBuffer for RingBuffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n uint256 length;\\n mapping (uint256 => bytes32) buf;\\n }\\n\\n struct RingBuffer {\\n bytes32 contextA;\\n bytes32 contextB;\\n Buffer bufferA;\\n Buffer bufferB;\\n uint256 nextOverwritableIndex;\\n }\\n\\n struct RingBufferContext {\\n // contextA\\n uint40 globalIndex;\\n bytes27 extraData;\\n\\n // contextB\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n }\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant MIN_CAPACITY = 16;\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n\\n // Set a minimum capacity.\\n if (currBuffer.length == 0) {\\n currBuffer.length = MIN_CAPACITY;\\n }\\n\\n // Check if we need to expand the buffer.\\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\\n // We're going to overwrite the inactive buffer.\\n // Bump the buffer index, reset the delete offset, and set our reset indices.\\n ctx.currBufferIndex++;\\n ctx.prevResetIndex = ctx.currResetIndex;\\n ctx.currResetIndex = ctx.globalIndex;\\n\\n // Swap over to the next buffer.\\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n } else {\\n // We're not overwriting yet, double the length of the current buffer.\\n currBuffer.length *= 2;\\n }\\n }\\n\\n // Index to write to is the difference of the global and reset indices.\\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\\n currBuffer.buf[writeHead] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.globalIndex++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(\\n RingBuffer storage _self,\\n bytes32 _value\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n \\n _self.push(\\n _value,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n * @param _extraData Optional global extra data.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB,\\n bytes27 _extraData\\n )\\n internal\\n {\\n _self.push(_valueA, _extraData);\\n _self.push(_valueB, _extraData);\\n }\\n\\n /**\\n * Pushes a two elements to the buffer.\\n * @param _self Buffer to access.\\n * @param _valueA First value to push to the buffer.\\n * @param _valueA Second value to push to the buffer.\\n */\\n function push2(\\n RingBuffer storage _self,\\n bytes32 _valueA,\\n bytes32 _valueB\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n _self.push2(\\n _valueA,\\n _valueB,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves an element from the buffer.\\n * @param _self Buffer to access.\\n * @param _index Element index to retrieve.\\n * @return Value of the element at the given index.\\n */\\n function get(\\n RingBuffer storage _self,\\n uint256 _index\\n )\\n internal\\n view\\n returns (\\n bytes32 \\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index >= ctx.currResetIndex) {\\n // We're trying to load an element from the current buffer.\\n // Relative index is just the difference from the reset index.\\n uint256 relativeIndex = _index - ctx.currResetIndex;\\n\\n // Shouldn't happen but why not check.\\n require(\\n relativeIndex < currBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return currBuffer.buf[relativeIndex];\\n } else {\\n // We're trying to load an element from the previous buffer.\\n // Relative index is the difference from the reset index in the other direction.\\n uint256 relativeIndex = ctx.currResetIndex - _index;\\n\\n // Condition only fails in the case that we deleted and flipped buffers.\\n require(\\n ctx.currResetIndex > ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n // Make sure we're not trying to read beyond the array.\\n require(\\n relativeIndex <= prevBuffer.length,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\\n }\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n\\n require(\\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\\n \\\"Index out of bounds.\\\"\\n );\\n\\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\\n\\n if (_index < ctx.currResetIndex) {\\n // We're switching back to the previous buffer.\\n // Reduce the buffer index, set the current reset index back to match the previous one.\\n // We use the equality of these two values to prevent reading beyond this buffer.\\n ctx.currBufferIndex--;\\n ctx.currResetIndex = ctx.prevResetIndex;\\n }\\n\\n // Set our global index and extra data, save the context.\\n ctx.globalIndex = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(\\n RingBuffer storage _self,\\n uint40 _index\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(\\n _index,\\n ctx.extraData\\n );\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n uint40\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.globalIndex;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(\\n RingBuffer storage _self,\\n bytes27 _extraData\\n )\\n internal\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n bytes27\\n )\\n {\\n RingBufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current ring buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current ring buffer context.\\n */\\n function setContext(\\n RingBuffer storage _self,\\n RingBufferContext memory _ctx\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes32 contextA;\\n bytes32 contextB;\\n\\n uint40 globalIndex = _ctx.globalIndex;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n contextA := globalIndex\\n contextA := or(contextA, extraData)\\n }\\n\\n uint64 currBufferIndex = _ctx.currBufferIndex;\\n uint40 prevResetIndex = _ctx.prevResetIndex;\\n uint40 currResetIndex = _ctx.currResetIndex;\\n assembly {\\n contextB := currBufferIndex\\n contextB := or(contextB, shl(64, prevResetIndex))\\n contextB := or(contextB, shl(104, currResetIndex))\\n }\\n\\n if (_self.contextA != contextA) {\\n _self.contextA = contextA;\\n }\\n\\n if (_self.contextB != contextB) {\\n _self.contextB = contextB;\\n }\\n }\\n\\n /**\\n * Retrieves the current ring buffer context.\\n * @param _self Buffer to access.\\n * @return Current ring buffer context.\\n */\\n function getContext(\\n RingBuffer storage _self\\n )\\n internal\\n view\\n returns (\\n RingBufferContext memory\\n )\\n {\\n bytes32 contextA = _self.contextA;\\n bytes32 contextB = _self.contextB;\\n\\n uint40 globalIndex;\\n bytes27 extraData;\\n assembly {\\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n }\\n\\n uint64 currBufferIndex;\\n uint40 prevResetIndex;\\n uint40 currResetIndex;\\n assembly {\\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\\n }\\n\\n return RingBufferContext({\\n globalIndex: globalIndex,\\n extraData: extraData,\\n currBufferIndex: currBufferIndex,\\n prevResetIndex: prevResetIndex,\\n currResetIndex: currResetIndex\\n });\\n }\\n\\n /**\\n * Retrieves the a buffer from the ring buffer by index.\\n * @param _self Buffer to access.\\n * @param _which Index of the sub buffer to access.\\n * @return Sub buffer for the index.\\n */\\n function getBuffer(\\n RingBuffer storage _self,\\n uint256 _which\\n )\\n internal\\n view\\n returns (\\n Buffer storage\\n )\\n {\\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\\n }\\n}\\n\",\"keccak256\":\"0xb34c1172604a926455c6389fa27d62234b7f0f188ee1ec24307f5d9576d83353\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620013f3380380620013f3833981810160405260408110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82516401000000008111828201881017156200009057600080fd5b82525081516020918201929091019080838360005b83811015620000bf578181015183820152602001620000a5565b50505050905090810190601f168015620000ed5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b0319166001600160a01b038516179055508051620001249060019060208401906200012d565b505050620001d9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620001655760008555620001b0565b82601f106200018057805160ff1916838001178555620001b0565b82800160010185558215620001b0579182015b82811115620001b057825182559160200191906001019062000193565b50620001be929150620001c2565b5090565b5b80821115620001be5760008155600101620001c3565b61120a80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80634651d91e1161008c578063b298e36b11610066578063b298e36b14610315578063ccf8f96914610332578063d41c021814610355578063fa9e936c14610378576100cf565b80634651d91e1461025e5780638da5cb5b1461027b5780639507d39a146102f8576100cf565b806314f22255146100d4578063167fd681146101075780631f7b6d32146101325780632015276c1461014c57806329061de214610177578063461a44781461019c575b600080fd5b610105600480360360608110156100ea57600080fd5b508035906020810135906040013564ffffffffff1916610395565b005b6101056004803603604081101561011d57600080fd5b508035906020013564ffffffffff191661048c565b61013a61054c565b60408051918252519081900360200190f35b6101056004803603604081101561016257600080fd5b508035906020013564ffffffffff1916610564565b6101056004803603602081101561018d57600080fd5b503564ffffffffff1916610620565b610242600480360360208110156101b257600080fd5b8101906020810181356401000000008111156101cd57600080fd5b8201836020820111156101df57600080fd5b8035906020019184600183028401116401000000008311171561020157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106de945050505050565b604080516001600160a01b039092168252519081900360200190f35b6101056004803603602081101561027457600080fd5b50356107ba565b610283610875565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bd5781810151838201526020016102a5565b50505050905090810190601f1680156102ea5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61013a6004803603602081101561030e57600080fd5b5035610902565b6101056004803603602081101561032b57600080fd5b503561091c565b61033a6109d7565b6040805164ffffffffff199092168252519081900360200190f35b6101056004803603604081101561036b57600080fd5b50803590602001356109e8565b6101056004803603602081101561038e57600080fd5b5035610aa4565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261042b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b50505050506106de565b6001600160a01b0316336001600160a01b03161461047a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6104876002848484610b59565b505050565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526104ed93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461053c5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610b75565b5050565b60006105586002610cb7565b64ffffffffff16905090565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526105c593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106145760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b61054860028383610ccb565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261068193909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146106d05760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610dca565b50565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561073e578181015183820152602001610726565b50505050905090810190601f16801561076b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d60208110156107b257600080fd5b505192915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261081b93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b03161461086a5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db600282610def565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108fa5780601f106108cf576101008083540402835291602001916108fa565b820191906000526020600020905b8154815290600101906020018083116108dd57829003601f168201915b505050505081565b6000610916600264ffffffffff8416610e15565b92915050565b60018054604080516020601f60026000196101008789161502019095169490940493840181900481028201810190925282815261097d93909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b0316146109cc5760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6106db60028261101e565b60006109e36002611044565b905090565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610a4993909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610a985760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b6105486002838361105b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152610b0593909290918301828280156104215780601f106103f657610100808354040283529160200191610421565b6001600160a01b0316336001600160a01b031614610b545760405162461bcd60e51b81526004018080602001828103825260448152602001806111916044913960600191505060405180910390fd5b600855565b610b64848483610ccb565b610b6f848383610ccb565b50505050565b6000610b8084611083565b9050806000015164ffffffffff168364ffffffffff16108015610bb55750806060015164ffffffffff168364ffffffffff1610155b610bfd576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610c20826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610c48836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168564ffffffffff161015610c8c576040830180516000190167ffffffffffffffff169052606083015164ffffffffff1660808401525b64ffffffffff8516835264ffffffffff1984166020840152610cae8684611103565b50505050505050565b600080610cc383611083565b519392505050565b6000610cd684611083565b90506000610cfb826040015167ffffffffffffffff16866110e390919063ffffffff16565b8054909150610d0957601081555b8054608083015183510364ffffffffff1610610d80578460060154826080015164ffffffffff161015610d785760408201805160010167ffffffffffffffff169081905260808301805164ffffffffff90811660608601528451169052610d719086906110e3565b9050610d80565b805460020281555b608082015182510364ffffffffff9081166000818152600184810160209081526040909220889055855101909216845264ffffffffff19851691840191909152610cae8684611103565b6000610dd583611083565b64ffffffffff19831660208201529050610b6f8382611103565b6000610dfa83611083565b905061048782826020015185610b759092919063ffffffff16565b600080610e2184611083565b805190915064ffffffffff168310610e77576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000610e9a826040015167ffffffffffffffff16866110e390919063ffffffff16565b90506000610ec2836040015160010167ffffffffffffffff16876110e390919063ffffffff16565b9050826080015164ffffffffff168510610f4f576080830151825464ffffffffff9091168603908110610f33576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b6000908152600190920160205250604090205491506109169050565b6080830151606084015164ffffffffff9182168781039290911610610fb2576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154811115610fff576040805162461bcd60e51b815260206004820152601460248201527324b73232bc1037baba1037b3103137bab732399760611b604482015290519081900360640190fd5b8154036000908152600190910160205260409020549250610916915050565b600061102983611083565b905061048782826020015185610ccb9092919063ffffffff16565b60008061105083611083565b602001519392505050565b600061106684611083565b9050610b6f8383836020015187610b59909392919063ffffffff16565b61108b611162565b5080546001909101546040805160a08101825264ffffffffff808516825264ffffffffff19909416602082015267ffffffffffffffff8316818301529082901c8316606082015260689190911c909116608082015290565b600060028206156110f757826004016110fc565b826002015b9392505050565b80516020820151604080840151606085015160808601518754600096868117969584901b8517606884901b17959094909390929091871461114257868a555b858a60010154146111555760018a018690555b5050505050505092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fe4f564d5f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e65722ea264697066735822122098ab07d4274bb202e1d3d5056169588e1e25c36d5e96aa82e275a66e7070b06864736f6c63430007060033", - "devdoc": { - "details": "The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three disctint Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager.", - "_owner": "Name of the contract that owns this container (will be resolved later)." - } - }, - "deleteElementsAfterInclusive(uint256)": { - "params": { - "_index": "Object index to delete from." - } - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_index": "Object index to delete from." - } - }, - "get(uint256)": { - "params": { - "_index": "Index of the particular object to access." - }, - "returns": { - "_0": "32 byte object value." - } - }, - "getGlobalMetadata()": { - "returns": { - "_0": "Container global metadata field." - } - }, - "length()": { - "returns": { - "_0": "Number of objects in the container." - } - }, - "push(bytes32)": { - "params": { - "_object": "A 32 byte value to insert into the container." - } - }, - "push(bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_object": "A 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32)": { - "params": { - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "push2(bytes32,bytes32,bytes27)": { - "params": { - "_globalMetadata": "New global metadata for the container.", - "_objectA": "First 32 byte value to insert into the container.", - "_objectB": "Second 32 byte value to insert into the container." - } - }, - "setGlobalMetadata(bytes27)": { - "params": { - "_globalMetadata": "New global metadata to set." - } - } - }, - "title": "OVM_ChainStorageContainer", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "deleteElementsAfterInclusive(uint256)": { - "notice": "Removes all objects after and including a given index." - }, - "deleteElementsAfterInclusive(uint256,bytes27)": { - "notice": "Removes all objects after and including a given index. Also allows setting the global metadata field." - }, - "get(uint256)": { - "notice": "Retrieves an object from the container." - }, - "getGlobalMetadata()": { - "notice": "Retrieves the container's global metadata field." - }, - "length()": { - "notice": "Retrieves the number of objects stored in the container." - }, - "push(bytes32)": { - "notice": "Pushes an object into the container." - }, - "push(bytes32,bytes27)": { - "notice": "Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \"length\" storage slot anyway, which also contains the global metadata (it's an optimization)." - }, - "push2(bytes32,bytes32)": { - "notice": "Pushes two objects into the container at the same time. A useful optimization." - }, - "push2(bytes32,bytes32,bytes27)": { - "notice": "Pushes two objects into the container at the same time. Also allows setting the global metadata field." - }, - "setGlobalMetadata(bytes27)": { - "notice": "Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data." - }, - "setNextOverwritableIndex(uint256)": { - "notice": "Marks an index as overwritable, meaing the underlying buffer can start to write values over any objects before and including the given index." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 3530, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "owner", - "offset": 0, - "slot": "1", - "type": "t_string_storage" - }, - { - "astId": 3532, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buffer", - "offset": 0, - "slot": "2", - "type": "t_struct(RingBuffer)17592_storage" - } - ], - "types": { - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_uint256,t_bytes32)": { - "encoding": "mapping", - "key": "t_uint256", - "label": "mapping(uint256 => bytes32)", - "numberOfBytes": "32", - "value": "t_bytes32" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(Buffer)17581_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.Buffer", - "members": [ - { - "astId": 17576, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "length", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 17580, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "buf", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_uint256,t_bytes32)" - } - ], - "numberOfBytes": "64" - }, - "t_struct(RingBuffer)17592_storage": { - "encoding": "inplace", - "label": "struct Lib_RingBuffer.RingBuffer", - "members": [ - { - "astId": 17583, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextA", - "offset": 0, - "slot": "0", - "type": "t_bytes32" - }, - { - "astId": 17585, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "contextB", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 17587, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferA", - "offset": 0, - "slot": "2", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17589, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "bufferB", - "offset": 0, - "slot": "4", - "type": "t_struct(Buffer)17581_storage" - }, - { - "astId": 17591, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol:OVM_ChainStorageContainer", - "label": "nextOverwritableIndex", - "offset": 0, - "slot": "6", - "type": "t_uint256" - } - ], - "numberOfBytes": "224" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_ExecutionManager.json b/deployments/kovan/OVM_ExecutionManager.json deleted file mode 100644 index 69c30c201..000000000 --- a/deployments/kovan/OVM_ExecutionManager.json +++ /dev/null @@ -1,1246 +0,0 @@ -{ - "address": "0xE55fdd933d620627705250379dd32cd6Ec892522", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "minTransactionGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTransactionGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxGasPerQueuePerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "secondsPerEpoch", - "type": "uint256" - } - ], - "internalType": "struct iOVM_ExecutionManager.GasMeterConfig", - "name": "_gasMeterConfig", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "ovmCHAINID", - "type": "uint256" - } - ], - "internalType": "struct iOVM_ExecutionManager.GlobalContext", - "name": "_globalContext", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "getMaxTransactionGasLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "_maxTransactionGasLimit", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "_ADDRESS", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "ovmCALL", - "outputs": [ - { - "internalType": "bool", - "name": "_success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "_returndata", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ovmCALLER", - "outputs": [ - { - "internalType": "address", - "name": "_CALLER", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmCHAINID", - "outputs": [ - { - "internalType": "uint256", - "name": "_CHAINID", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_bytecode", - "type": "bytes" - } - ], - "name": "ovmCREATE", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_bytecode", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "_salt", - "type": "bytes32" - } - ], - "name": "ovmCREATE2", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_messageHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "_v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "_r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_s", - "type": "bytes32" - } - ], - "name": "ovmCREATEEOA", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "ovmDELEGATECALL", - "outputs": [ - { - "internalType": "bool", - "name": "_success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "_returndata", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_offset", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_length", - "type": "uint256" - } - ], - "name": "ovmEXTCODECOPY", - "outputs": [ - { - "internalType": "bytes", - "name": "_code", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "name": "ovmEXTCODEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "_EXTCODEHASH", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "name": "ovmEXTCODESIZE", - "outputs": [ - { - "internalType": "uint256", - "name": "_EXTCODESIZE", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ovmGASLIMIT", - "outputs": [ - { - "internalType": "uint256", - "name": "_GASLIMIT", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmGETNONCE", - "outputs": [ - { - "internalType": "uint256", - "name": "_nonce", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ovmL1QUEUEORIGIN", - "outputs": [ - { - "internalType": "enum Lib_OVMCodec.QueueOrigin", - "name": "_queueOrigin", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmL1TXORIGIN", - "outputs": [ - { - "internalType": "address", - "name": "_l1TxOrigin", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ovmNUMBER", - "outputs": [ - { - "internalType": "uint256", - "name": "_NUMBER", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "ovmREVERT", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_nonce", - "type": "uint256" - } - ], - "name": "ovmSETNONCE", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_key", - "type": "bytes32" - } - ], - "name": "ovmSLOAD", - "outputs": [ - { - "internalType": "bytes32", - "name": "_value", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_key", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_value", - "type": "bytes32" - } - ], - "name": "ovmSSTORE", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "ovmSTATICCALL", - "outputs": [ - { - "internalType": "bool", - "name": "_success", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "_returndata", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ovmTIMESTAMP", - "outputs": [ - { - "internalType": "uint256", - "name": "_TIMESTAMP", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "enum Lib_OVMCodec.QueueOrigin", - "name": "l1QueueOrigin", - "type": "uint8" - }, - { - "internalType": "address", - "name": "l1TxOrigin", - "type": "address" - }, - { - "internalType": "address", - "name": "entrypoint", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.Transaction", - "name": "_transaction", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_ovmStateManager", - "type": "address" - } - ], - "name": "run", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_bytecode", - "type": "bytes" - } - ], - "name": "safeCREATE", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "enum Lib_OVMCodec.QueueOrigin", - "name": "l1QueueOrigin", - "type": "uint8" - }, - { - "internalType": "address", - "name": "l1TxOrigin", - "type": "address" - }, - { - "internalType": "address", - "name": "entrypoint", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.Transaction", - "name": "_transaction", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_from", - "type": "address" - }, - { - "internalType": "contract iOVM_StateManager", - "name": "_ovmStateManager", - "type": "address" - } - ], - "name": "simulateMessage", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x0b637586f6bd15e031f459b57264d7a2a1abbf050198af644c2df528d688875c", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xE55fdd933d620627705250379dd32cd6Ec892522", - "transactionIndex": 4, - "gasUsed": "3207657", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xccae2bf861349aec4ec5327584fec9753cf13368bb40c619ffff5d79e6fc1f52", - "transactionHash": "0x0b637586f6bd15e031f459b57264d7a2a1abbf050198af644c2df528d688875c", - "logs": [], - "blockNumber": 23637114, - "cumulativeGasUsed": "3946015", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - { - "minTransactionGasLimit": 20000, - "maxTransactionGasLimit": 9000000, - "maxGasPerQueuePerEpoch": 9000000, - "secondsPerEpoch": 0 - }, - { - "ovmCHAINID": 10 - } - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"minTransactionGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxTransactionGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxGasPerQueuePerEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"secondsPerEpoch\",\"type\":\"uint256\"}],\"internalType\":\"struct iOVM_ExecutionManager.GasMeterConfig\",\"name\":\"_gasMeterConfig\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"ovmCHAINID\",\"type\":\"uint256\"}],\"internalType\":\"struct iOVM_ExecutionManager.GlobalContext\",\"name\":\"_globalContext\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getMaxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_ADDRESS\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmCALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmCALLER\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_CALLER\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmCHAINID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_CHAINID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"ovmCREATE\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_salt\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATE2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"_v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"_r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_s\",\"type\":\"bytes32\"}],\"name\":\"ovmCREATEEOA\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmDELEGATECALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_offset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_length\",\"type\":\"uint256\"}],\"name\":\"ovmEXTCODECOPY\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmEXTCODEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_EXTCODEHASH\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"name\":\"ovmEXTCODESIZE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_EXTCODESIZE\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmGASLIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_GASLIMIT\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmGETNONCE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmL1QUEUEORIGIN\",\"outputs\":[{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"_queueOrigin\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmL1TXORIGIN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_l1TxOrigin\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmNUMBER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_NUMBER\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ovmREVERT\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"ovmSETNONCE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"}],\"name\":\"ovmSLOAD\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"ovmSSTORE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"ovmSTATICCALL\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"_returndata\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ovmTIMESTAMP\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_TIMESTAMP\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"run\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"safeCREATE\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"name\":\"simulateMessage\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed environment allowing us to execute OVM transactions deterministically on either Layer 1 or Layer 2. The EM's run() function is the first function called during the execution of any transaction on L2. For each context-dependent EVM operation the EM has a function which implements a corresponding OVM operation, which will read state from the State Manager contract. The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any context-dependent operations. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"ovmADDRESS()\":{\"returns\":{\"_ADDRESS\":\"Active ADDRESS within the current message context.\"}},\"ovmCALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmCALLER()\":{\"returns\":{\"_CALLER\":\"Address of the CALLER within the current message context.\"}},\"ovmCHAINID()\":{\"returns\":{\"_CHAINID\":\"Value of the chain's CHAINID within the global context.\"}},\"ovmCREATE(bytes)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE a new contract.\"},\"returns\":{\"_contract\":\"Address of the created contract.\"}},\"ovmCREATE2(bytes,bytes32)\":{\"params\":{\"_bytecode\":\"Code to be used to CREATE2 a new contract.\",\"_salt\":\"Value used to determine the contract's address.\"},\"returns\":{\"_contract\":\"Address of the created contract.\"}},\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\":{\"details\":\"Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks because the contract we're creating is trusted (no need to do safety checking or to handle unexpected reverts). Doesn't need to return an address because the address is assumed to be the user's actual address.\",\"params\":{\"_messageHash\":\"Hash of a message signed by some user, for verification.\",\"_r\":\"Signature `r` parameter.\",\"_s\":\"Signature `s` parameter.\",\"_v\":\"Signature `v` parameter.\"}},\"ovmDELEGATECALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmEXTCODECOPY(address,uint256,uint256)\":{\"params\":{\"_contract\":\"Address of the contract to copy code from.\",\"_length\":\"Total number of bytes to copy from the contract's code.\",\"_offset\":\"Offset in bytes from the start of contract code to copy beyond.\"},\"returns\":{\"_code\":\"Bytes of code copied from the requested contract.\"}},\"ovmEXTCODEHASH(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the hash of.\"},\"returns\":{\"_EXTCODEHASH\":\"Hash of the requested contract.\"}},\"ovmEXTCODESIZE(address)\":{\"params\":{\"_contract\":\"Address of the contract to query the size of.\"},\"returns\":{\"_EXTCODESIZE\":\"Size of the requested contract in bytes.\"}},\"ovmGASLIMIT()\":{\"returns\":{\"_GASLIMIT\":\"Value of the block's GASLIMIT within the transaction context.\"}},\"ovmGETNONCE()\":{\"returns\":{\"_nonce\":\"Nonce of the current contract.\"}},\"ovmL1QUEUEORIGIN()\":{\"returns\":{\"_queueOrigin\":\"Address of the ovmL1QUEUEORIGIN within the current message context.\"}},\"ovmL1TXORIGIN()\":{\"returns\":{\"_l1TxOrigin\":\"Address of the account which sent the tx into L2 from L1.\"}},\"ovmNUMBER()\":{\"returns\":{\"_NUMBER\":\"Value of the NUMBER within the transaction context.\"}},\"ovmREVERT(bytes)\":{\"params\":{\"_data\":\"Bytes data to pass along with the REVERT.\"}},\"ovmSETNONCE(uint256)\":{\"params\":{\"_nonce\":\"New nonce for the current contract.\"}},\"ovmSLOAD(bytes32)\":{\"params\":{\"_key\":\"32 byte key of the storage slot to load.\"},\"returns\":{\"_value\":\"32 byte value of the requested storage slot.\"}},\"ovmSSTORE(bytes32,bytes32)\":{\"params\":{\"_key\":\"32 byte key of the storage slot to set.\",\"_value\":\"32 byte value for the storage slot.\"}},\"ovmSTATICCALL(uint256,address,bytes)\":{\"params\":{\"_address\":\"Address of the contract to call.\",\"_calldata\":\"Data to send along with the call.\",\"_gasLimit\":\"Amount of gas to be passed into this call.\"},\"returns\":{\"_returndata\":\"Data returned by the call.\",\"_success\":\"Whether or not the call returned (rather than reverted).\"}},\"ovmTIMESTAMP()\":{\"returns\":{\"_TIMESTAMP\":\"Value of the TIMESTAMP within the transaction context.\"}},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"params\":{\"_ovmStateManager\":\"iOVM_StateManager implementation providing account state.\",\"_transaction\":\"Transaction data to be executed.\"}},\"safeCREATE(address,bytes)\":{\"details\":\"This function is implemented as `public` because we need to be able to revert a contract creation without losing information about exactly *why* the contract reverted. In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS flag and then revert to reset the flag. We're able to do this by making an external call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay information before reverting.\",\"params\":{\"_address\":\"Address of the contract to associate with the one being created.\",\"_bytecode\":\"Code to be used to create the new contract.\"}},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)\":{\"params\":{\"_from\":\"the OVM account the simulated call should be from.\",\"_transaction\":\"the message transaction to simulate.\"}}},\"title\":\"OVM_ExecutionManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"ovmADDRESS()\":{\"notice\":\"Overrides ADDRESS.\"},\"ovmCALL(uint256,address,bytes)\":{\"notice\":\"Overrides CALL.\"},\"ovmCALLER()\":{\"notice\":\"Overrides CALLER.\"},\"ovmCHAINID()\":{\"notice\":\"Overrides CHAINID.\"},\"ovmCREATE(bytes)\":{\"notice\":\"Overrides CREATE.\"},\"ovmCREATE2(bytes,bytes32)\":{\"notice\":\"Overrides CREATE2.\"},\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\":{\"notice\":\"Creates a new EOA contract account, for account abstraction.\"},\"ovmDELEGATECALL(uint256,address,bytes)\":{\"notice\":\"Overrides DELEGATECALL.\"},\"ovmEXTCODECOPY(address,uint256,uint256)\":{\"notice\":\"Overrides EXTCODECOPY.\"},\"ovmEXTCODEHASH(address)\":{\"notice\":\"Overrides EXTCODEHASH.\"},\"ovmEXTCODESIZE(address)\":{\"notice\":\"Overrides EXTCODESIZE.\"},\"ovmGASLIMIT()\":{\"notice\":\"Overrides GASLIMIT.\"},\"ovmGETNONCE()\":{\"notice\":\"Retrieves the nonce of the current ovmADDRESS.\"},\"ovmL1QUEUEORIGIN()\":{\"notice\":\"Specifies from which L1 rollup queue this transaction originated from.\"},\"ovmL1TXORIGIN()\":{\"notice\":\"Specifies which L1 account, if any, sent this transaction by calling enqueue().\"},\"ovmNUMBER()\":{\"notice\":\"Overrides NUMBER.\"},\"ovmREVERT(bytes)\":{\"notice\":\"Overrides REVERT.\"},\"ovmSETNONCE(uint256)\":{\"notice\":\"Sets the nonce of the current ovmADDRESS.\"},\"ovmSLOAD(bytes32)\":{\"notice\":\"Overrides SLOAD.\"},\"ovmSSTORE(bytes32,bytes32)\":{\"notice\":\"Overrides SSTORE.\"},\"ovmSTATICCALL(uint256,address,bytes)\":{\"notice\":\"Overrides STATICCALL.\"},\"ovmTIMESTAMP()\":{\"notice\":\"Overrides TIMESTAMP.\"},\"run((uint256,uint256,uint8,address,address,uint256,bytes),address)\":{\"notice\":\"Starts the execution of a transaction via the OVM_ExecutionManager.\"},\"safeCREATE(address,bytes)\":{\"notice\":\"Performs the logic to create a contract and revert under various potential conditions.\"},\"simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)\":{\"notice\":\"Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":\"OVM_ExecutionManager\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_ECDSAContractAccount } from \\\"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\nimport { Lib_SafeMathWrapper } from \\\"../../libraries/wrappers/Lib_SafeMathWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ECDSAContractAccount\\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \\n * providing eth_sign and EIP155 formatted transaction encodings.\\n *\\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\\n\\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Executes a signed transaction.\\n * @param _transaction Signed EOA transaction.\\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\\n\\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\\n // recovered address of the user who signed this message. This is how we manage to shim\\n // account abstraction even though the user isn't a contract.\\n // Need to make sure that the transaction nonce is right and bump it if so.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_ECDSAUtils.recover(\\n _transaction,\\n isEthSign,\\n _v,\\n _r,\\n _s\\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\\n \\\"Signature provided for EOA transaction execution is invalid.\\\"\\n );\\n\\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\\n\\n // Need to make sure that the transaction chainId is correct.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n \\\"Transaction chainId does not match expected OVM chainId.\\\"\\n );\\n\\n // Need to make sure that the transaction nonce is right.\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\\n \\\"Transaction nonce does not match the expected nonce.\\\"\\n );\\n\\n // TEMPORARY: Disable gas checks for minnet.\\n // // Need to make sure that the gas is sufficient to execute the transaction.\\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\\n // \\\"Gas is not sufficient to execute the transaction.\\\"\\n // );\\n\\n // Transfer fee to relayer.\\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\\n gasleft(),\\n ETH_ERC20_ADDRESS,\\n abi.encodeWithSignature(\\\"transfer(address,uint256)\\\", relayer, fee)\\n );\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n success == true,\\n \\\"Fee was not transferred to relayer.\\\"\\n );\\n\\n // Contract creations are signalled by sending a transaction to the zero address.\\n if (decodedTx.to == address(0)) {\\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\\n decodedTx.gasLimit,\\n decodedTx.data\\n );\\n\\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\\n // initialization. Always return `true` for our success value here.\\n return (true, abi.encode(created));\\n } else {\\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\\n // cases, but since this is a contract we'd end up bumping the nonce twice.\\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\\n\\n return Lib_SafeExecutionManagerWrapper.safeCALL(\\n decodedTx.gasLimit,\\n decodedTx.to,\\n decodedTx.data\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9eaaad64d70fb465dd323504f34ba44861dfe738621fce48e8a1e697405e592e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_ECDSAUtils } from \\\"../../libraries/utils/Lib_ECDSAUtils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_ProxyEOA\\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \\n * 'account abstraction' on layer 2. \\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_ProxyEOA {\\n\\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _implementation\\n )\\n public\\n {\\n _setImplementation(_implementation);\\n }\\n\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback()\\n external\\n {\\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\\n gasleft(),\\n getImplementation(),\\n msg.data\\n );\\n\\n if (success) {\\n assembly {\\n return(add(returndata, 0x20), mload(returndata))\\n }\\n } else {\\n Lib_SafeExecutionManagerWrapper.safeREVERT(\\n string(returndata)\\n );\\n }\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function upgrade(\\n address _implementation\\n )\\n external\\n {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\\n \\\"EOAs can only upgrade their own EOA implementation\\\"\\n );\\n\\n _setImplementation(_implementation);\\n }\\n\\n function getImplementation()\\n public\\n returns (\\n address _implementation\\n )\\n {\\n return address(uint160(uint256(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n IMPLEMENTATION_KEY\\n )\\n )));\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _setImplementation(\\n address _implementation\\n )\\n internal\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n IMPLEMENTATION_KEY,\\n bytes32(uint256(uint160(_implementation)))\\n );\\n }\\n}\",\"keccak256\":\"0xfbc7e9737d04824f9c1b63fc2151a591c768e3b643d9b3c44405559c3ef19e5e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_ECDSAContractAccount } from \\\"../accounts/OVM_ECDSAContractAccount.sol\\\";\\nimport { OVM_ProxyEOA } from \\\"../accounts/OVM_ProxyEOA.sol\\\";\\nimport { OVM_DeployerWhitelist } from \\\"../precompiles/OVM_DeployerWhitelist.sol\\\";\\n\\n/**\\n * @title OVM_ExecutionManager\\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\\n * Layer 2.\\n * The EM's run() function is the first function called during the execution of any\\n * transaction on L2.\\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\\n * OVM operation, which will read state from the State Manager contract.\\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\\n * context-dependent operations.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n iOVM_SafetyChecker internal ovmSafetyChecker;\\n iOVM_StateManager internal ovmStateManager;\\n\\n\\n /*******************************\\n * Execution Context Variables *\\n *******************************/\\n\\n GasMeterConfig internal gasMeterConfig;\\n GlobalContext internal globalContext;\\n TransactionContext internal transactionContext;\\n MessageContext internal messageContext;\\n TransactionRecord internal transactionRecord;\\n MessageRecord internal messageRecord;\\n\\n\\n /**************************\\n * Gas Metering Constants *\\n **************************/\\n\\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n GasMeterConfig memory _gasMeterConfig,\\n GlobalContext memory _globalContext\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\\\"OVM_SafetyChecker\\\"));\\n gasMeterConfig = _gasMeterConfig;\\n globalContext = _globalContext;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\\n * @param _cost Desired gas cost for the function after the refund.\\n */\\n modifier netGasCost(\\n uint256 _cost\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund everything *except* the specified cost.\\n if (_cost < gasUsed) {\\n transactionRecord.ovmGasRefund += gasUsed - _cost;\\n }\\n }\\n\\n /**\\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\\n */\\n modifier fixedGasDiscount(\\n uint256 _discount\\n ) {\\n uint256 gasProvided = gasleft();\\n _;\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // We want to refund the specified _discount, unless this risks underflow.\\n if (_discount < gasUsed) {\\n transactionRecord.ovmGasRefund += _discount;\\n } else {\\n // refund all we can without risking underflow.\\n transactionRecord.ovmGasRefund += gasUsed;\\n }\\n }\\n\\n /**\\n * Makes sure we're not inside a static context.\\n */\\n modifier notStatic() {\\n if (messageContext.isStatic == true) {\\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\\n }\\n _;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n /**\\n * Starts the execution of a transaction via the OVM_ExecutionManager.\\n * @param _transaction Transaction data to be executed.\\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\\n */\\n function run(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _ovmStateManager\\n )\\n override\\n public\\n {\\n require(transactionContext.ovmNUMBER == 0, \\\"Only be callable at the start of a transaction\\\");\\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\\n // address around in calldata).\\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\\n\\n // Make sure this function can't be called by anyone except the owner of the\\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\\n // this would make the `run` itself invalid.\\n require(\\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\\n ovmStateManager.isAuthenticated(msg.sender),\\n \\\"Only authenticated addresses in ovmStateManager can call this function\\\"\\n );\\n\\n // Initialize the execution context, must be initialized before we perform any gas metering\\n // or we'll throw a nuisance gas error.\\n _initContext(_transaction);\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Check whether we need to start a new epoch, do so if necessary.\\n // _checkNeedsNewEpoch(_transaction.timestamp);\\n\\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\\n // reverts for INVALID_STATE_ACCESS.\\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\\n return;\\n }\\n\\n // Check gas right before the call to get total gas consumed by OVM transaction.\\n uint256 gasProvided = gasleft();\\n\\n // Run the transaction, make sure to meter the gas usage.\\n ovmCALL(\\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\\n _transaction.entrypoint,\\n _transaction.data\\n );\\n uint256 gasUsed = gasProvided - gasleft();\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n // // Update the cumulative gas based on the amount of gas used.\\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\\n\\n // Wipe the execution context.\\n _resetContext();\\n\\n // Reset the ovmStateManager.\\n ovmStateManager = iOVM_StateManager(address(0));\\n }\\n\\n\\n /******************************\\n * Opcodes: Execution Context *\\n ******************************/\\n\\n /**\\n * @notice Overrides CALLER.\\n * @return _CALLER Address of the CALLER within the current message context.\\n */\\n function ovmCALLER()\\n override\\n public\\n view\\n returns (\\n address _CALLER\\n )\\n {\\n return messageContext.ovmCALLER;\\n }\\n\\n /**\\n * @notice Overrides ADDRESS.\\n * @return _ADDRESS Active ADDRESS within the current message context.\\n */\\n function ovmADDRESS()\\n override\\n public\\n view\\n returns (\\n address _ADDRESS\\n )\\n {\\n return messageContext.ovmADDRESS;\\n }\\n\\n /**\\n * @notice Overrides TIMESTAMP.\\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\\n */\\n function ovmTIMESTAMP()\\n override\\n public\\n view\\n returns (\\n uint256 _TIMESTAMP\\n )\\n {\\n return transactionContext.ovmTIMESTAMP;\\n }\\n\\n /**\\n * @notice Overrides NUMBER.\\n * @return _NUMBER Value of the NUMBER within the transaction context.\\n */\\n function ovmNUMBER()\\n override\\n public\\n view\\n returns (\\n uint256 _NUMBER\\n )\\n {\\n return transactionContext.ovmNUMBER;\\n }\\n\\n /**\\n * @notice Overrides GASLIMIT.\\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\\n */\\n function ovmGASLIMIT()\\n override\\n public\\n view\\n returns (\\n uint256 _GASLIMIT\\n )\\n {\\n return transactionContext.ovmGASLIMIT;\\n }\\n\\n /**\\n * @notice Overrides CHAINID.\\n * @return _CHAINID Value of the chain's CHAINID within the global context.\\n */\\n function ovmCHAINID()\\n override\\n public\\n view\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n return globalContext.ovmCHAINID;\\n }\\n\\n /*********************************\\n * Opcodes: L2 Execution Context *\\n *********************************/\\n\\n /**\\n * @notice Specifies from which L1 rollup queue this transaction originated from.\\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\\n */\\n function ovmL1QUEUEORIGIN()\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n {\\n return transactionContext.ovmL1QUEUEORIGIN;\\n }\\n\\n /**\\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\\n */\\n function ovmL1TXORIGIN()\\n override\\n public\\n view\\n returns (\\n address _l1TxOrigin\\n )\\n {\\n return transactionContext.ovmL1TXORIGIN;\\n }\\n\\n /********************\\n * Opcodes: Halting *\\n ********************/\\n\\n /**\\n * @notice Overrides REVERT.\\n * @param _data Bytes data to pass along with the REVERT.\\n */\\n function ovmREVERT(\\n bytes memory _data\\n )\\n override\\n public\\n {\\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\\n }\\n\\n\\n /******************************\\n * Opcodes: Contract Creation *\\n ******************************/\\n\\n /**\\n * @notice Overrides CREATE.\\n * @param _bytecode Code to be used to CREATE a new contract.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE(\\n bytes memory _bytecode\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\\n creator,\\n _getAccountNonce(creator)\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n /**\\n * @notice Overrides CREATE2.\\n * @param _bytecode Code to be used to CREATE2 a new contract.\\n * @param _salt Value used to determine the contract's address.\\n * @return _contract Address of the created contract.\\n */\\n function ovmCREATE2(\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n override\\n public\\n notStatic\\n fixedGasDiscount(40000)\\n returns (\\n address _contract\\n )\\n {\\n // Creator is always the current ADDRESS.\\n address creator = ovmADDRESS();\\n\\n // Check that the deployer is whitelisted, or\\n // that arbitrary contract deployment has been enabled.\\n _checkDeployerAllowed(creator);\\n\\n // Generate the correct CREATE2 address.\\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\\n creator,\\n _bytecode,\\n _salt\\n );\\n\\n return _createContract(\\n contractAddress,\\n _bytecode\\n );\\n }\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n /**\\n * Retrieves the nonce of the current ovmADDRESS.\\n * @return _nonce Nonce of the current contract.\\n */\\n function ovmGETNONCE()\\n override\\n public\\n returns (\\n uint256 _nonce\\n )\\n {\\n return _getAccountNonce(ovmADDRESS());\\n }\\n\\n /**\\n * Sets the nonce of the current ovmADDRESS.\\n * @param _nonce New nonce for the current contract.\\n */\\n function ovmSETNONCE(\\n uint256 _nonce\\n )\\n override\\n public\\n notStatic\\n {\\n _setAccountNonce(ovmADDRESS(), _nonce);\\n }\\n\\n /**\\n * Creates a new EOA contract account, for account abstraction.\\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\\n * because the contract we're creating is trusted (no need to do safety checking or to\\n * handle unexpected reverts). Doesn't need to return an address because the address is\\n * assumed to be the user's actual address.\\n * @param _messageHash Hash of a message signed by some user, for verification.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n */\\n function ovmCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n override\\n public\\n notStatic\\n {\\n // Recover the EOA address from the message hash and signature parameters. Since we do the\\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\\n // function were to return the wrong address (rather than explicitly returning the zero\\n // address), the rest of the transaction would simply fail (since there's no EOA account to\\n // actually execute the transaction).\\n address eoa = ecrecover(\\n _messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n\\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\\n // have this function return a `success` boolean, but this is just easier.\\n if (eoa == address(0)) {\\n ovmREVERT(bytes(\\\"Signature provided for EOA contract creation is invalid.\\\"));\\n }\\n\\n // If the user already has an EOA account, then there's no need to perform this operation.\\n if (_hasEmptyAccount(eoa) == false) {\\n return;\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(eoa);\\n\\n // Temporarily set the current address so it's easier to access on L2.\\n address prevADDRESS = messageContext.ovmADDRESS;\\n messageContext.ovmADDRESS = eoa;\\n\\n // Now actually create the account and get its bytecode. We're not worried about reverts\\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\\n\\n // Reset the address now that we're done deploying.\\n messageContext.ovmADDRESS = prevADDRESS;\\n\\n // Commit the account with its final values.\\n _commitPendingAccount(\\n eoa,\\n address(proxyEOA),\\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\\n );\\n\\n _setAccountNonce(eoa, 0);\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Interaction *\\n *********************************/\\n\\n /**\\n * @notice Overrides CALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(100000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // CALL updates the CALLER and ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides STATICCALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmSTATICCALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(80000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _address;\\n nextMessageContext.isStatic = true;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n /**\\n * @notice Overrides DELEGATECALL.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _address Address of the contract to call.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function ovmDELEGATECALL(\\n uint256 _gasLimit,\\n address _address,\\n bytes memory _calldata\\n )\\n override\\n public\\n fixedGasDiscount(40000)\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // DELEGATECALL does not change anything about the message context.\\n MessageContext memory nextMessageContext = messageContext;\\n bool isStaticEntrypoint = false;\\n\\n return _callContract(\\n nextMessageContext,\\n _gasLimit,\\n _address,\\n _calldata\\n );\\n }\\n\\n\\n /************************************\\n * Opcodes: Contract Storage Access *\\n ************************************/\\n\\n /**\\n * @notice Overrides SLOAD.\\n * @param _key 32 byte key of the storage slot to load.\\n * @return _value 32 byte value of the requested storage slot.\\n */\\n function ovmSLOAD(\\n bytes32 _key\\n )\\n override\\n public\\n netGasCost(40000)\\n returns (\\n bytes32 _value\\n )\\n {\\n // We always SLOAD from the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n return _getContractStorage(\\n contractAddress,\\n _key\\n );\\n }\\n\\n /**\\n * @notice Overrides SSTORE.\\n * @param _key 32 byte key of the storage slot to set.\\n * @param _value 32 byte value for the storage slot.\\n */\\n function ovmSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n notStatic\\n netGasCost(60000)\\n {\\n // We always SSTORE to the storage of ADDRESS.\\n address contractAddress = ovmADDRESS();\\n\\n _putContractStorage(\\n contractAddress,\\n _key,\\n _value\\n );\\n }\\n\\n\\n /*********************************\\n * Opcodes: Contract Code Access *\\n *********************************/\\n\\n /**\\n * @notice Overrides EXTCODECOPY.\\n * @param _contract Address of the contract to copy code from.\\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\\n * @param _length Total number of bytes to copy from the contract's code.\\n * @return _code Bytes of code copied from the requested contract.\\n */\\n function ovmEXTCODECOPY(\\n address _contract,\\n uint256 _offset,\\n uint256 _length\\n )\\n override\\n public\\n returns (\\n bytes memory _code\\n )\\n {\\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\\n // return data. By blocking reads of one byte, we're able to use the condition that an\\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\\n // an error without an explicit revert. If users were able to read a single byte, they\\n // could forcibly trigger behavior that should only be available to this contract.\\n uint256 length = _length == 1 ? 2 : _length;\\n\\n return Lib_EthUtils.getCode(\\n _getAccountEthAddress(_contract),\\n _offset,\\n length\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODESIZE.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function ovmEXTCODESIZE(\\n address _contract\\n )\\n override\\n public\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n return Lib_EthUtils.getCodeSize(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n /**\\n * @notice Overrides EXTCODEHASH.\\n * @param _contract Address of the contract to query the hash of.\\n * @return _EXTCODEHASH Hash of the requested contract.\\n */\\n function ovmEXTCODEHASH(\\n address _contract\\n )\\n override\\n public\\n returns (\\n bytes32 _EXTCODEHASH\\n )\\n {\\n return Lib_EthUtils.getCodeHash(\\n _getAccountEthAddress(_contract)\\n );\\n }\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n /**\\n * Performs the logic to create a contract and revert under various potential conditions.\\n * @dev This function is implemented as `public` because we need to be able to revert a\\n * contract creation without losing information about exactly *why* the contract reverted.\\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\\n * flag and then revert to reset the flag. We're able to do this by making an external\\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\\n * information before reverting.\\n * @param _address Address of the contract to associate with the one being created.\\n * @param _bytecode Code to be used to create the new contract.\\n */\\n function safeCREATE(\\n address _address,\\n bytes memory _bytecode\\n )\\n override\\n public\\n {\\n // Since this function is public, anyone can attempt to directly call it. We need to make\\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\\n // call this function.\\n if (msg.sender != address(this)) {\\n return;\\n }\\n\\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\\n // some existing contract. On L1, users will prove that no contract exists at the address\\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\\n // value that represents \\\"known to be an empty account.\\\"\\n if (_hasEmptyAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\\n }\\n\\n // Check the creation bytecode against the OVM_SafetyChecker.\\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // We always need to initialize the contract with the default account values.\\n _initPendingAccount(_address);\\n\\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\\n // complexity because we need to ensure that contract creation *never* reverts by itself.\\n // We cover this partially by storing a revert flag and returning (instead of reverting)\\n // when we know that we're inside a contract's creation code.\\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\\n\\n // Contract creation returns the zero address when it fails, which should only be possible\\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\\n // explicitly handle this case here.\\n if (ethAddress == address(0)) {\\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\\n }\\n\\n // Here we pull out the revert flag that would've been set during creation code. Now that\\n // we're out of creation code again, we can just revert normally while passing the flag\\n // through the revert data.\\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\\n _revertWithFlag(messageRecord.revertFlag);\\n }\\n\\n // Again simply checking that the deployed code is safe too. Contracts can generate\\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\\n }\\n\\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\\n // associating the desired address with the newly created contract's code hash and address.\\n _commitPendingAccount(\\n _address,\\n ethAddress,\\n Lib_EthUtils.getCodeHash(ethAddress)\\n );\\n }\\n\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit()\\n external\\n view\\n override\\n returns (\\n uint256 _maxTransactionGasLimit\\n )\\n {\\n return gasMeterConfig.maxTransactionGasLimit;\\n }\\n\\n /********************************************\\n * Public Functions: Deployment Witelisting *\\n ********************************************/\\n\\n /**\\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\\n * @param _deployerAddress Address attempting to deploy a contract.\\n */\\n function _checkDeployerAllowed(\\n address _deployerAddress\\n )\\n internal\\n {\\n // From an OVM semanitcs perspectibe, this will appear the identical to\\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\\n (bool success, bytes memory data) = ovmCALL(\\n gasleft(),\\n 0x4200000000000000000000000000000000000002,\\n abi.encodeWithSignature(\\\"isDeployerAllowed(address)\\\", _deployerAddress)\\n );\\n bool isAllowed = abi.decode(data, (bool));\\n\\n if (!isAllowed || !success) {\\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\\n }\\n }\\n\\n /********************************************\\n * Internal Functions: Contract Interaction *\\n ********************************************/\\n\\n /**\\n * Creates a new contract and associates it with some contract address.\\n * @param _contractAddress Address to associate the created contract with.\\n * @param _bytecode Bytecode to be used to create the contract.\\n * @return _created Final OVM contract address.\\n */\\n function _createContract(\\n address _contractAddress,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n // We always update the nonce of the creating account, even if the creation fails.\\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\\n\\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\\n MessageContext memory nextMessageContext = messageContext;\\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\\n nextMessageContext.ovmADDRESS = _contractAddress;\\n\\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\\n // `safeCREATE` reverts.\\n (bool _success, ) = _handleExternalInteraction(\\n nextMessageContext,\\n gasleft(),\\n address(this),\\n abi.encodeWithSignature(\\n \\\"safeCREATE(address,bytes)\\\",\\n _contractAddress,\\n _bytecode\\n )\\n );\\n\\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\\n // some parent EVM message.\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n\\n // Yellow paper requires that address returned is zero if the contract deployment fails.\\n return _success ? _contractAddress : address(0);\\n }\\n\\n /**\\n * Calls the deployed contract associated with a given address.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _contract OVM address to be called.\\n * @param _calldata Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _callContract(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _contract,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\\n if (\\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\\n ) {\\n return (true, hex'');\\n }\\n\\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\\n address codeContractAddress =\\n uint(_contract) < 100\\n ? _contract\\n : _getAccountEthAddress(_contract);\\n\\n return _handleExternalInteraction(\\n _nextMessageContext,\\n _gasLimit,\\n codeContractAddress,\\n _calldata\\n );\\n }\\n\\n /**\\n * Handles the logic of making an external call and parsing revert information.\\n * @param _nextMessageContext Message context to be used for the call.\\n * @param _gasLimit Amount of gas to be passed into this call.\\n * @param _target Address of the contract to call.\\n * @param _data Data to send along with the call.\\n * @return _success Whether or not the call returned (rather than reverted).\\n * @return _returndata Data returned by the call.\\n */\\n function _handleExternalInteraction(\\n MessageContext memory _nextMessageContext,\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _data\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n // We need to switch over to our next message context for the duration of this call.\\n MessageContext memory prevMessageContext = messageContext;\\n _switchMessageContext(prevMessageContext, _nextMessageContext);\\n\\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\\n // factor.\\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\\n\\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\\n // behavior can be controlled. In particular, we enforce that flags are passed through\\n // revert data as to retrieve execution metadata that would normally be reverted out of\\n // existence.\\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\\n\\n // Switch back to the original message context now that we're out of the call.\\n _switchMessageContext(_nextMessageContext, prevMessageContext);\\n\\n // Assuming there were no reverts, the message record should be accurate here. We'll update\\n // this value in the case of a revert.\\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\\n\\n // Reverts at this point are completely OK, but we need to make a few updates based on the\\n // information passed through the revert.\\n if (success == false) {\\n (\\n RevertFlag flag,\\n uint256 nuisanceGasLeftPostRevert,\\n uint256 ovmGasRefund,\\n bytes memory returndataFromFlag\\n ) = _decodeRevertData(returndata);\\n\\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\\n // halt any further transaction execution that could impact the execution result.\\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\\n _revertWithFlag(flag);\\n }\\n\\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\\n // is to record the gas refund reported by the call (enforced by safety checking).\\n if (\\n flag == RevertFlag.INTENTIONAL_REVERT\\n || flag == RevertFlag.UNSAFE_BYTECODE\\n || flag == RevertFlag.STATIC_VIOLATION\\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\\n ) {\\n transactionRecord.ovmGasRefund = ovmGasRefund;\\n }\\n\\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\\n // flag, *not* the full encoded flag. All other revert types return no data.\\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\\n returndata = returndataFromFlag;\\n } else {\\n returndata = hex'';\\n }\\n\\n // Reverts mean we need to use up whatever \\\"nuisance gas\\\" was used by the call.\\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\\n // to zero. OUT_OF_GAS is a \\\"pseudo\\\" flag given that messages return no data when they\\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\\n // will simply pass up the remaining nuisance gas.\\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\\n }\\n\\n // We need to reset the nuisance gas back to its original value minus the amount used here.\\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\\n\\n return (\\n success,\\n returndata\\n );\\n }\\n\\n\\n /******************************************\\n * Internal Functions: State Manipulation *\\n ******************************************/\\n\\n /**\\n * Checks whether an account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account exists.\\n */\\n function _hasAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasAccount(_address);\\n }\\n\\n /**\\n * Checks whether a known empty account exists within the OVM_StateManager.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the account empty exists.\\n */\\n function _hasEmptyAccount(\\n address _address\\n )\\n internal\\n returns (\\n bool _exists\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.hasEmptyAccount(_address);\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function _setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.setAccountNonce(_address, _nonce);\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function _getAccountNonce(\\n address _address\\n )\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountNonce(_address);\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function _getAccountEthAddress(\\n address _address\\n )\\n internal\\n returns (\\n address _ethAddress\\n )\\n {\\n _checkAccountLoad(_address);\\n return ovmStateManager.getAccountEthAddress(_address);\\n }\\n\\n /**\\n * Creates the default account object for the given address.\\n * @param _address Address of the account create.\\n */\\n function _initPendingAccount(\\n address _address\\n )\\n internal\\n {\\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\\n // actually consider an account \\\"changed\\\" until it's inserted into the state (in this case\\n // by `_commitPendingAccount`).\\n _checkAccountLoad(_address);\\n ovmStateManager.initPendingAccount(_address);\\n }\\n\\n /**\\n * Stores additional relevant data for a new account, thereby \\\"committing\\\" it to the state.\\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\\n * creation.\\n * @param _address Address of the account to commit.\\n * @param _ethAddress Address of the associated deployed contract.\\n * @param _codeHash Hash of the code stored at the address.\\n */\\n function _commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n internal\\n {\\n _checkAccountChange(_address);\\n ovmStateManager.commitPendingAccount(\\n _address,\\n _ethAddress,\\n _codeHash\\n );\\n }\\n\\n /**\\n * Retrieves the value of a storage slot.\\n * @param _contract Address of the contract to query.\\n * @param _key 32 byte key of the storage slot.\\n * @return _value 32 byte storage slot value.\\n */\\n function _getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32 _value\\n )\\n {\\n _checkContractStorageLoad(_contract, _key);\\n return ovmStateManager.getContractStorage(_contract, _key);\\n }\\n\\n /**\\n * Sets the value of a storage slot.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte key of the storage slot.\\n * @param _value 32 byte storage slot value.\\n */\\n function _putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n // We don't set storage if the value didn't change. Although this acts as a convenient\\n // optimization, it's also necessary to avoid the case in which a contract with no storage\\n // attempts to store the value \\\"0\\\" at any key. Putting this value (and therefore requiring\\n // that the value be committed into the storage trie after execution) would incorrectly\\n // modify the storage root.\\n if (_getContractStorage(_contract, _key) == _value) {\\n return;\\n }\\n\\n _checkContractStorageChange(_contract, _key);\\n ovmStateManager.putContractStorage(_contract, _key, _value);\\n }\\n\\n /**\\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been loaded before.\\n * @param _address Address of the account to load.\\n */\\n function _checkAccountLoad(\\n address _address\\n )\\n internal\\n {\\n // See `_checkContractStorageLoad` for more information.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // See `_checkContractStorageLoad` for more information.\\n if (ovmStateManager.hasAccount(_address) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the account has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is loaded.\\n (\\n bool _wasAccountAlreadyLoaded\\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyLoaded == false) {\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the account hasn't been changed before.\\n * @param _address Address of the account to change.\\n */\\n function _checkAccountChange(\\n address _address\\n )\\n internal\\n {\\n // Start by checking for a load as we only want to charge nuisance gas proportional to\\n // contract size once.\\n _checkAccountLoad(_address);\\n\\n // Check whether the account has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that an account is changed.\\n (\\n bool _wasAccountAlreadyChanged\\n ) = ovmStateManager.testAndSetAccountChanged(_address);\\n\\n // If we hadn't already loaded the account, then we'll need to charge \\\"nuisance gas\\\" based\\n // on the size of the contract code.\\n if (_wasAccountAlreadyChanged == false) {\\n ovmStateManager.incrementTotalUncommittedAccounts();\\n _useNuisanceGas(\\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\\n );\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been loaded before.\\n * @param _contract Address of the account to load from.\\n * @param _key 32 byte key to load.\\n */\\n function _checkContractStorageLoad(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\\n // on L1 but not on L2. A contract could use this behavior to prevent the\\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\\n // allows us to also charge for the full message nuisance gas, because you deserve that for\\n // trying to break the contract in this way.\\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\\n }\\n\\n // We need to make sure that the transaction isn't trying to access storage that hasn't\\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\\n // We know that we have enough gas to do this check because of the above test.\\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\\n }\\n\\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is loaded.\\n (\\n bool _wasContractStorageAlreadyLoaded\\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\\n\\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyLoaded == false) {\\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\\n }\\n }\\n\\n /**\\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\\n * nuisance gas if the slot hasn't been changed before.\\n * @param _contract Address of the account to change.\\n * @param _key 32 byte key to change.\\n */\\n function _checkContractStorageChange(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n {\\n // Start by checking for load to make sure we have the storage slot and that we charge the\\n // \\\"nuisance gas\\\" necessary to prove the storage slot state.\\n _checkContractStorageLoad(_contract, _key);\\n\\n // Check whether the slot has been changed before and mark it as changed if not. We need\\n // this because \\\"nuisance gas\\\" only applies to the first time that a slot is changed.\\n (\\n bool _wasContractStorageAlreadyChanged\\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\\n\\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\\n // \\\"nuisance gas\\\".\\n if (_wasContractStorageAlreadyChanged == false) {\\n // Changing a storage slot means that we're also going to have to change the\\n // corresponding account, so do an account change check.\\n _checkAccountChange(_contract);\\n\\n ovmStateManager.incrementTotalUncommittedContractStorage();\\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\\n }\\n }\\n\\n\\n /************************************\\n * Internal Functions: Revert Logic *\\n ************************************/\\n\\n /**\\n * Simple encoding for revert data.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided revert data.\\n * @return _revertdata Encoded revert data.\\n */\\n function _encodeRevertData(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n view\\n returns (\\n bytes memory _revertdata\\n )\\n {\\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\\n if (\\n _flag == RevertFlag.OUT_OF_GAS\\n || _flag == RevertFlag.CREATE_EXCEPTION\\n ) {\\n return bytes('');\\n }\\n\\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\\n return abi.encode(\\n _flag,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // Just ABI encode the rest of the parameters.\\n return abi.encode(\\n _flag,\\n messageRecord.nuisanceGasLeft,\\n transactionRecord.ovmGasRefund,\\n _data\\n );\\n }\\n\\n /**\\n * Simple decoding for revert data.\\n * @param _revertdata Revert data to decode.\\n * @return _flag Flag used to revert.\\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\\n * @return _ovmGasRefund Amount of gas refunded during the message.\\n * @return _data Additional user-provided revert data.\\n */\\n function _decodeRevertData(\\n bytes memory _revertdata\\n )\\n internal\\n pure\\n returns (\\n RevertFlag _flag,\\n uint256 _nuisanceGasLeft,\\n uint256 _ovmGasRefund,\\n bytes memory _data\\n )\\n {\\n // A length of zero means the call ran out of gas, just return empty data.\\n if (_revertdata.length == 0) {\\n return (\\n RevertFlag.OUT_OF_GAS,\\n 0,\\n 0,\\n bytes('')\\n );\\n }\\n\\n // ABI decode the incoming data.\\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n * @param _data Additional user-provided data.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag,\\n bytes memory _data\\n )\\n internal\\n {\\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\\n // thinking there was a failure.\\n bool isCreation;\\n assembly {\\n isCreation := eq(extcodesize(caller()), 0)\\n }\\n\\n if (isCreation) {\\n messageRecord.revertFlag = _flag;\\n\\n assembly {\\n return(0, 1)\\n }\\n }\\n\\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\\n // revert normally.\\n bytes memory revertdata = _encodeRevertData(\\n _flag,\\n _data\\n );\\n\\n assembly {\\n revert(add(revertdata, 0x20), mload(revertdata))\\n }\\n }\\n\\n /**\\n * Causes a message to revert or abort.\\n * @param _flag Flag to revert with.\\n */\\n function _revertWithFlag(\\n RevertFlag _flag\\n )\\n internal\\n {\\n _revertWithFlag(_flag, bytes(''));\\n }\\n\\n\\n /******************************************\\n * Internal Functions: Nuisance Gas Logic *\\n ******************************************/\\n\\n /**\\n * Computes the nuisance gas limit from the gas limit.\\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\\n * this implementation is perfectly fine, but we may change this formula later.\\n * @param _gasLimit Gas limit to compute from.\\n * @return _nuisanceGasLimit Computed nuisance gas limit.\\n */\\n function _getNuisanceGasLimit(\\n uint256 _gasLimit\\n )\\n internal\\n view\\n returns (\\n uint256 _nuisanceGasLimit\\n )\\n {\\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\\n }\\n\\n /**\\n * Uses a certain amount of nuisance gas.\\n * @param _amount Amount of nuisance gas to use.\\n */\\n function _useNuisanceGas(\\n uint256 _amount\\n )\\n internal\\n {\\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\\n // refund to be given at the end of the transaction.\\n if (messageRecord.nuisanceGasLeft < _amount) {\\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\\n }\\n\\n messageRecord.nuisanceGasLeft -= _amount;\\n }\\n\\n\\n /************************************\\n * Internal Functions: Gas Metering *\\n ************************************/\\n\\n /**\\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\\n * @param _timestamp Transaction timestamp.\\n */\\n function _checkNeedsNewEpoch(\\n uint256 _timestamp\\n )\\n internal\\n {\\n if (\\n _timestamp >= (\\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\\n + gasMeterConfig.secondsPerEpoch\\n )\\n ) {\\n _putGasMetadata(\\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\\n _timestamp\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\\n )\\n );\\n\\n _putGasMetadata(\\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\\n _getGasMetadata(\\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\\n )\\n );\\n }\\n }\\n\\n /**\\n * Validates the gas limit for a given transaction.\\n * @param _gasLimit Gas limit provided by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n * @return _valid Whether or not the gas limit is valid.\\n */\\n function _isValidGasLimit(\\n uint256 _gasLimit,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n returns (\\n bool _valid\\n )\\n {\\n // Always have to be below the maximum gas limit.\\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\\n return false;\\n }\\n\\n // Always have to be above the minimum gas limit.\\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\\n return false;\\n }\\n\\n // TEMPORARY: Gas metering is disabled for minnet.\\n return true;\\n // GasMetadataKey cumulativeGasKey;\\n // GasMetadataKey prevEpochGasKey;\\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\\n // } else {\\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\\n // }\\n\\n // return (\\n // (\\n // _getGasMetadata(cumulativeGasKey)\\n // - _getGasMetadata(prevEpochGasKey)\\n // + _gasLimit\\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\\n // );\\n }\\n\\n /**\\n * Updates the cumulative gas after a transaction.\\n * @param _gasUsed Gas used by the transaction.\\n * @param _queueOrigin Queue from which the transaction originated.\\n */\\n function _updateCumulativeGas(\\n uint256 _gasUsed,\\n Lib_OVMCodec.QueueOrigin _queueOrigin\\n )\\n internal\\n {\\n GasMetadataKey cumulativeGasKey;\\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\\n } else {\\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\\n }\\n\\n _putGasMetadata(\\n cumulativeGasKey,\\n (\\n _getGasMetadata(cumulativeGasKey)\\n + gasMeterConfig.minTransactionGasLimit\\n + _gasUsed\\n - transactionRecord.ovmGasRefund\\n )\\n );\\n }\\n\\n /**\\n * Retrieves the value of a gas metadata key.\\n * @param _key Gas metadata key to retrieve.\\n * @return _value Value stored at the given key.\\n */\\n function _getGasMetadata(\\n GasMetadataKey _key\\n )\\n internal\\n returns (\\n uint256 _value\\n )\\n {\\n return uint256(_getContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key))\\n ));\\n }\\n\\n /**\\n * Sets the value of a gas metadata key.\\n * @param _key Gas metadata key to set.\\n * @param _value Value to store at the given key.\\n */\\n function _putGasMetadata(\\n GasMetadataKey _key,\\n uint256 _value\\n )\\n internal\\n {\\n _putContractStorage(\\n GAS_METADATA_ADDRESS,\\n bytes32(uint256(_key)),\\n bytes32(uint256(_value))\\n );\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Execution Context *\\n *****************************************/\\n\\n /**\\n * Swaps over to a new message context.\\n * @param _prevMessageContext Context we're switching from.\\n * @param _nextMessageContext Context we're switching to.\\n */\\n function _switchMessageContext(\\n MessageContext memory _prevMessageContext,\\n MessageContext memory _nextMessageContext\\n )\\n internal\\n {\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\\n }\\n\\n // Avoid unnecessary the SSTORE.\\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\\n messageContext.isStatic = _nextMessageContext.isStatic;\\n }\\n }\\n\\n /**\\n * Initializes the execution context.\\n * @param _transaction OVM transaction being executed.\\n */\\n function _initContext(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n internal\\n {\\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\\n transactionContext.ovmNUMBER = _transaction.blockNumber;\\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\\n\\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\\n }\\n\\n /**\\n * Resets the transaction and message context.\\n */\\n function _resetContext()\\n internal\\n {\\n transactionContext.ovmL1TXORIGIN = address(0);\\n transactionContext.ovmTIMESTAMP = 0;\\n transactionContext.ovmNUMBER = 0;\\n transactionContext.ovmGASLIMIT = 0;\\n transactionContext.ovmTXGASLIMIT = 0;\\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\\n\\n transactionRecord.ovmGasRefund = 0;\\n\\n messageContext.ovmCALLER = address(0);\\n messageContext.ovmADDRESS = address(0);\\n messageContext.isStatic = false;\\n\\n messageRecord.nuisanceGasLeft = 0;\\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\\n }\\n\\n /*****************************\\n * L2-only Helper Functions *\\n *****************************/\\n\\n /**\\n * Unreachable helper function for simulating eth_calls with an OVM message context.\\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\\n * @param _transaction the message transaction to simulate.\\n * @param _from the OVM account the simulated call should be from.\\n */\\n function simulateMessage(\\n Lib_OVMCodec.Transaction memory _transaction,\\n address _from,\\n iOVM_StateManager _ovmStateManager\\n )\\n external\\n returns (\\n bool,\\n bytes memory\\n )\\n {\\n // Prevent this call from having any effect unless in a custom-set VM frame\\n require(msg.sender == address(0));\\n\\n ovmStateManager = _ovmStateManager;\\n _initContext(_transaction);\\n\\n messageRecord.nuisanceGasLeft = uint(-1);\\n messageContext.ovmADDRESS = _transaction.entrypoint;\\n messageContext.ovmCALLER = _from;\\n\\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\\n }\\n}\\n\",\"keccak256\":\"0x5432ac3e92c78d3bc9faf52e4081cd95b4b6d7858ce14636822f1b2c41cfcc43\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_DeployerWhitelist } from \\\"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title OVM_DeployerWhitelist\\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \\n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n \\n /**\\n * Blocks functions to anyone except the contract owner.\\n */\\n modifier onlyOwner() {\\n address owner = Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\\n \\\"Function can only be called by the owner of this contract.\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n \\n /**\\n * Initializes the whitelist.\\n * @param _owner Address of the owner for this contract.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function initialize(\\n address _owner,\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == true) {\\n return;\\n }\\n\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_INITIALIZED,\\n Lib_Bytes32Utils.fromBool(true)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Gets the owner of the whitelist.\\n */\\n function getOwner()\\n override\\n public\\n returns(\\n address\\n )\\n {\\n return Lib_Bytes32Utils.toAddress(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n KEY_OWNER\\n )\\n );\\n }\\n\\n /**\\n * Adds or removes an address from the deployment whitelist.\\n * @param _deployer Address to update permissions for.\\n * @param _isWhitelisted Whether or not the address is whitelisted.\\n */\\n function setWhitelistedDeployer(\\n address _deployer,\\n bool _isWhitelisted\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n Lib_Bytes32Utils.fromAddress(_deployer),\\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\\n );\\n }\\n\\n /**\\n * Updates the owner of this contract.\\n * @param _owner Address of the new owner.\\n */\\n function setOwner(\\n address _owner\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_OWNER,\\n Lib_Bytes32Utils.fromAddress(_owner)\\n );\\n }\\n\\n /**\\n * Updates the arbitrary deployment flag.\\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\\n */\\n function setAllowArbitraryDeployment(\\n bool _allowArbitraryDeployment\\n )\\n override\\n public\\n onlyOwner\\n {\\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\\n );\\n }\\n\\n /**\\n * Permanently enables arbitrary contract deployment and deletes the owner.\\n */\\n function enableArbitraryContractDeployment()\\n override\\n public\\n onlyOwner\\n {\\n setAllowArbitraryDeployment(true);\\n setOwner(address(0));\\n }\\n\\n /**\\n * Checks whether an address is allowed to deploy contracts.\\n * @param _deployer Address to check.\\n * @return _allowed Whether or not the address can deploy contracts.\\n */\\n function isDeployerAllowed(\\n address _deployer\\n )\\n override\\n public\\n returns (\\n bool _allowed\\n )\\n {\\n bool initialized = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\\n );\\n\\n if (initialized == false) {\\n return true;\\n }\\n\\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\\n );\\n\\n if (allowArbitraryDeployment == true) {\\n return true;\\n }\\n\\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\\n Lib_Bytes32Utils.fromAddress(_deployer)\\n )\\n );\\n\\n return isWhitelisted; \\n }\\n}\\n\",\"keccak256\":\"0x8737cfb9c47bf262eb16b80ca9111e0b347b1fe06c517569907056b8e2f28aaf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_ECDSAContractAccount\\n */\\ninterface iOVM_ECDSAContractAccount {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function execute(\\n bytes memory _transaction,\\n Lib_OVMCodec.EOASignatureType _signatureType,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external returns (bool _success, bytes memory _returndata);\\n}\\n\",\"keccak256\":\"0x308729bc62dcffb11ff1d840781105cf1bf0dd4cbcfb1af704b800bb0cfe9b85\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_DeployerWhitelist\\n */\\ninterface iOVM_DeployerWhitelist {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\\n function getOwner() external returns (address _owner);\\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\\n function setOwner(address _newOwner) external;\\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\\n function enableArbitraryContractDeployment() external;\\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\\n}\\n\",\"keccak256\":\"0x969394371cacfc36493230150b6d629173ea72dfdf729330bede475b91d0f004\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_ECDSAUtils\\n */\\nlibrary Lib_ECDSAUtils {\\n\\n /**************************************\\n * Internal Functions: ECDSA Recovery *\\n **************************************/\\n\\n /**\\n * Recovers a signed address given a message and signature.\\n * @param _message Message that was originally signed.\\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\\n * @param _v Signature `v` parameter.\\n * @param _r Signature `r` parameter.\\n * @param _s Signature `s` parameter.\\n * @return _sender Signer address.\\n */\\n function recover(\\n bytes memory _message,\\n bool _isEthSignedMessage,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n pure\\n returns (\\n address _sender\\n )\\n {\\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\\n\\n return ecrecover(\\n messageHash,\\n _v + 27,\\n _r,\\n _s\\n );\\n }\\n\\n function getMessageHash(\\n bytes memory _message,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (bytes32) {\\n if (_isEthSignedMessage) {\\n return getEthSignedMessageHash(_message);\\n }\\n return getNativeMessageHash(_message);\\n }\\n\\n\\n /*************************************\\n * Private Functions: ECDSA Recovery *\\n *************************************/\\n\\n /**\\n * Gets the native message hash (simple keccak256) for a message.\\n * @param _message Message to hash.\\n * @return _messageHash Native message hash.\\n */\\n function getNativeMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n return keccak256(_message);\\n }\\n\\n /**\\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\\n * @param _message Message to hash.\\n * @return _messageHash Prefixed message hash.\\n */\\n function getEthSignedMessageHash(\\n bytes memory _message\\n )\\n private\\n pure\\n returns (\\n bytes32 _messageHash\\n )\\n {\\n bytes memory prefix = \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\";\\n bytes32 messageHash = keccak256(_message);\\n return keccak256(abi.encodePacked(prefix, messageHash));\\n }\\n}\",\"keccak256\":\"0xda865d8cc014940a4755e329db9c6272a31bd9a340000a4ecc005d46299a585c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\\n// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"./Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_SafeMathWrapper\\n */\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\n\\nlibrary Lib_SafeMathWrapper {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal returns (uint256) {\\n uint256 c = a + b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \\\"Lib_SafeMathWrapper: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal returns (uint256) {\\n return sub(a, b, \\\"Lib_SafeMathWrapper: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \\\"Lib_SafeMathWrapper: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal returns (uint256) {\\n return div(a, b, \\\"Lib_SafeMathWrapper: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal returns (uint256) {\\n return mod(a, b, \\\"Lib_SafeMathWrapper: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0xc58aa064894677f65fc8205f79252d15e59a0f5e2794e5c2d069c7b2bc97a9e2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b50604051620039ae380380620039ae8339810160408190526200003491620001e9565b600080546001600160a01b0319166001600160a01b03851617905560408051808201909152601181527027ab26afa9b0b332ba3ca1b432b1b5b2b960791b60208201526200008290620000cb565b600180546001600160a01b0319166001600160a01b039290921691909117905581516003556020820151600455604082015160055560609091015160065551600755506200028e565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200012d57818101518382015260200162000113565b50505050905090810190601f1680156200015b5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200017957600080fd5b505afa1580156200018e573d6000803e3d6000fd5b505050506040513d6020811015620001a557600080fd5b505192915050565b600060208284031215620001bf578081fd5b604051602081016001600160401b0381118282101715620001dc57fe5b6040529151825250919050565b600080600083850360c0811215620001ff578384fd5b84516001600160a01b038116811462000216578485fd5b93506080601f19820112156200022a578283fd5b50604051608081016001600160401b03811182821017156200024857fe5b80604052506020850151815260408501516020820152606085015160408201526080850151606082015280925050620002858560a08601620001ad565b90509250925092565b613710806200029e6000396000f3fe60806040523480156200001157600080fd5b5060043610620001d25760003560e01c8063741a33eb1162000111578063996d79a511620000a55780639dc9dc93116200007b5780639dc9dc9314620003e4578063bdbf8c3614620003ee578063c1fb2ea214620003f8578063ffe73914146200040257620001d2565b8063996d79a514620003ac57806399ccd98b14620003b65780639be3ad6714620003cd57620001d2565b80638540661f11620000e75780638540661f146200034d57806385979f7614620003745780638bb42e15146200038b5780639058025614620003a257620001d2565b8063741a33eb14620002f9578063746c32f114620003105780638435035b146200033657620001d2565b806322bd64c01162000189578063461a4478116200015f578063461a447814620002b75780634d78009214620002ce5780635a98c36114620002e55780637350906414620002ef57620001d2565b806322bd64c0146200027257806324749d5c14620002895780632a2a7adb14620002a057620001d2565b806303daa95914620001d75780630da449d11462000206578063101185a4146200021f57806314aa2ff714620002385780631c4712a7146200025e57806320160f3a1462000268575b600080fd5b620001ee620001e8366004620027ac565b62000419565b604051620001fd919062002b83565b60405180910390f35b6200021d62000217366004620027ac565b62000463565b005b62000229620004a0565b604051620001fd919062002c74565b6200024f6200024936600462002843565b620004a9565b604051620001fd919062002b8c565b620001ee6200054a565b620001ee62000550565b6200021d62000283366004620027de565b62000556565b620001ee6200029a366004620026c2565b620005c1565b6200021d620002b136600462002843565b620005e0565b6200024f620002c83660046200296e565b620005ed565b6200021d620002df36600462002700565b620006cf565b620001ee620008b3565b6200024f620008b9565b6200021d6200030a36600462002800565b620008c8565b620003276200032136600462002753565b62000a52565b604051620001fd919062002c5f565b620001ee62000347366004620026c2565b62000a8b565b620003646200035e36600462002a76565b62000aa2565b604051620001fd92919062002c24565b620003646200038536600462002a76565b62000b1f565b620003646200039c36600462002a0d565b62000b70565b620001ee62000c4e565b6200024f62000c54565b6200024f620003c736600462002881565b62000c63565b6200021d620003de366004620029b8565b62000cfd565b6200024f62000e5b565b620001ee62000e6a565b620001ee62000e70565b620003646200041336600462002a76565b62000e8b565b6000619c4060005a905060006200042f62000c54565b90506200043d818662000f04565b93505060005a82039050808310156200045b57601080548483030190555b505050919050565b600f5460ff600160a01b90910416151560011415620004885762000488600762000fa3565b6200049d6200049662000c54565b8262000fbe565b50565b60085460ff1690565b600f5460009060ff600160a01b90910416151560011415620004d157620004d1600762000fa3565b619c4060005a90506000620004e562000c54565b9050620004f28162001035565b60006200050a826200050484620010c4565b62001157565b9050620005188187620011f3565b9450505060005a82039050808310156200053a5760108054840190556200045b565b6010805482019055505050919050565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156200057b576200057b600762000fa3565b61ea6060005a905060006200058f62000c54565b90506200059e818686620012c1565b5060005a8203905080831015620005ba57601080548483030190555b5050505050565b6000620005d8620005d28362001352565b620013e5565b90505b919050565b6200049d600282620013e9565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200064f57818101518382015260200162000635565b50505050905090810190601f1680156200067d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200069b57600080fd5b505afa158015620006b0573d6000803e3d6000fd5b505050506040513d6020811015620006c757600080fd5b505192915050565b333014620006dd57620008af565b620006e88262001430565b620006f957620006f9600662000fa3565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a906200072b90849060040162002c5f565b60206040518083038186803b1580156200074457600080fd5b505afa15801562000759573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077f91906200278a565b620007905762000790600562000fa3565b6200079b82620014c3565b6000620007a88262001530565b90506001600160a01b038116620007c557620007c5600862000fa3565b600060125460ff166009811115620007d957fe5b14620007f057601254620007f09060ff1662000fa3565b6000620007fd8262001541565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a906200083090849060040162002c5f565b60206040518083038186803b1580156200084957600080fd5b505afa1580156200085e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200088491906200278a565b620008955762000895600562000fa3565b620008ac8483620008a685620013e5565b6200155b565b50505b5050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415620008ed57620008ed600762000fa3565b600060018585601b0185856040516000815260200160405260405162000917949392919062002c41565b6020604051602081039080840390855afa1580156200093a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166200097a576200097a604051806060016040528060388152602001620036a360389139620005e0565b620009858162001430565b620009915750620008ac565b6200099c81620014c3565b600f80546001600160a01b038381166001600160a01b03198316179092556040519116906000906003602160991b0190620009d7906200258d565b620009e3919062002b8c565b604051809103906000f08015801562000a00573d6000803e3d6000fd5b50600f80546001600160a01b0319166001600160a01b038516179055905062000a3c838262000a2f8162001541565b805190602001206200155b565b62000a4983600062000fbe565b50505050505050565b606060008260011462000a66578262000a69565b60025b905062000a8262000a7a8662001352565b85836200159c565b95945050505050565b6000620005d862000a9c8362001352565b620015be565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915062000ae881898989620015c2565b945094505060005a820390508083101562000b0b57601080548401905562000b14565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915062000ae881898989620015c2565b60006060331562000b8057600080fd5b600280546001600160a01b0319166001600160a01b03851617905562000ba68562001659565b6000196011556080850151600f80546001600160a01b039283166001600160a01b03199182168117909255600e8054938816939091169290921790915560a086015160c087015160405162000bfc919062002b65565b60006040518083038160008787f1925050503d806000811462000c3c576040519150601f19603f3d011682016040523d82523d6000602084013e62000c41565b606091505b5091509150935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060ff600160a01b9091041615156001141562000c8b5762000c8b600762000fa3565b619c4060005a9050600062000c9f62000c54565b905062000cac8162001035565b600062000cbb828888620016ce565b905062000cc98188620011f3565b9450505060005a820390508083101562000ceb57601080548401905562000cf4565b60108054820190555b50505092915050565b600a541562000d295760405162461bcd60e51b815260040162000d209062002d65565b60405180910390fd5b600280546001600160a01b0319166001600160a01b038381169190911791829055604051630d15d41560e41b815291169063d15d41509062000d7090339060040162002b8c565b60206040518083038186803b15801562000d8957600080fd5b505afa15801562000d9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000dc491906200278a565b62000de35760405162461bcd60e51b815260040162000d209062002cf9565b62000dee8262001659565b62000e028260a00151836040015162001718565b62000e0d57620008af565b60005a905062000e326003600001548460a001510384608001518560c0015162000b1f565b505060005a8203905062000e456200174c565b5050600280546001600160a01b03191690555050565b600d546001600160a01b031690565b60095490565b600062000e8662000e8062000c54565b620010c4565b905090565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff16151591810191909152909150600062000ee0828a8a8a620015c2565b95509550505060005a820390508083101562000b0b57601080548401905562000b14565b600062000f128383620017af565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f9062000f46908690869060040162002bc4565b60206040518083038186803b15801562000f5f57600080fd5b505afa15801562000f74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9a9190620027c5565b90505b92915050565b6200049d8160405180602001604052806000815250620013e9565b62000fc982620018ff565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb869062000ffd908590859060040162002bc4565b600060405180830381600087803b1580156200101857600080fd5b505af11580156200102d573d6000803e3d6000fd5b505050505050565b600080620010885a6002602160991b018560405160240162001058919062002b8c565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905262000b1f565b91509150600081806020019051810190620010a491906200278a565b9050801580620010b2575082155b15620008ac57620008ac600962000fa3565b6000620010d18262001a25565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f906200110390859060040162002b8c565b60206040518083038186803b1580156200111c57600080fd5b505afa15801562001131573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620027c5565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908162001172579050509050620011958462001b7c565b81600081518110620011a357fe5b6020026020010181905250620011b98362001baa565b81600181518110620011c757fe5b60200260200101819052506000620011df8262001bc1565b905062000a82818051906020012062001bf2565b60006200121a6200120362000c54565b6200121162000e8062000c54565b60010162000fbe565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908416602082015260006200129d825a3088886040516024016200126d92919062002bfe565b60408051601f198184030181529190526020810180516001600160e01b03166326bc004960e11b17905262001bf5565b506012805460ff19169055905080620012b857600062000a82565b50929392505050565b80620012ce848462000f04565b1415620012db576200134d565b620012e7838362001dc7565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906200131d9086908690869060040162002bdd565b600060405180830381600087803b1580156200133857600080fd5b505af115801562000a49573d6000803e3d6000fd5b505050565b60006200135f8262001a25565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906200139190859060040162002b8c565b60206040518083038186803b158015620013aa57600080fd5b505afa158015620013bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620026e1565b3f90565b333b15801562001418576012805484919060ff191660018360098111156200140d57fe5b021790555060016000f35b600062001426848462001ee8565b9050805160208201fd5b60006200143d8262001a25565b6002546040516307a1294560e01b81526001600160a01b03909116906307a12945906200146f90859060040162002b8c565b60206040518083038186803b1580156200148857600080fd5b505afa1580156200149d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d891906200278a565b620014ce8162001a25565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906200150090849060040162002b8c565b600060405180830381600087803b1580156200151b57600080fd5b505af1158015620005ba573d6000803e3d6000fd5b60008151602083016000f092915050565b6060620005d88260006200155585620015be565b6200159c565b6200156683620018ff565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906200131d9086908690869060040162002ba0565b60606040519050602082018101604052818152818360208301863c9392505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156200161357505060408051602081019091526000815260019062001650565b60006064856001600160a01b0316106200163857620016328562001352565b6200163a565b845b90506200164a8787838762001bf5565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156200168957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a0810151620016c89062001fb3565b60115550565b60008060ff60f81b85848680519060200120604051602001620016f5949392919062002b2c565b60405160208183030381529060405280519060200120905062000a828162001bf2565b6004546000908311156200172f5750600062000f9d565b600354831015620017435750600062000f9d565b50600192915050565b600d80546001600160a01b031990811690915560006009819055600a819055600b819055600c8190556008805460ff199081169091556010829055600e8054909316909255600f80546001600160a81b0319169055601155601280549091169055565b6175305a1015620017c657620017c6600162000fa3565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad2267990620017fa908590859060040162002bc4565b60206040518083038186803b1580156200181357600080fd5b505afa15801562001828573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200184e91906200278a565b6200185f576200185f600462000fa3565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649062001894908690869060040162002bc4565b602060405180830381600087803b158015620018af57600080fd5b505af1158015620018c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018ea91906200278a565b9050806200134d576200134d614e2062001fc8565b6200190a8162001a25565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f790906200193d90859060040162002b8c565b602060405180830381600087803b1580156200195857600080fd5b505af11580156200196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200199391906200278a565b905080620008af57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620019ec57600080fd5b505af115801562001a01573d6000803e3d6000fd5b50505050620008af617530606462001a1d62000a9c8662001352565b020162001fc8565b6175305a101562001a3c5762001a3c600162000fa3565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf9062001a6e90849060040162002b8c565b60206040518083038186803b15801562001a8757600080fd5b505afa15801562001a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac291906200278a565b62001ad35762001ad3600462000fa3565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c9062001b0690859060040162002b8c565b602060405180830381600087803b15801562001b2157600080fd5b505af115801562001b36573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b5c91906200278a565b905080620008af57620008af617530606462001a1d62000a9c8662001352565b6060620005d88260405160200162001b95919062002b0f565b60405160208183030381529060405262001feb565b6060620005d862001bbb836200203c565b62001feb565b6060600062001bd0836200214d565b905062001beb62001be4825160c06200225a565b82620023b7565b9392505050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff161515928201929092526000919062001c3e818862002438565b601154600062001c4e8862001fb3565b905080601160000181905550600080886001600160a01b03168a8960405162001c78919062002b65565b60006040518083038160008787f1925050503d806000811462001cb8576040519150601f19603f3d011682016040523d82523d6000602084013e62001cbd565b606091505b509150915062001cce8b8662002438565b6011548262001db05760008060008062001ce886620024ef565b92965090945092509050600484600981111562001d0157fe5b141562001d135762001d138462000fa3565b600284600981111562001d2257fe5b148062001d3b5750600584600981111562001d3957fe5b145b8062001d535750600784600981111562001d5157fe5b145b8062001d6b5750600984600981111562001d6957fe5b145b1562001d775760108290555b600284600981111562001d8657fe5b141562001d965780955062001da9565b6040518060200160405280600081525095505b5090925050505b909203909203601155909890975095505050505050565b62001dd38282620017af565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc0119062001e08908690869060040162002bc4565b602060405180830381600087803b15801562001e2357600080fd5b505af115801562001e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001e5e91906200278a565b9050806200134d5762001e7183620018ff565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b15801562001ec257600080fd5b505af115801562001ed7573d6000803e3d6000fd5b505050506200134d614e2062001fc8565b6060600183600981111562001ef957fe5b148062001f125750600883600981111562001f1057fe5b145b1562001f2e575060408051602081019091526000815262000f9d565b600483600981111562001f3d57fe5b141562001f7f5760408051602080820183526000808352925162001f68938793909283920162002c89565b604051602081830303815290604052905062000f9d565b60115460105460405162001f9c9286929091869060200162002cc9565b604051602081830303815290604052905092915050565b60005a821062001fc4575a620005d8565b5090565b60115481111562001fdf5762001fdf600362000fa3565b60118054919091039055565b606080825160011480156200201557506080836000815181106200200b57fe5b016020015160f81c105b1562002023575081620005d8565b62000f9a62002035845160806200225a565b84620023b7565b606060008260405160200162002053919062002b83565b604051602081830303815290604052905060005b6020811015620020a2578181815181106200207e57fe5b01602001516001600160f81b031916156200209957620020a2565b60010162002067565b6000816020036001600160401b0381118015620020be57600080fd5b506040519080825280601f01601f191660200182016040528015620020ea576020820181803683370190505b50905060005b8151811015620021445783516001840193859181106200210c57fe5b602001015160f81c60f81b8282815181106200212457fe5b60200101906001600160f81b031916908160001a905350600101620020f0565b50949350505050565b6060815160001415620021705750604080516000815260208101909152620005db565b6000805b8351811015620021a6578381815181106200218b57fe5b60200260200101515182019150808060010191505062002174565b6000826001600160401b0381118015620021bf57600080fd5b506040519080825280601f01601f191660200182016040528015620021eb576020820181803683370190505b50600092509050602081015b8551831015620021445760008684815181106200221057fe5b602002602001015190506000602082019050620022308382845162002547565b8785815181106200223d57fe5b6020026020010151518301925050508280600101935050620021f7565b6060806038841015620022b7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106200229a57fe5b60200101906001600160f81b031916908160001a90535062000f9a565b600060015b808681620022c657fe5b0415620022dd5760019091019061010002620022bc565b816001016001600160401b0381118015620022f757600080fd5b506040519080825280601f01601f19166020018201604052801562002323576020820181803683370190505b50925084820160370160f81b836000815181106200233d57fe5b60200101906001600160f81b031916908160001a905350600190505b818111620023ae576101008183036101000a87816200237457fe5b04816200237d57fe5b0660f81b8382815181106200238e57fe5b60200101906001600160f81b031916908160001a90535060010162002359565b50509392505050565b6060806040519050835180825260208201818101602087015b81831015620023ea578051835260209283019201620023d0565b50855184518101855292509050808201602086015b8183101562002419578051835260209283019201620023ff565b508651929092011591909101601f01601f191660405250905092915050565b805182516001600160a01b0390811691161462002471578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614620024b8576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b806040015115158260400151151514620008af5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156200252157505060408051602081019091526000808252600193509150819062002540565b84806020019051810190620025379190620028c7565b93509350935093505b9193509193565b8282825b602081106200256c578151835260209283019290910190601f19016200254b565b905182516020929092036101000a6000190180199091169116179052505050565b6108648062002e3f83390190565b6000620025b2620025ac8462002dd7565b62002db3565b9050828152838383011115620025c757600080fd5b828260208301376000602084830101529392505050565b8035620005db8162002e28565b600082601f830112620025fc578081fd5b62000f9a838335602085016200259b565b803560028110620005db57600080fd5b600060e082840312156200262f578081fd5b6200263b60e062002db3565b9050813581526020820135602082015262002659604083016200260d565b60408201526200266c60608301620025de565b60608201526200267f60808301620025de565b608082015260a082013560a082015260c08201356001600160401b03811115620026a857600080fd5b620026b684828501620025eb565b60c08301525092915050565b600060208284031215620026d4578081fd5b813562000f9a8162002e28565b600060208284031215620026f3578081fd5b815162000f9a8162002e28565b6000806040838503121562002713578081fd5b8235620027208162002e28565b915060208301356001600160401b038111156200273b578182fd5b6200274985828601620025eb565b9150509250929050565b60008060006060848603121562002768578081fd5b8335620027758162002e28565b95602085013595506040909401359392505050565b6000602082840312156200279c578081fd5b8151801515811462000f9a578182fd5b600060208284031215620027be578081fd5b5035919050565b600060208284031215620027d7578081fd5b5051919050565b60008060408385031215620027f1578182fd5b50508035926020909101359150565b6000806000806080858703121562002816578182fd5b84359350602085013560ff811681146200282e578283fd5b93969395505050506040820135916060013590565b60006020828403121562002855578081fd5b81356001600160401b038111156200286b578182fd5b6200287984828501620025eb565b949350505050565b6000806040838503121562002894578182fd5b82356001600160401b03811115620028aa578283fd5b620028b885828601620025eb565b95602094909401359450505050565b60008060008060808587031215620028dd578182fd5b8451600a8110620028ec578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111562002917578182fd5b8501601f8101871362002928578182fd5b805162002939620025ac8262002dd7565b8181528860208385010111156200294e578384fd5b6200296182602083016020860162002df9565b9598949750929550505050565b60006020828403121562002980578081fd5b81356001600160401b0381111562002996578182fd5b8201601f81018413620029a7578182fd5b62002879848235602084016200259b565b60008060408385031215620029cb578182fd5b82356001600160401b03811115620029e1578283fd5b620029ef858286016200261d565b925050602083013562002a028162002e28565b809150509250929050565b60008060006060848603121562002a22578081fd5b83356001600160401b0381111562002a38578182fd5b62002a46868287016200261d565b935050602084013562002a598162002e28565b9150604084013562002a6b8162002e28565b809150509250925092565b60008060006060848603121562002a8b578081fd5b83359250602084013562002a9f8162002e28565b915060408401356001600160401b0381111562002aba578182fd5b62002ac886828701620025eb565b9150509250925092565b6000815180845262002aec81602086016020860162002df9565b601f01601f19169290920160200192915050565b600a811062002b0b57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825162002b7981846020870162002df9565b9190910192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0383168152604060208201819052600090620028799083018462002ad2565b600083151582526040602083015262002879604083018462002ad2565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000f9a602083018462002ad2565b602081016002831062002c8357fe5b91905290565b600062002c97828762002b00565b60ff8516602083015260ff841660408301526080606083015262002cbf608083018462002ad2565b9695505050505050565b600062002cd7828762002b00565b8460208301528360408301526080606083015262002cbf608083018462002ad2565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6020808252602e908201527f4f6e6c792062652063616c6c61626c6520617420746865207374617274206f6660408201526d1030903a3930b739b0b1ba34b7b760911b606082015260800190565b6040518181016001600160401b038111828210171562002dcf57fe5b604052919050565b60006001600160401b0382111562002deb57fe5b50601f01601f191660200190565b60005b8381101562002e1657818101518382015260200162002dfc565b83811115620008ac5750506000910152565b6001600160a01b03811681146200049d57600080fdfe608060405234801561001057600080fd5b506040516108643803806108648339818101604052602081101561003357600080fd5b505161003e81610044565b506101c7565b6100877fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead60001b826001600160a01b031660001b61008a60201b6103ba1760201c565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b03908116628af59360e61b179091526100d691906100db16565b505050565b60606100e75a836100ed565b92915050565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106101325780518252601f199092019160209182019101610113565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d8060008114610195576040519150601f19603f3d011682016040523d82523d6000602084013e61019a565b606091505b509092509050816101ad57805160208201fd5b8051600114156101bd5760016000f35b92506100e7915050565b61068e806101d66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630900f010146100a1578063aaf10f42146100c9575b6000806100825a6100456100ed565b6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061011d92505050565b91509150811561009457805160208201f35b61009d816102c0565b5050005b6100c7600480360360208110156100b757600080fd5b50356001600160a01b031661036a565b005b6100d16100ed565b604080516001600160a01b039092168252519081900360200190f35b60006101187fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead610406565b905090565b6000606060006101e586868660405160240180848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001620631bb60e21b0319179052945061046c9350505050565b90508080602001905160408110156101fc57600080fd5b81516020830180516040519294929383019291908464010000000082111561022357600080fd5b90830190602082018581111561023857600080fd5b825164010000000081118282018810171561025257600080fd5b82525081516020918201929091019080838360005b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b506040525050509250925050935093915050565b610366816040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156103045781810151838201526020016102ec565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316632a2a7adb60e01b179052925061046c915050565b5050565b6103ae61037561047e565b6001600160a01b03166103866104d4565b6001600160a01b0316146040518060600160405280603281526020016106276032913961050b565b6103b781610519565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b0316628af59360e61b1790526104019061046c565b505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303daa95960e01b179052600090819061044c9061046c565b905080806020019051602081101561046357600080fd5b50519392505050565b60606104785a8361054c565b92915050565b6040805160048152602481019091526020810180516001600160e01b0316631cd4241960e21b17905260009081906104b59061046c565b90508080602001905160208110156104cc57600080fd5b505191505090565b6040805160048152602481019091526020810180516001600160e01b031663996d79a560e01b17905260009081906104b59061046c565b8161036657610366816102c0565b6103b77fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead6001600160a01b0383166103ba565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106105915780518252601f199092019160209182019101610572565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090925090508161060c57805160208201fd5b80516001141561061c5760016000f35b925061047891505056fe454f41732063616e206f6e6c792075706772616465207468656972206f776e20454f4120696d706c656d656e746174696f6ea26469706673582212207f82637ab24ef9653a9774102bad776ee1ee930f0e1d73dfcad1f8fd1b18609a64736f6c634300070600335369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642ea2646970667358221220f054814893c33a58bbcbd4f73988d982d06877b6e63ed1b5a478541f1e64b5b164736f6c63430007060033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001d25760003560e01c8063741a33eb1162000111578063996d79a511620000a55780639dc9dc93116200007b5780639dc9dc9314620003e4578063bdbf8c3614620003ee578063c1fb2ea214620003f8578063ffe73914146200040257620001d2565b8063996d79a514620003ac57806399ccd98b14620003b65780639be3ad6714620003cd57620001d2565b80638540661f11620000e75780638540661f146200034d57806385979f7614620003745780638bb42e15146200038b5780639058025614620003a257620001d2565b8063741a33eb14620002f9578063746c32f114620003105780638435035b146200033657620001d2565b806322bd64c01162000189578063461a4478116200015f578063461a447814620002b75780634d78009214620002ce5780635a98c36114620002e55780637350906414620002ef57620001d2565b806322bd64c0146200027257806324749d5c14620002895780632a2a7adb14620002a057620001d2565b806303daa95914620001d75780630da449d11462000206578063101185a4146200021f57806314aa2ff714620002385780631c4712a7146200025e57806320160f3a1462000268575b600080fd5b620001ee620001e8366004620027ac565b62000419565b604051620001fd919062002b83565b60405180910390f35b6200021d62000217366004620027ac565b62000463565b005b62000229620004a0565b604051620001fd919062002c74565b6200024f6200024936600462002843565b620004a9565b604051620001fd919062002b8c565b620001ee6200054a565b620001ee62000550565b6200021d62000283366004620027de565b62000556565b620001ee6200029a366004620026c2565b620005c1565b6200021d620002b136600462002843565b620005e0565b6200024f620002c83660046200296e565b620005ed565b6200021d620002df36600462002700565b620006cf565b620001ee620008b3565b6200024f620008b9565b6200021d6200030a36600462002800565b620008c8565b620003276200032136600462002753565b62000a52565b604051620001fd919062002c5f565b620001ee62000347366004620026c2565b62000a8b565b620003646200035e36600462002a76565b62000aa2565b604051620001fd92919062002c24565b620003646200038536600462002a76565b62000b1f565b620003646200039c36600462002a0d565b62000b70565b620001ee62000c4e565b6200024f62000c54565b6200024f620003c736600462002881565b62000c63565b6200021d620003de366004620029b8565b62000cfd565b6200024f62000e5b565b620001ee62000e6a565b620001ee62000e70565b620003646200041336600462002a76565b62000e8b565b6000619c4060005a905060006200042f62000c54565b90506200043d818662000f04565b93505060005a82039050808310156200045b57601080548483030190555b505050919050565b600f5460ff600160a01b90910416151560011415620004885762000488600762000fa3565b6200049d6200049662000c54565b8262000fbe565b50565b60085460ff1690565b600f5460009060ff600160a01b90910416151560011415620004d157620004d1600762000fa3565b619c4060005a90506000620004e562000c54565b9050620004f28162001035565b60006200050a826200050484620010c4565b62001157565b9050620005188187620011f3565b9450505060005a82039050808310156200053a5760108054840190556200045b565b6010805482019055505050919050565b60045490565b600b5490565b600f5460ff600160a01b909104161515600114156200057b576200057b600762000fa3565b61ea6060005a905060006200058f62000c54565b90506200059e818686620012c1565b5060005a8203905080831015620005ba57601080548483030190555b5050505050565b6000620005d8620005d28362001352565b620013e5565b90505b919050565b6200049d600282620013e9565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156200064f57818101518382015260200162000635565b50505050905090810190601f1680156200067d5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156200069b57600080fd5b505afa158015620006b0573d6000803e3d6000fd5b505050506040513d6020811015620006c757600080fd5b505192915050565b333014620006dd57620008af565b620006e88262001430565b620006f957620006f9600662000fa3565b6001546040516352275acd60e11b81526001600160a01b039091169063a44eb59a906200072b90849060040162002c5f565b60206040518083038186803b1580156200074457600080fd5b505afa15801562000759573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200077f91906200278a565b620007905762000790600562000fa3565b6200079b82620014c3565b6000620007a88262001530565b90506001600160a01b038116620007c557620007c5600862000fa3565b600060125460ff166009811115620007d957fe5b14620007f057601254620007f09060ff1662000fa3565b6000620007fd8262001541565b6001546040516352275acd60e11b81529192506001600160a01b03169063a44eb59a906200083090849060040162002c5f565b60206040518083038186803b1580156200084957600080fd5b505afa1580156200085e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200088491906200278a565b620008955762000895600562000fa3565b620008ac8483620008a685620013e5565b6200155b565b50505b5050565b600a5490565b600e546001600160a01b031690565b600f5460ff600160a01b90910416151560011415620008ed57620008ed600762000fa3565b600060018585601b0185856040516000815260200160405260405162000917949392919062002c41565b6020604051602081039080840390855afa1580156200093a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166200097a576200097a604051806060016040528060388152602001620036a360389139620005e0565b620009858162001430565b620009915750620008ac565b6200099c81620014c3565b600f80546001600160a01b038381166001600160a01b03198316179092556040519116906000906003602160991b0190620009d7906200258d565b620009e3919062002b8c565b604051809103906000f08015801562000a00573d6000803e3d6000fd5b50600f80546001600160a01b0319166001600160a01b038516179055905062000a3c838262000a2f8162001541565b805190602001206200155b565b62000a4983600062000fbe565b50505050505050565b606060008260011462000a66578262000a69565b60025b905062000a8262000a7a8662001352565b85836200159c565b95945050505050565b6000620005d862000a9c8362001352565b620015be565b600060606201388060005a60408051606081018252600f546001600160a01b0390811682528916602082015260019181019190915290915062000ae881898989620015c2565b945094505060005a820390508083101562000b0b57601080548401905562000b14565b60108054820190555b505050935093915050565b60006060620186a060005a60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908816602082015290915062000ae881898989620015c2565b60006060331562000b8057600080fd5b600280546001600160a01b0319166001600160a01b03851617905562000ba68562001659565b6000196011556080850151600f80546001600160a01b039283166001600160a01b03199182168117909255600e8054938816939091169290921790915560a086015160c087015160405162000bfc919062002b65565b60006040518083038160008787f1925050503d806000811462000c3c576040519150601f19603f3d011682016040523d82523d6000602084013e62000c41565b606091505b5091509150935093915050565b60075490565b600f546001600160a01b031690565b600f5460009060ff600160a01b9091041615156001141562000c8b5762000c8b600762000fa3565b619c4060005a9050600062000c9f62000c54565b905062000cac8162001035565b600062000cbb828888620016ce565b905062000cc98188620011f3565b9450505060005a820390508083101562000ceb57601080548401905562000cf4565b60108054820190555b50505092915050565b600a541562000d295760405162461bcd60e51b815260040162000d209062002d65565b60405180910390fd5b600280546001600160a01b0319166001600160a01b038381169190911791829055604051630d15d41560e41b815291169063d15d41509062000d7090339060040162002b8c565b60206040518083038186803b15801562000d8957600080fd5b505afa15801562000d9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000dc491906200278a565b62000de35760405162461bcd60e51b815260040162000d209062002cf9565b62000dee8262001659565b62000e028260a00151836040015162001718565b62000e0d57620008af565b60005a905062000e326003600001548460a001510384608001518560c0015162000b1f565b505060005a8203905062000e456200174c565b5050600280546001600160a01b03191690555050565b600d546001600160a01b031690565b60095490565b600062000e8662000e8062000c54565b620010c4565b905090565b60006060619c4060005a60408051606081018252600e546001600160a01b039081168252600f549081166020830152600160a01b900460ff16151591810191909152909150600062000ee0828a8a8a620015c2565b95509550505060005a820390508083101562000b0b57601080548401905562000b14565b600062000f128383620017af565b600254604051631aaf392f60e01b81526001600160a01b0390911690631aaf392f9062000f46908690869060040162002bc4565b60206040518083038186803b15801562000f5f57600080fd5b505afa15801562000f74573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f9a9190620027c5565b90505b92915050565b6200049d8160405180602001604052806000815250620013e9565b62000fc982620018ff565b6002546040516374855dc360e11b81526001600160a01b039091169063e90abb869062000ffd908590859060040162002bc4565b600060405180830381600087803b1580156200101857600080fd5b505af11580156200102d573d6000803e3d6000fd5b505050505050565b600080620010885a6002602160991b018560405160240162001058919062002b8c565b60408051601f198184030181529190526020810180516001600160e01b031663b1540a0160e01b17905262000b1f565b91509150600081806020019051810190620010a491906200278a565b9050801580620010b2575082155b15620008ac57620008ac600962000fa3565b6000620010d18262001a25565b60025460405163d126199f60e01b81526001600160a01b039091169063d126199f906200110390859060040162002b8c565b60206040518083038186803b1580156200111c57600080fd5b505afa15801562001131573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620027c5565b60408051600280825260608201909252600091829190816020015b606081526020019060019003908162001172579050509050620011958462001b7c565b81600081518110620011a357fe5b6020026020010181905250620011b98362001baa565b81600181518110620011c757fe5b60200260200101819052506000620011df8262001bc1565b905062000a82818051906020012062001bf2565b60006200121a6200120362000c54565b6200121162000e8062000c54565b60010162000fbe565b60408051606081018252600f5460ff600160a01b8204161515928201929092526001600160a01b039182168152908416602082015260006200129d825a3088886040516024016200126d92919062002bfe565b60408051601f198184030181529190526020810180516001600160e01b03166326bc004960e11b17905262001bf5565b506012805460ff19169055905080620012b857600062000a82565b50929392505050565b80620012ce848462000f04565b1415620012db576200134d565b620012e7838362001dc7565b600254604051635c17d62960e01b81526001600160a01b0390911690635c17d629906200131d9086908690869060040162002bdd565b600060405180830381600087803b1580156200133857600080fd5b505af115801562000a49573d6000803e3d6000fd5b505050565b60006200135f8262001a25565b600254604051637c8ee70360e01b81526001600160a01b0390911690637c8ee703906200139190859060040162002b8c565b60206040518083038186803b158015620013aa57600080fd5b505afa158015620013bf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d89190620026e1565b3f90565b333b15801562001418576012805484919060ff191660018360098111156200140d57fe5b021790555060016000f35b600062001426848462001ee8565b9050805160208201fd5b60006200143d8262001a25565b6002546040516307a1294560e01b81526001600160a01b03909116906307a12945906200146f90859060040162002b8c565b60206040518083038186803b1580156200148857600080fd5b505afa1580156200149d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d891906200278a565b620014ce8162001a25565b600254604051637e78a4d160e11b81526001600160a01b039091169063fcf149a2906200150090849060040162002b8c565b600060405180830381600087803b1580156200151b57600080fd5b505af1158015620005ba573d6000803e3d6000fd5b60008151602083016000f092915050565b6060620005d88260006200155585620015be565b6200159c565b6200156683620018ff565b6002546040516368510af960e11b81526001600160a01b039091169063d0a215f2906200131d9086908690869060040162002ba0565b60606040519050602082018101604052818152818360208301863c9392505050565b3b90565b6000606073ffffffffffffffffffffffffffffffffffff0000841673deaddeaddeaddeaddeaddeaddeaddeaddead000014156200161357505060408051602081019091526000815260019062001650565b60006064856001600160a01b0316106200163857620016328562001352565b6200163a565b845b90506200164a8787838762001bf5565b92509250505b94509492505050565b80516009556020810151600a5560a0810151600c5560408101516008805460ff1916600183818111156200168957fe5b02179055506060810151600d80546001600160a01b0319166001600160a01b03909216919091179055600554600b5560a0810151620016c89062001fb3565b60115550565b60008060ff60f81b85848680519060200120604051602001620016f5949392919062002b2c565b60405160208183030381529060405280519060200120905062000a828162001bf2565b6004546000908311156200172f5750600062000f9d565b600354831015620017435750600062000f9d565b50600192915050565b600d80546001600160a01b031990811690915560006009819055600a819055600b819055600c8190556008805460ff199081169091556010829055600e8054909316909255600f80546001600160a81b0319169055601155601280549091169055565b6175305a1015620017c657620017c6600162000fa3565b600254604051630ad2267960e01b81526001600160a01b0390911690630ad2267990620017fa908590859060040162002bc4565b60206040518083038186803b1580156200181357600080fd5b505afa15801562001828573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200184e91906200278a565b6200185f576200185f600462000fa3565b600254604051632bcdee1960e21b81526000916001600160a01b03169063af37b8649062001894908690869060040162002bc4565b602060405180830381600087803b158015620018af57600080fd5b505af1158015620018c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620018ea91906200278a565b9050806200134d576200134d614e2062001fc8565b6200190a8162001a25565b60025460405163011b1f7960e41b81526000916001600160a01b0316906311b1f790906200193d90859060040162002b8c565b602060405180830381600087803b1580156200195857600080fd5b505af11580156200196d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200199391906200278a565b905080620008af57600260009054906101000a90046001600160a01b03166001600160a01b03166333f943056040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620019ec57600080fd5b505af115801562001a01573d6000803e3d6000fd5b50505050620008af617530606462001a1d62000a9c8662001352565b020162001fc8565b6175305a101562001a3c5762001a3c600162000fa3565b60025460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf9062001a6e90849060040162002b8c565b60206040518083038186803b15801562001a8757600080fd5b505afa15801562001a9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac291906200278a565b62001ad35762001ad3600462000fa3565b600254604051633ecdecc760e21b81526000916001600160a01b03169063fb37b31c9062001b0690859060040162002b8c565b602060405180830381600087803b15801562001b2157600080fd5b505af115801562001b36573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001b5c91906200278a565b905080620008af57620008af617530606462001a1d62000a9c8662001352565b6060620005d88260405160200162001b95919062002b0f565b60405160208183030381529060405262001feb565b6060620005d862001bbb836200203c565b62001feb565b6060600062001bd0836200214d565b905062001beb62001be4825160c06200225a565b82620023b7565b9392505050565b90565b6040805160608082018352600e546001600160a01b039081168352600f549081166020840152600160a01b900460ff161515928201929092526000919062001c3e818862002438565b601154600062001c4e8862001fb3565b905080601160000181905550600080886001600160a01b03168a8960405162001c78919062002b65565b60006040518083038160008787f1925050503d806000811462001cb8576040519150601f19603f3d011682016040523d82523d6000602084013e62001cbd565b606091505b509150915062001cce8b8662002438565b6011548262001db05760008060008062001ce886620024ef565b92965090945092509050600484600981111562001d0157fe5b141562001d135762001d138462000fa3565b600284600981111562001d2257fe5b148062001d3b5750600584600981111562001d3957fe5b145b8062001d535750600784600981111562001d5157fe5b145b8062001d6b5750600984600981111562001d6957fe5b145b1562001d775760108290555b600284600981111562001d8657fe5b141562001d965780955062001da9565b6040518060200160405280600081525095505b5090925050505b909203909203601155909890975095505050505050565b62001dd38282620017af565b60025460405163af3dc01160e01b81526000916001600160a01b03169063af3dc0119062001e08908690869060040162002bc4565b602060405180830381600087803b15801562001e2357600080fd5b505af115801562001e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001e5e91906200278a565b9050806200134d5762001e7183620018ff565b600260009054906101000a90046001600160a01b03166001600160a01b031663c3fd9b256040518163ffffffff1660e01b8152600401600060405180830381600087803b15801562001ec257600080fd5b505af115801562001ed7573d6000803e3d6000fd5b505050506200134d614e2062001fc8565b6060600183600981111562001ef957fe5b148062001f125750600883600981111562001f1057fe5b145b1562001f2e575060408051602081019091526000815262000f9d565b600483600981111562001f3d57fe5b141562001f7f5760408051602080820183526000808352925162001f68938793909283920162002c89565b604051602081830303815290604052905062000f9d565b60115460105460405162001f9c9286929091869060200162002cc9565b604051602081830303815290604052905092915050565b60005a821062001fc4575a620005d8565b5090565b60115481111562001fdf5762001fdf600362000fa3565b60118054919091039055565b606080825160011480156200201557506080836000815181106200200b57fe5b016020015160f81c105b1562002023575081620005d8565b62000f9a62002035845160806200225a565b84620023b7565b606060008260405160200162002053919062002b83565b604051602081830303815290604052905060005b6020811015620020a2578181815181106200207e57fe5b01602001516001600160f81b031916156200209957620020a2565b60010162002067565b6000816020036001600160401b0381118015620020be57600080fd5b506040519080825280601f01601f191660200182016040528015620020ea576020820181803683370190505b50905060005b8151811015620021445783516001840193859181106200210c57fe5b602001015160f81c60f81b8282815181106200212457fe5b60200101906001600160f81b031916908160001a905350600101620020f0565b50949350505050565b6060815160001415620021705750604080516000815260208101909152620005db565b6000805b8351811015620021a6578381815181106200218b57fe5b60200260200101515182019150808060010191505062002174565b6000826001600160401b0381118015620021bf57600080fd5b506040519080825280601f01601f191660200182016040528015620021eb576020820181803683370190505b50600092509050602081015b8551831015620021445760008684815181106200221057fe5b602002602001015190506000602082019050620022308382845162002547565b8785815181106200223d57fe5b6020026020010151518301925050508280600101935050620021f7565b6060806038841015620022b7576040805160018082528183019092529060208201818036833701905050905082840160f81b816000815181106200229a57fe5b60200101906001600160f81b031916908160001a90535062000f9a565b600060015b808681620022c657fe5b0415620022dd5760019091019061010002620022bc565b816001016001600160401b0381118015620022f757600080fd5b506040519080825280601f01601f19166020018201604052801562002323576020820181803683370190505b50925084820160370160f81b836000815181106200233d57fe5b60200101906001600160f81b031916908160001a905350600190505b818111620023ae576101008183036101000a87816200237457fe5b04816200237d57fe5b0660f81b8382815181106200238e57fe5b60200101906001600160f81b031916908160001a90535060010162002359565b50509392505050565b6060806040519050835180825260208201818101602087015b81831015620023ea578051835260209283019201620023d0565b50855184518101855292509050808201602086015b8183101562002419578051835260209283019201620023ff565b508651929092011591909101601f01601f191660405250905092915050565b805182516001600160a01b0390811691161462002471578051600e80546001600160a01b0319166001600160a01b039092169190911790555b80602001516001600160a01b031682602001516001600160a01b031614620024b8576020810151600f80546001600160a01b0319166001600160a01b039092169190911790555b806040015115158260400151151514620008af5760400151600f8054911515600160a01b0260ff60a01b1990921691909117905550565b600080600060608451600014156200252157505060408051602081019091526000808252600193509150819062002540565b84806020019051810190620025379190620028c7565b93509350935093505b9193509193565b8282825b602081106200256c578151835260209283019290910190601f19016200254b565b905182516020929092036101000a6000190180199091169116179052505050565b6108648062002e3f83390190565b6000620025b2620025ac8462002dd7565b62002db3565b9050828152838383011115620025c757600080fd5b828260208301376000602084830101529392505050565b8035620005db8162002e28565b600082601f830112620025fc578081fd5b62000f9a838335602085016200259b565b803560028110620005db57600080fd5b600060e082840312156200262f578081fd5b6200263b60e062002db3565b9050813581526020820135602082015262002659604083016200260d565b60408201526200266c60608301620025de565b60608201526200267f60808301620025de565b608082015260a082013560a082015260c08201356001600160401b03811115620026a857600080fd5b620026b684828501620025eb565b60c08301525092915050565b600060208284031215620026d4578081fd5b813562000f9a8162002e28565b600060208284031215620026f3578081fd5b815162000f9a8162002e28565b6000806040838503121562002713578081fd5b8235620027208162002e28565b915060208301356001600160401b038111156200273b578182fd5b6200274985828601620025eb565b9150509250929050565b60008060006060848603121562002768578081fd5b8335620027758162002e28565b95602085013595506040909401359392505050565b6000602082840312156200279c578081fd5b8151801515811462000f9a578182fd5b600060208284031215620027be578081fd5b5035919050565b600060208284031215620027d7578081fd5b5051919050565b60008060408385031215620027f1578182fd5b50508035926020909101359150565b6000806000806080858703121562002816578182fd5b84359350602085013560ff811681146200282e578283fd5b93969395505050506040820135916060013590565b60006020828403121562002855578081fd5b81356001600160401b038111156200286b578182fd5b6200287984828501620025eb565b949350505050565b6000806040838503121562002894578182fd5b82356001600160401b03811115620028aa578283fd5b620028b885828601620025eb565b95602094909401359450505050565b60008060008060808587031215620028dd578182fd5b8451600a8110620028ec578283fd5b80945050602085015192506040850151915060608501516001600160401b0381111562002917578182fd5b8501601f8101871362002928578182fd5b805162002939620025ac8262002dd7565b8181528860208385010111156200294e578384fd5b6200296182602083016020860162002df9565b9598949750929550505050565b60006020828403121562002980578081fd5b81356001600160401b0381111562002996578182fd5b8201601f81018413620029a7578182fd5b62002879848235602084016200259b565b60008060408385031215620029cb578182fd5b82356001600160401b03811115620029e1578283fd5b620029ef858286016200261d565b925050602083013562002a028162002e28565b809150509250929050565b60008060006060848603121562002a22578081fd5b83356001600160401b0381111562002a38578182fd5b62002a46868287016200261d565b935050602084013562002a598162002e28565b9150604084013562002a6b8162002e28565b809150509250925092565b60008060006060848603121562002a8b578081fd5b83359250602084013562002a9f8162002e28565b915060408401356001600160401b0381111562002aba578182fd5b62002ac886828701620025eb565b9150509250925092565b6000815180845262002aec81602086016020860162002df9565b601f01601f19169290920160200192915050565b600a811062002b0b57fe5b9052565b60609190911b6bffffffffffffffffffffffff1916815260140190565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825162002b7981846020870162002df9565b9190910192915050565b90815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0383168152604060208201819052600090620028799083018462002ad2565b600083151582526040602083015262002879604083018462002ad2565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000f9a602083018462002ad2565b602081016002831062002c8357fe5b91905290565b600062002c97828762002b00565b60ff8516602083015260ff841660408301526080606083015262002cbf608083018462002ad2565b9695505050505050565b600062002cd7828762002b00565b8460208301528360408301526080606083015262002cbf608083018462002ad2565b60208082526046908201527f4f6e6c792061757468656e746963617465642061646472657373657320696e2060408201527f6f766d53746174654d616e616765722063616e2063616c6c20746869732066756060820152653731ba34b7b760d11b608082015260a00190565b6020808252602e908201527f4f6e6c792062652063616c6c61626c6520617420746865207374617274206f6660408201526d1030903a3930b739b0b1ba34b7b760911b606082015260800190565b6040518181016001600160401b038111828210171562002dcf57fe5b604052919050565b60006001600160401b0382111562002deb57fe5b50601f01601f191660200190565b60005b8381101562002e1657818101518382015260200162002dfc565b83811115620008ac5750506000910152565b6001600160a01b03811681146200049d57600080fdfe608060405234801561001057600080fd5b506040516108643803806108648339818101604052602081101561003357600080fd5b505161003e81610044565b506101c7565b6100877fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead60001b826001600160a01b031660001b61008a60201b6103ba1760201c565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b03908116628af59360e61b179091526100d691906100db16565b505050565b60606100e75a836100ed565b92915050565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106101325780518252601f199092019160209182019101610113565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d8060008114610195576040519150601f19603f3d011682016040523d82523d6000602084013e61019a565b606091505b509092509050816101ad57805160208201fd5b8051600114156101bd5760016000f35b92506100e7915050565b61068e806101d66000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630900f010146100a1578063aaf10f42146100c9575b6000806100825a6100456100ed565b6000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061011d92505050565b91509150811561009457805160208201f35b61009d816102c0565b5050005b6100c7600480360360208110156100b757600080fd5b50356001600160a01b031661036a565b005b6100d16100ed565b604080516001600160a01b039092168252519081900360200190f35b60006101187fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead610406565b905090565b6000606060006101e586868660405160240180848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001620631bb60e21b0319179052945061046c9350505050565b90508080602001905160408110156101fc57600080fd5b81516020830180516040519294929383019291908464010000000082111561022357600080fd5b90830190602082018581111561023857600080fd5b825164010000000081118282018810171561025257600080fd5b82525081516020918201929091019080838360005b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b506040525050509250925050935093915050565b610366816040516024018080602001828103825283818151815260200191508051906020019080838360005b838110156103045781810151838201526020016102ec565b50505050905090810190601f1680156103315780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316632a2a7adb60e01b179052925061046c915050565b5050565b6103ae61037561047e565b6001600160a01b03166103866104d4565b6001600160a01b0316146040518060600160405280603281526020016106276032913961050b565b6103b781610519565b50565b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b0316628af59360e61b1790526104019061046c565b505050565b6040805160248082018490528251808303909101815260449091019091526020810180516001600160e01b03166303daa95960e01b179052600090819061044c9061046c565b905080806020019051602081101561046357600080fd5b50519392505050565b60606104785a8361054c565b92915050565b6040805160048152602481019091526020810180516001600160e01b0316631cd4241960e21b17905260009081906104b59061046c565b90508080602001905160208110156104cc57600080fd5b505191505090565b6040805160048152602481019091526020810180516001600160e01b031663996d79a560e01b17905260009081906104b59061046c565b8161036657610366816102c0565b6103b77fdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead6001600160a01b0383166103ba565b60606000339050600080826001600160a01b031686866040518082805190602001908083835b602083106105915780518252601f199092019160209182019101610572565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038160008787f1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090925090508161060c57805160208201fd5b80516001141561061c5760016000f35b925061047891505056fe454f41732063616e206f6e6c792075706772616465207468656972206f776e20454f4120696d706c656d656e746174696f6ea26469706673582212207f82637ab24ef9653a9774102bad776ee1ee930f0e1d73dfcad1f8fd1b18609a64736f6c634300070600335369676e61747572652070726f766964656420666f7220454f4120636f6e7472616374206372656174696f6e20697320696e76616c69642ea2646970667358221220f054814893c33a58bbcbd4f73988d982d06877b6e63ed1b5a478541f1e64b5b164736f6c63430007060033", - "devdoc": { - "details": "The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed environment allowing us to execute OVM transactions deterministically on either Layer 1 or Layer 2. The EM's run() function is the first function called during the execution of any transaction on L2. For each context-dependent EVM operation the EM has a function which implements a corresponding OVM operation, which will read state from the State Manager contract. The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any context-dependent operations. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager." - } - }, - "ovmADDRESS()": { - "returns": { - "_ADDRESS": "Active ADDRESS within the current message context." - } - }, - "ovmCALL(uint256,address,bytes)": { - "params": { - "_address": "Address of the contract to call.", - "_calldata": "Data to send along with the call.", - "_gasLimit": "Amount of gas to be passed into this call." - }, - "returns": { - "_returndata": "Data returned by the call.", - "_success": "Whether or not the call returned (rather than reverted)." - } - }, - "ovmCALLER()": { - "returns": { - "_CALLER": "Address of the CALLER within the current message context." - } - }, - "ovmCHAINID()": { - "returns": { - "_CHAINID": "Value of the chain's CHAINID within the global context." - } - }, - "ovmCREATE(bytes)": { - "params": { - "_bytecode": "Code to be used to CREATE a new contract." - }, - "returns": { - "_contract": "Address of the created contract." - } - }, - "ovmCREATE2(bytes,bytes32)": { - "params": { - "_bytecode": "Code to be used to CREATE2 a new contract.", - "_salt": "Value used to determine the contract's address." - }, - "returns": { - "_contract": "Address of the created contract." - } - }, - "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)": { - "details": "Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks because the contract we're creating is trusted (no need to do safety checking or to handle unexpected reverts). Doesn't need to return an address because the address is assumed to be the user's actual address.", - "params": { - "_messageHash": "Hash of a message signed by some user, for verification.", - "_r": "Signature `r` parameter.", - "_s": "Signature `s` parameter.", - "_v": "Signature `v` parameter." - } - }, - "ovmDELEGATECALL(uint256,address,bytes)": { - "params": { - "_address": "Address of the contract to call.", - "_calldata": "Data to send along with the call.", - "_gasLimit": "Amount of gas to be passed into this call." - }, - "returns": { - "_returndata": "Data returned by the call.", - "_success": "Whether or not the call returned (rather than reverted)." - } - }, - "ovmEXTCODECOPY(address,uint256,uint256)": { - "params": { - "_contract": "Address of the contract to copy code from.", - "_length": "Total number of bytes to copy from the contract's code.", - "_offset": "Offset in bytes from the start of contract code to copy beyond." - }, - "returns": { - "_code": "Bytes of code copied from the requested contract." - } - }, - "ovmEXTCODEHASH(address)": { - "params": { - "_contract": "Address of the contract to query the hash of." - }, - "returns": { - "_EXTCODEHASH": "Hash of the requested contract." - } - }, - "ovmEXTCODESIZE(address)": { - "params": { - "_contract": "Address of the contract to query the size of." - }, - "returns": { - "_EXTCODESIZE": "Size of the requested contract in bytes." - } - }, - "ovmGASLIMIT()": { - "returns": { - "_GASLIMIT": "Value of the block's GASLIMIT within the transaction context." - } - }, - "ovmGETNONCE()": { - "returns": { - "_nonce": "Nonce of the current contract." - } - }, - "ovmL1QUEUEORIGIN()": { - "returns": { - "_queueOrigin": "Address of the ovmL1QUEUEORIGIN within the current message context." - } - }, - "ovmL1TXORIGIN()": { - "returns": { - "_l1TxOrigin": "Address of the account which sent the tx into L2 from L1." - } - }, - "ovmNUMBER()": { - "returns": { - "_NUMBER": "Value of the NUMBER within the transaction context." - } - }, - "ovmREVERT(bytes)": { - "params": { - "_data": "Bytes data to pass along with the REVERT." - } - }, - "ovmSETNONCE(uint256)": { - "params": { - "_nonce": "New nonce for the current contract." - } - }, - "ovmSLOAD(bytes32)": { - "params": { - "_key": "32 byte key of the storage slot to load." - }, - "returns": { - "_value": "32 byte value of the requested storage slot." - } - }, - "ovmSSTORE(bytes32,bytes32)": { - "params": { - "_key": "32 byte key of the storage slot to set.", - "_value": "32 byte value for the storage slot." - } - }, - "ovmSTATICCALL(uint256,address,bytes)": { - "params": { - "_address": "Address of the contract to call.", - "_calldata": "Data to send along with the call.", - "_gasLimit": "Amount of gas to be passed into this call." - }, - "returns": { - "_returndata": "Data returned by the call.", - "_success": "Whether or not the call returned (rather than reverted)." - } - }, - "ovmTIMESTAMP()": { - "returns": { - "_TIMESTAMP": "Value of the TIMESTAMP within the transaction context." - } - }, - "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { - "params": { - "_ovmStateManager": "iOVM_StateManager implementation providing account state.", - "_transaction": "Transaction data to be executed." - } - }, - "safeCREATE(address,bytes)": { - "details": "This function is implemented as `public` because we need to be able to revert a contract creation without losing information about exactly *why* the contract reverted. In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS flag and then revert to reset the flag. We're able to do this by making an external call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay information before reverting.", - "params": { - "_address": "Address of the contract to associate with the one being created.", - "_bytecode": "Code to be used to create the new contract." - } - }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { - "params": { - "_from": "the OVM account the simulated call should be from.", - "_transaction": "the message transaction to simulate." - } - } - }, - "title": "OVM_ExecutionManager", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "ovmADDRESS()": { - "notice": "Overrides ADDRESS." - }, - "ovmCALL(uint256,address,bytes)": { - "notice": "Overrides CALL." - }, - "ovmCALLER()": { - "notice": "Overrides CALLER." - }, - "ovmCHAINID()": { - "notice": "Overrides CHAINID." - }, - "ovmCREATE(bytes)": { - "notice": "Overrides CREATE." - }, - "ovmCREATE2(bytes,bytes32)": { - "notice": "Overrides CREATE2." - }, - "ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)": { - "notice": "Creates a new EOA contract account, for account abstraction." - }, - "ovmDELEGATECALL(uint256,address,bytes)": { - "notice": "Overrides DELEGATECALL." - }, - "ovmEXTCODECOPY(address,uint256,uint256)": { - "notice": "Overrides EXTCODECOPY." - }, - "ovmEXTCODEHASH(address)": { - "notice": "Overrides EXTCODEHASH." - }, - "ovmEXTCODESIZE(address)": { - "notice": "Overrides EXTCODESIZE." - }, - "ovmGASLIMIT()": { - "notice": "Overrides GASLIMIT." - }, - "ovmGETNONCE()": { - "notice": "Retrieves the nonce of the current ovmADDRESS." - }, - "ovmL1QUEUEORIGIN()": { - "notice": "Specifies from which L1 rollup queue this transaction originated from." - }, - "ovmL1TXORIGIN()": { - "notice": "Specifies which L1 account, if any, sent this transaction by calling enqueue()." - }, - "ovmNUMBER()": { - "notice": "Overrides NUMBER." - }, - "ovmREVERT(bytes)": { - "notice": "Overrides REVERT." - }, - "ovmSETNONCE(uint256)": { - "notice": "Sets the nonce of the current ovmADDRESS." - }, - "ovmSLOAD(bytes32)": { - "notice": "Overrides SLOAD." - }, - "ovmSSTORE(bytes32,bytes32)": { - "notice": "Overrides SSTORE." - }, - "ovmSTATICCALL(uint256,address,bytes)": { - "notice": "Overrides STATICCALL." - }, - "ovmTIMESTAMP()": { - "notice": "Overrides TIMESTAMP." - }, - "run((uint256,uint256,uint8,address,address,uint256,bytes),address)": { - "notice": "Starts the execution of a transaction via the OVM_ExecutionManager." - }, - "safeCREATE(address,bytes)": { - "notice": "Performs the logic to create a contract and revert under various potential conditions." - }, - "simulateMessage((uint256,uint256,uint8,address,address,uint256,bytes),address,address)": { - "notice": "Unreachable helper function for simulating eth_calls with an OVM message context. This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 4291, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmSafetyChecker", - "offset": 0, - "slot": "1", - "type": "t_contract(iOVM_SafetyChecker)10816" - }, - { - "astId": 4293, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmStateManager", - "offset": 0, - "slot": "2", - "type": "t_contract(iOVM_StateManager)11048" - }, - { - "astId": 4295, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "gasMeterConfig", - "offset": 0, - "slot": "3", - "type": "t_struct(GasMeterConfig)10594_storage" - }, - { - "astId": 4297, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "globalContext", - "offset": 0, - "slot": "7", - "type": "t_struct(GlobalContext)10597_storage" - }, - { - "astId": 4299, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "transactionContext", - "offset": 0, - "slot": "8", - "type": "t_struct(TransactionContext)10610_storage" - }, - { - "astId": 4301, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "messageContext", - "offset": 0, - "slot": "14", - "type": "t_struct(MessageContext)10620_storage" - }, - { - "astId": 4303, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "transactionRecord", - "offset": 0, - "slot": "16", - "type": "t_struct(TransactionRecord)10613_storage" - }, - { - "astId": 4305, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "messageRecord", - "offset": 0, - "slot": "17", - "type": "t_struct(MessageRecord)10625_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_contract(iOVM_SafetyChecker)10816": { - "encoding": "inplace", - "label": "contract iOVM_SafetyChecker", - "numberOfBytes": "20" - }, - "t_contract(iOVM_StateManager)11048": { - "encoding": "inplace", - "label": "contract iOVM_StateManager", - "numberOfBytes": "20" - }, - "t_enum(QueueOrigin)11644": { - "encoding": "inplace", - "label": "enum Lib_OVMCodec.QueueOrigin", - "numberOfBytes": "1" - }, - "t_enum(RevertFlag)10579": { - "encoding": "inplace", - "label": "enum iOVM_ExecutionManager.RevertFlag", - "numberOfBytes": "1" - }, - "t_struct(GasMeterConfig)10594_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.GasMeterConfig", - "members": [ - { - "astId": 10587, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "minTransactionGasLimit", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 10589, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "maxTransactionGasLimit", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 10591, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "maxGasPerQueuePerEpoch", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 10593, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "secondsPerEpoch", - "offset": 0, - "slot": "3", - "type": "t_uint256" - } - ], - "numberOfBytes": "128" - }, - "t_struct(GlobalContext)10597_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.GlobalContext", - "members": [ - { - "astId": 10596, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmCHAINID", - "offset": 0, - "slot": "0", - "type": "t_uint256" - } - ], - "numberOfBytes": "32" - }, - "t_struct(MessageContext)10620_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.MessageContext", - "members": [ - { - "astId": 10615, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmCALLER", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 10617, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmADDRESS", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 10619, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "isStatic", - "offset": 20, - "slot": "1", - "type": "t_bool" - } - ], - "numberOfBytes": "64" - }, - "t_struct(MessageRecord)10625_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.MessageRecord", - "members": [ - { - "astId": 10622, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "nuisanceGasLeft", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 10624, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "revertFlag", - "offset": 0, - "slot": "1", - "type": "t_enum(RevertFlag)10579" - } - ], - "numberOfBytes": "64" - }, - "t_struct(TransactionContext)10610_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.TransactionContext", - "members": [ - { - "astId": 10599, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmL1QUEUEORIGIN", - "offset": 0, - "slot": "0", - "type": "t_enum(QueueOrigin)11644" - }, - { - "astId": 10601, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmTIMESTAMP", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 10603, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmNUMBER", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 10605, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmGASLIMIT", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 10607, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmTXGASLIMIT", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 10609, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmL1TXORIGIN", - "offset": 0, - "slot": "5", - "type": "t_address" - } - ], - "numberOfBytes": "192" - }, - "t_struct(TransactionRecord)10613_storage": { - "encoding": "inplace", - "label": "struct iOVM_ExecutionManager.TransactionRecord", - "members": [ - { - "astId": 10612, - "contract": "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol:OVM_ExecutionManager", - "label": "ovmGasRefund", - "offset": 0, - "slot": "0", - "type": "t_uint256" - } - ], - "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_FraudVerifier.json b/deployments/kovan/OVM_FraudVerifier.json deleted file mode 100644 index 62c7829bd..000000000 --- a/deployments/kovan/OVM_FraudVerifier.json +++ /dev/null @@ -1,552 +0,0 @@ -{ - "address": "0x22842217e057F4890839F908e90Bbc5e60293313", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_preStateRootIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "_transactionHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "_who", - "type": "address" - } - ], - "name": "FraudProofFinalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_preStateRootIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "_transactionHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "_who", - "type": "address" - } - ], - "name": "FraudProofInitialized", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_preStateRootBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_preStateRootProof", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "_txHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_postStateRoot", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_postStateRootBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_postStateRootProof", - "type": "tuple" - } - ], - "name": "finalizeFraudVerification", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_txHash", - "type": "bytes32" - } - ], - "name": "getStateTransitioner", - "outputs": [ - { - "internalType": "contract iOVM_StateTransitioner", - "name": "_transitioner", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_preStateRootBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_preStateRootProof", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "enum Lib_OVMCodec.QueueOrigin", - "name": "l1QueueOrigin", - "type": "uint8" - }, - { - "internalType": "address", - "name": "l1TxOrigin", - "type": "address" - }, - { - "internalType": "address", - "name": "entrypoint", - "type": "address" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.Transaction", - "name": "_transaction", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bool", - "name": "isSequenced", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "queueIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "txData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.TransactionChainElement", - "name": "_txChainElement", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_transactionBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_transactionProof", - "type": "tuple" - } - ], - "name": "initializeFraudVerification", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0xb08165f2828fcf0cae83ec8ed328b3a9977a6ea1aaf0a64b653c3f2f8fdaea58", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x22842217e057F4890839F908e90Bbc5e60293313", - "transactionIndex": 3, - "gasUsed": "1375611", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd966d6303be33ba17c768eaa686378361f16b66db574d8919483bbcd6c20bceb", - "transactionHash": "0xb08165f2828fcf0cae83ec8ed328b3a9977a6ea1aaf0a64b653c3f2f8fdaea58", - "logs": [], - "blockNumber": 23637120, - "cumulativeGasUsed": "2047424", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofFinalized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_preStateRootIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_who\",\"type\":\"address\"}],\"name\":\"FraudProofInitialized\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_postStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_postStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_postStateRootProof\",\"type\":\"tuple\"}],\"name\":\"finalizeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_txHash\",\"type\":\"bytes32\"}],\"name\":\"getStateTransitioner\",\"outputs\":[{\"internalType\":\"contract iOVM_StateTransitioner\",\"name\":\"_transitioner\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_preStateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_preStateRootProof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"enum Lib_OVMCodec.QueueOrigin\",\"name\":\"l1QueueOrigin\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"l1TxOrigin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entrypoint\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.Transaction\",\"name\":\"_transaction\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"isSequenced\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"txData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.TransactionChainElement\",\"name\":\"_txChainElement\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_transactionBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_transactionProof\",\"type\":\"tuple\"}],\"name\":\"initializeFraudVerification\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Fraud Verifier contract coordinates the entire fraud proof verification process. If the fraud proof was successful it prunes any state batches from State Commitment Chain which were published after the fraudulent state root. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_postStateRoot\":\"State root after the fraudulent transaction.\",\"_postStateRootBatchHeader\":\"Batch header for the provided post-state root.\",\"_postStateRootProof\":\"Inclusion proof for the provided post-state root.\",\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_txHash\":\"The transaction for the state root\"}},\"getStateTransitioner(bytes32,bytes32)\":{\"params\":{\"_preStateRoot\":\"State root to query a transitioner for.\"},\"returns\":{\"_transitioner\":\"Corresponding state transitioner contract.\"}},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_preStateRoot\":\"State root before the fraudulent transaction.\",\"_preStateRootBatchHeader\":\"Batch header for the provided pre-state root.\",\"_preStateRootProof\":\"Inclusion proof for the provided pre-state root.\",\"_transaction\":\"OVM transaction claimed to be fraudulent.\",\"_transactionBatchHeader\":\"Batch header for the provided transaction.\",\"_transactionProof\":\"Inclusion proof for the provided transaction.\",\"_txChainElement\":\"OVM transaction chain element.\"}}},\"title\":\"OVM_FraudVerifier\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Finalizes the fraud verification process.\"},\"getStateTransitioner(bytes32,bytes32)\":{\"notice\":\"Retrieves the state transitioner for a given root.\"},\"initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Begins the fraud verification process.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":\"OVM_FraudVerifier\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/// Minimal contract to be inherited by contracts consumed by users that provide\\n/// data for fraud proofs\\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\\n /// Decorate your functions with this modifier to store how much total gas was\\n /// consumed by the sender, to reward users fairly\\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\\n uint256 startGas = gasleft();\\n _;\\n uint256 gasSpent = startGas - gasleft();\\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\\n }\\n}\\n\",\"keccak256\":\"0x6c27d089a297103cb93b30f7649ab68691cc6b948c315f1037e5de1fe9bf5903\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_StateTransitionerFactory } from \\\"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_FraudContributor } from \\\"./Abs_FraudContributor.sol\\\";\\n\\n\\n\\n/**\\n * @title OVM_FraudVerifier\\n * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. \\n * If the fraud proof was successful it prunes any state batches from State Commitment Chain\\n * which were published after the fraudulent state root.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier {\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => iOVM_StateTransitioner) internal transitioners;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n /**\\n * Retrieves the state transitioner for a given root.\\n * @param _preStateRoot State root to query a transitioner for.\\n * @return _transitioner Corresponding state transitioner contract.\\n */\\n function getStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n override\\n public\\n view\\n returns (\\n iOVM_StateTransitioner _transitioner\\n )\\n {\\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\\n }\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n /**\\n * Begins the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _transaction OVM transaction claimed to be fraudulent.\\n * @param _txChainElement OVM transaction chain element.\\n * @param _transactionBatchHeader Batch header for the provided transaction.\\n * @param _transactionProof Inclusion proof for the provided transaction.\\n */\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _transactionProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction))\\n {\\n bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction);\\n\\n if (_hasStateTransitioner(_preStateRoot, _txHash)) {\\n return;\\n }\\n\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\"));\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmCanonicalTransactionChain.verifyTransaction(\\n _transaction,\\n _txChainElement,\\n _transactionBatchHeader,\\n _transactionProof\\n ),\\n \\\"Invalid transaction inclusion proof.\\\"\\n );\\n\\n require (\\n _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index,\\n \\\"Pre-state root global index must equal to the transaction root global index.\\\"\\n );\\n\\n _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);\\n\\n emit FraudProofInitialized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n /**\\n * Finalizes the fraud verification process.\\n * @param _preStateRoot State root before the fraudulent transaction.\\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\\n * @param _txHash The transaction for the state root\\n * @param _postStateRoot State root after the fraudulent transaction.\\n * @param _postStateRootBatchHeader Batch header for the provided post-state root.\\n * @param _postStateRootProof Inclusion proof for the provided post-state root.\\n */\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof\\n )\\n override\\n public\\n contributesToFraudProof(_preStateRoot, _txHash)\\n {\\n iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n require(\\n transitioner.isComplete() == true,\\n \\\"State transition process must be completed prior to finalization.\\\"\\n );\\n\\n require (\\n _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,\\n \\\"Post-state root global index must equal to the pre state root global index plus one.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _preStateRoot,\\n _preStateRootBatchHeader,\\n _preStateRootProof\\n ),\\n \\\"Invalid pre-state root inclusion proof.\\\"\\n );\\n\\n require(\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _postStateRoot,\\n _postStateRootBatchHeader,\\n _postStateRootProof\\n ),\\n \\\"Invalid post-state root inclusion proof.\\\"\\n );\\n\\n // If the post state root did not match, then there was fraud and we should delete the batch\\n require(\\n _postStateRoot != transitioner.getPostStateRoot(),\\n \\\"State transition has not been proven fraudulent.\\\"\\n );\\n \\n _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);\\n\\n // TEMPORARY: Remove the transitioner; for minnet.\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000);\\n\\n emit FraudProofFinalized(\\n _preStateRoot,\\n _preStateRootProof.index,\\n _txHash,\\n msg.sender\\n );\\n }\\n\\n\\n /************************************\\n * Internal Functions: Verification *\\n ************************************/\\n\\n /**\\n * Checks whether a transitioner already exists for a given pre-state root.\\n * @param _preStateRoot Pre-state root to check.\\n * @return _exists Whether or not we already have a transitioner for the root.\\n */\\n function _hasStateTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash\\n )\\n internal\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return address(getStateTransitioner(_preStateRoot, _txHash)) != address(0);\\n }\\n\\n /**\\n * Deploys a new state transitioner.\\n * @param _preStateRoot Pre-state root to initialize the transitioner with.\\n * @param _txHash Hash of the transaction this transitioner will execute.\\n * @param _stateTransitionIndex Index of the transaction in the chain.\\n */\\n function _deployTransitioner(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n uint256 _stateTransitionIndex\\n )\\n internal\\n {\\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitionerFactory(\\n resolve(\\\"OVM_StateTransitionerFactory\\\")\\n ).create(\\n address(libAddressManager),\\n _stateTransitionIndex,\\n _preStateRoot,\\n _txHash\\n );\\n }\\n\\n /**\\n * Removes a state transition from the state commitment chain.\\n * @param _postStateRootBatchHeader Header for the post-state root.\\n * @param _preStateRoot Pre-state root hash.\\n */\\n function _cancelStateTransition(\\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\\n bytes32 _preStateRoot\\n )\\n internal\\n {\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\\\"OVM_BondManager\\\"));\\n\\n // Delete the state batch.\\n ovmStateCommitmentChain.deleteStateBatch(\\n _postStateRootBatchHeader\\n );\\n\\n // Get the timestamp and publisher for that block.\\n (uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));\\n\\n // Slash the bonds at the bond manager.\\n ovmBondManager.finalize(\\n _preStateRoot,\\n publisher,\\n timestamp\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfc15adfd74295cc85f1aa3e69838f320d90bf036b31af8a75717e22033f3f3f1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitionerFactory\\n */\\ninterface iOVM_StateTransitionerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _proxyManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n external\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n );\\n}\\n\",\"keccak256\":\"0x60a0f0c104e4c0c7863268a93005762e8146d393f9cfddfdd6a2d6585c5911fc\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5060405161181238038061181283398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b611781806100916000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063461a44781461005157806398d8867d1461007a578063a286ba1c1461008f578063b48ec820146100a2575b600080fd5b61006461005f3660046110d2565b6100b5565b60405161007191906112d7565b60405180910390f35b61008d610088366004610ffa565b610193565b005b61008d61009d366004610f35565b6104d2565b6100646100b0366004610f14565b61088c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561015f57600080fd5b505afa158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b505190505b919050565b8661019d856108db565b60005a905060006101ad886108db565b90506101b98b826108f4565b156101c45750610410565b60006101ff6040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006102416040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100b5565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161027393929190611330565b60206040518083038186803b15801561028b57600080fd5b505afa15801561029f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c39190610ee0565b6102e85760405162461bcd60e51b81526004016102df906115b8565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061031a908d908d908d908d90600401611612565b60206040518083038186803b15801561033257600080fd5b505afa158015610346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036a9190610ee0565b6103865760405162461bcd60e51b81526004016102df9061146a565b86600001518860600151018b600001518d6060015101600101146103bc5760405162461bcd60e51b81526004016102df906114f6565b6103cb8d848d60000151610913565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104049493929190611365565b60405180910390a15050505b60005a820390506104476040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104ad57600080fd5b505af11580156104c1573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006104e58b8961088c565b905060006105226040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006105566040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b9050826001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059157600080fd5b505afa1580156105a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c99190610ee0565b15156001146105ea5760405162461bcd60e51b81526004016102df90611389565b8a600001518c60600151016001018760000151896060015101146106205760405162461bcd60e51b81526004016102df906113f0565b816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161065093929190611330565b60206040518083038186803b15801561066857600080fd5b505afa15801561067c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a09190610ee0565b6106bc5760405162461bcd60e51b81526004016102df906115b8565b604051634d69ee5760e01b81526001600160a01b03831690634d69ee57906106ec908c908c908c90600401611330565b60206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073c9190610ee0565b6107585760405162461bcd60e51b81526004016102df906114ae565b826001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190610efc565b8914156107e85760405162461bcd60e51b81526004016102df90611568565b6107f2888e610a3e565b6000600160008f8d60405160200161080b92919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18d8c600001518c336040516104049493929190611365565b60006001600084846040516020016108a592919061125a565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b60006108e682610b98565b805190602001209050919050565b600080610901848461088c565b6001600160a01b031614159392505050565b6109516040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100b5565b600054604051631168a38160e11b81526001600160a01b03928316926322d1470292610988929116908590889088906004016112eb565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da91906110b6565b6001600085856040516020016109f192919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610a796040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b90506000610aad6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610adc9087906004016115ff565b600060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b299190611120565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b5e90889085908790600401611311565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610bd39796959493929190611268565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610bfd57fe5b610c10601f8401601f19166020016116d1565b9050828152838383011115610c2457600080fd5b828260208301376000602084830101529392505050565b803561018e81611725565b600082601f830112610c56578081fd5b610c6583833560208501610be9565b9392505050565b80356002811061018e57600080fd5b600060a08284031215610c8c578081fd5b60405160a0810167ffffffffffffffff8282108183111715610caa57fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b50610cf485828601610c46565b6080830152505092915050565b600060408284031215610d12578081fd5b6040516040810167ffffffffffffffff8282108183111715610d3057fe5b8160405282935084358352602091508185013581811115610d5057600080fd5b8501601f81018713610d6157600080fd5b803582811115610d6d57fe5b8381029250610d7d8484016116d1565b8181528481019083860185850187018b1015610d9857600080fd5b600095505b83861015610dbb578035835260019590950194918601918601610d9d565b5080868801525050505050505092915050565b600060a08284031215610ddf578081fd5b60405160a0810167ffffffffffffffff8282108183111715610dfd57fe5b8160405282935084359150610e118261173d565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b600060e08284031215610e57578081fd5b610e6160e06116d1565b90508135815260208201356020820152610e7d60408301610c6c565b6040820152610e8e60608301610c3b565b6060820152610e9f60808301610c3b565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ec857600080fd5b610ed484828501610c46565b60c08301525092915050565b600060208284031215610ef1578081fd5b8151610c658161173d565b600060208284031215610f0d578081fd5b5051919050565b60008060408385031215610f26578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f4f578283fd5b87359650602088013567ffffffffffffffff80821115610f6d578485fd5b610f798b838c01610c7b565b975060408a0135915080821115610f8e578485fd5b610f9a8b838c01610d01565b965060608a0135955060808a0135945060a08a0135915080821115610fbd578384fd5b610fc98b838c01610c7b565b935060c08a0135915080821115610fde578283fd5b50610feb8a828b01610d01565b91505092959891949750929550565b600080600080600080600060e0888a031215611014578081fd5b87359650602088013567ffffffffffffffff80821115611032578283fd5b61103e8b838c01610c7b565b975060408a0135915080821115611053578283fd5b61105f8b838c01610d01565b965060608a0135915080821115611074578283fd5b6110808b838c01610e46565b955060808a0135915080821115611095578283fd5b6110a18b838c01610dce565b945060a08a0135915080821115610fbd578283fd5b6000602082840312156110c7578081fd5b8151610c6581611725565b6000602082840312156110e3578081fd5b813567ffffffffffffffff8111156110f9578182fd5b8201601f81018413611109578182fd5b61111884823560208401610be9565b949350505050565b60008060408385031215611132578182fd5b82519150602083015161114481611725565b809150509250929050565b6001600160a01b03169052565b600081518084526111748160208601602086016116f5565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561121057845182529383019360019290920191908301906111f0565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b918252602082015260400190565b60008882528760208301526002871061127d57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112c48160898501602087016116f5565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b6000848252606060208301526113496060830185611188565b828103604084015261135b81856111c5565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c656020830184611188565b60006080825285516080830152602086015160a083015260408601516002811061163857fe5b60c083015260608601516001600160a01b031660e0830152608086015161166361010084018261114f565b5060a086015161012083015260c086015160e061014084015261168a61016084018261115c565b9050828103602084015261169e818761121b565b905082810360408401526116b28186611188565b905082810360608401526116c681856111c5565b979650505050505050565b60405181810167ffffffffffffffff811182821017156116ed57fe5b604052919050565b60005b838110156117105781810151838201526020016116f8565b8381111561171f576000848401525b50505050565b6001600160a01b038116811461173a57600080fd5b50565b801515811461173a57600080fdfea2646970667358221220d5dc2a42c875765178976d1988d00ffd806a5dd5d5e646dcec12318b4b29b42564736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063461a44781461005157806398d8867d1461007a578063a286ba1c1461008f578063b48ec820146100a2575b600080fd5b61006461005f3660046110d2565b6100b5565b60405161007191906112d7565b60405180910390f35b61008d610088366004610ffa565b610193565b005b61008d61009d366004610f35565b6104d2565b6100646100b0366004610f14565b61088c565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561015f57600080fd5b505afa158015610173573d6000803e3d6000fd5b505050506040513d602081101561018957600080fd5b505190505b919050565b8661019d856108db565b60005a905060006101ad886108db565b90506101b98b826108f4565b156101c45750610410565b60006101ff6040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006102416040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e0000008152506100b5565b9050816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161027393929190611330565b60206040518083038186803b15801561028b57600080fd5b505afa15801561029f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c39190610ee0565b6102e85760405162461bcd60e51b81526004016102df906115b8565b60405180910390fd5b6040516326f2b4e760e11b81526001600160a01b03821690634de569ce9061031a908d908d908d908d90600401611612565b60206040518083038186803b15801561033257600080fd5b505afa158015610346573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036a9190610ee0565b6103865760405162461bcd60e51b81526004016102df9061146a565b86600001518860600151018b600001518d6060015101600101146103bc5760405162461bcd60e51b81526004016102df906114f6565b6103cb8d848d60000151610913565b7f41a48bde2468fac6f670f39b66d7b91f311053e1f28eab9d75056546e6eaac958d8c6000015185336040516104049493929190611365565b60405180910390a15050505b60005a820390506104476040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b1580156104ad57600080fd5b505af11580156104c1573d6000803e3d6000fd5b505050505050505050505050505050565b868460005a905060006104e58b8961088c565b905060006105226040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b905060006105566040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b9050826001600160a01b031663b2fa1c9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059157600080fd5b505afa1580156105a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c99190610ee0565b15156001146105ea5760405162461bcd60e51b81526004016102df90611389565b8a600001518c60600151016001018760000151896060015101146106205760405162461bcd60e51b81526004016102df906113f0565b816001600160a01b0316634d69ee578e8e8e6040518463ffffffff1660e01b815260040161065093929190611330565b60206040518083038186803b15801561066857600080fd5b505afa15801561067c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a09190610ee0565b6106bc5760405162461bcd60e51b81526004016102df906115b8565b604051634d69ee5760e01b81526001600160a01b03831690634d69ee57906106ec908c908c908c90600401611330565b60206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073c9190610ee0565b6107585760405162461bcd60e51b81526004016102df906114ae565b826001600160a01b031663c1c618b86040518163ffffffff1660e01b815260040160206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c99190610efc565b8914156107e85760405162461bcd60e51b81526004016102df90611568565b6107f2888e610a3e565b6000600160008f8d60405160200161080b92919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f1e5fff3c23daf51ea67aaa3bbc738bcedaa98be5a5503f0e63a336a004b075b18d8c600001518c336040516104049493929190611365565b60006001600084846040516020016108a592919061125a565b60408051808303601f19018152918152815160209283012083529082019290925201600020546001600160a01b03169392505050565b60006108e682610b98565b805190602001209050919050565b600080610901848461088c565b6001600160a01b031614159392505050565b6109516040518060400160405280601c81526020017f4f564d5f53746174655472616e736974696f6e6572466163746f7279000000008152506100b5565b600054604051631168a38160e11b81526001600160a01b03928316926322d1470292610988929116908590889088906004016112eb565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da91906110b6565b6001600085856040516020016109f192919061125a565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000610a796040518060400160405280601881526020017727ab26afa9ba30ba32a1b7b6b6b4ba36b2b73a21b430b4b760411b8152506100b5565b90506000610aad6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b8152506100b5565b604051632e38626b60e21b81529091506001600160a01b0383169063b8e189ac90610adc9087906004016115ff565b600060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506000808560800151806020019051810190610b299190611120565b60405163abfbbe1360e01b815291935091506001600160a01b0384169063abfbbe1390610b5e90889085908790600401611311565b600060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b50505050505050505050565b6060816000015182602001518360400151846060015185608001518660a001518760c00151604051602001610bd39796959493929190611268565b6040516020818303038152906040529050919050565b600067ffffffffffffffff831115610bfd57fe5b610c10601f8401601f19166020016116d1565b9050828152838383011115610c2457600080fd5b828260208301376000602084830101529392505050565b803561018e81611725565b600082601f830112610c56578081fd5b610c6583833560208501610be9565b9392505050565b80356002811061018e57600080fd5b600060a08284031215610c8c578081fd5b60405160a0810167ffffffffffffffff8282108183111715610caa57fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b50610cf485828601610c46565b6080830152505092915050565b600060408284031215610d12578081fd5b6040516040810167ffffffffffffffff8282108183111715610d3057fe5b8160405282935084358352602091508185013581811115610d5057600080fd5b8501601f81018713610d6157600080fd5b803582811115610d6d57fe5b8381029250610d7d8484016116d1565b8181528481019083860185850187018b1015610d9857600080fd5b600095505b83861015610dbb578035835260019590950194918601918601610d9d565b5080868801525050505050505092915050565b600060a08284031215610ddf578081fd5b60405160a0810167ffffffffffffffff8282108183111715610dfd57fe5b8160405282935084359150610e118261173d565b8183526020850135602084015260408501356040840152606085013560608401526080850135915080821115610ce757600080fd5b600060e08284031215610e57578081fd5b610e6160e06116d1565b90508135815260208201356020820152610e7d60408301610c6c565b6040820152610e8e60608301610c3b565b6060820152610e9f60808301610c3b565b608082015260a082013560a082015260c082013567ffffffffffffffff811115610ec857600080fd5b610ed484828501610c46565b60c08301525092915050565b600060208284031215610ef1578081fd5b8151610c658161173d565b600060208284031215610f0d578081fd5b5051919050565b60008060408385031215610f26578081fd5b50508035926020909101359150565b600080600080600080600060e0888a031215610f4f578283fd5b87359650602088013567ffffffffffffffff80821115610f6d578485fd5b610f798b838c01610c7b565b975060408a0135915080821115610f8e578485fd5b610f9a8b838c01610d01565b965060608a0135955060808a0135945060a08a0135915080821115610fbd578384fd5b610fc98b838c01610c7b565b935060c08a0135915080821115610fde578283fd5b50610feb8a828b01610d01565b91505092959891949750929550565b600080600080600080600060e0888a031215611014578081fd5b87359650602088013567ffffffffffffffff80821115611032578283fd5b61103e8b838c01610c7b565b975060408a0135915080821115611053578283fd5b61105f8b838c01610d01565b965060608a0135915080821115611074578283fd5b6110808b838c01610e46565b955060808a0135915080821115611095578283fd5b6110a18b838c01610dce565b945060a08a0135915080821115610fbd578283fd5b6000602082840312156110c7578081fd5b8151610c6581611725565b6000602082840312156110e3578081fd5b813567ffffffffffffffff8111156110f9578182fd5b8201601f81018413611109578182fd5b61111884823560208401610be9565b949350505050565b60008060408385031215611132578182fd5b82519150602083015161114481611725565b809150509250929050565b6001600160a01b03169052565b600081518084526111748160208601602086016116f5565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b8083101561121057845182529383019360019290920191908301906111f0565b509695505050505050565b6000815115158352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261111860a085018261115c565b918252602082015260400190565b60008882528760208301526002871061127d57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b1660558401525083606983015282516112c48160898501602087016116f5565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b9283526001600160a01b03919091166020830152604082015260600190565b6000848252606060208301526113496060830185611188565b828103604084015261135b81856111c5565b9695505050505050565b938452602084019290925260408301526001600160a01b0316606082015260800190565b60208082526041908201527f5374617465207472616e736974696f6e2070726f63657373206d75737420626560408201527f20636f6d706c65746564207072696f7220746f2066696e616c697a6174696f6e6060820152601760f91b608082015260a00190565b60208082526054908201527f506f73742d737461746520726f6f7420676c6f62616c20696e646578206d757360408201527f7420657175616c20746f207468652070726520737461746520726f6f7420676c60608201527337b130b61034b73232bc1038363ab99037b7329760611b608082015260a00190565b60208082526024908201527f496e76616c6964207472616e73616374696f6e20696e636c7573696f6e20707260408201526337b7b31760e11b606082015260800190565b60208082526028908201527f496e76616c696420706f73742d737461746520726f6f7420696e636c7573696f6040820152673710383937b7b31760c11b606082015260800190565b6020808252604c908201527f5072652d737461746520726f6f7420676c6f62616c20696e646578206d75737460408201527f20657175616c20746f20746865207472616e73616374696f6e20726f6f74206760608201526b3637b130b61034b73232bc1760a11b608082015260a00190565b60208082526030908201527f5374617465207472616e736974696f6e20686173206e6f74206265656e20707260408201526f37bb32b710333930bab23ab632b73a1760811b606082015260800190565b60208082526027908201527f496e76616c6964207072652d737461746520726f6f7420696e636c7573696f6e60408201526610383937b7b31760c91b606082015260800190565b600060208252610c656020830184611188565b60006080825285516080830152602086015160a083015260408601516002811061163857fe5b60c083015260608601516001600160a01b031660e0830152608086015161166361010084018261114f565b5060a086015161012083015260c086015160e061014084015261168a61016084018261115c565b9050828103602084015261169e818761121b565b905082810360408401526116b28186611188565b905082810360608401526116c681856111c5565b979650505050505050565b60405181810167ffffffffffffffff811182821017156116ed57fe5b604052919050565b60005b838110156117105781810151838201526020016116f8565b8381111561171f576000848401525b50505050565b6001600160a01b038116811461173a57600080fd5b50565b801515811461173a57600080fdfea2646970667358221220d5dc2a42c875765178976d1988d00ffd806a5dd5d5e646dcec12318b4b29b42564736f6c63430007060033", - "devdoc": { - "details": "The Fraud Verifier contract coordinates the entire fraud proof verification process. If the fraud proof was successful it prunes any state batches from State Commitment Chain which were published after the fraudulent state root. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager." - } - }, - "finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "params": { - "_postStateRoot": "State root after the fraudulent transaction.", - "_postStateRootBatchHeader": "Batch header for the provided post-state root.", - "_postStateRootProof": "Inclusion proof for the provided post-state root.", - "_preStateRoot": "State root before the fraudulent transaction.", - "_preStateRootBatchHeader": "Batch header for the provided pre-state root.", - "_preStateRootProof": "Inclusion proof for the provided pre-state root.", - "_txHash": "The transaction for the state root" - } - }, - "getStateTransitioner(bytes32,bytes32)": { - "params": { - "_preStateRoot": "State root to query a transitioner for." - }, - "returns": { - "_transitioner": "Corresponding state transitioner contract." - } - }, - "initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "params": { - "_preStateRoot": "State root before the fraudulent transaction.", - "_preStateRootBatchHeader": "Batch header for the provided pre-state root.", - "_preStateRootProof": "Inclusion proof for the provided pre-state root.", - "_transaction": "OVM transaction claimed to be fraudulent.", - "_transactionBatchHeader": "Batch header for the provided transaction.", - "_transactionProof": "Inclusion proof for the provided transaction.", - "_txChainElement": "OVM transaction chain element." - } - } - }, - "title": "OVM_FraudVerifier", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "finalizeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes32,bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "notice": "Finalizes the fraud verification process." - }, - "getStateTransitioner(bytes32,bytes32)": { - "notice": "Retrieves the state transitioner for a given root." - }, - "initializeFraudVerification(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),(uint256,uint256,uint8,address,address,uint256,bytes),(bool,uint256,uint256,uint256,bytes),(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "notice": "Begins the fraud verification process." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 8900, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol:OVM_FraudVerifier", - "label": "transitioners", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11498)" - } - ], - "types": { - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_contract(iOVM_StateTransitioner)11498": { - "encoding": "inplace", - "label": "contract iOVM_StateTransitioner", - "numberOfBytes": "20" - }, - "t_mapping(t_bytes32,t_contract(iOVM_StateTransitioner)11498)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => contract iOVM_StateTransitioner)", - "numberOfBytes": "32", - "value": "t_contract(iOVM_StateTransitioner)11498" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_L1CrossDomainMessenger.json b/deployments/kovan/OVM_L1CrossDomainMessenger.json deleted file mode 100644 index a8b4714ee..000000000 --- a/deployments/kovan/OVM_L1CrossDomainMessenger.json +++ /dev/null @@ -1,477 +0,0 @@ -{ - "address": "0xc30275BE689A1Abd45640f321D18f5D8Ded15052", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - } - ], - "name": "RelayedMessage", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "message", - "type": "bytes" - } - ], - "name": "SentMessage", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "messageNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_message", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_messageNonce", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "stateRootBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "stateRootProof", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "stateTrieWitness", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "storageTrieWitness", - "type": "bytes" - } - ], - "internalType": "struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof", - "name": "_proof", - "type": "tuple" - } - ], - "name": "relayMessage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "relayedMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_message", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_messageNonce", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "_gasLimit", - "type": "uint32" - } - ], - "name": "replayMessage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_target", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_message", - "type": "bytes" - }, - { - "internalType": "uint32", - "name": "_gasLimit", - "type": "uint32" - } - ], - "name": "sendMessage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "sentMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "successfulMessages", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "xDomainMessageSender", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x987c4f8715b887d9129b8ad41c33a50f1e346e4d29d829e1a65be1158952f8cb", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xc30275BE689A1Abd45640f321D18f5D8Ded15052", - "transactionIndex": 3, - "gasUsed": "2162484", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6fa6b9386a73f5d9b4217d446811e088987aec015ea34492ae680a074fd95084", - "transactionHash": "0x987c4f8715b887d9129b8ad41c33a50f1e346e4d29d829e1a65be1158952f8cb", - "logs": [], - "blockNumber": 23637126, - "cumulativeGasUsed": "2390808", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"RelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SentMessage\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_messageNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"stateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"stateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"stateTrieWitness\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"storageTrieWitness\",\"type\":\"bytes\"}],\"internalType\":\"struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_messageNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\"}],\"name\":\"replayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"sentMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted via this contract's replay function. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"initialize(address)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))\":{\"params\":{\"_message\":\"Message to send to the target.\",\"_messageNonce\":\"Nonce for the provided message.\",\"_proof\":\"Inclusion proof for the given message.\",\"_sender\":\"Message sender address.\",\"_target\":\"Target contract address.\"}},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_messageNonce\":\"Nonce for the provided message.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}}},\"title\":\"OVM_L1CrossDomainMessenger\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"constructor\":{\"notice\":\"Pass a default zero address to the address resolver. This will be updated when initialized.\"},\"relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))\":{\"notice\":\"Relays a cross domain message to a contract.\"},\"replayMessage(address,address,bytes,uint256,uint32)\":{\"notice\":\"Replays a cross domain message to the target messenger.\"},\"sendMessage(address,bytes,uint32)\":{\"notice\":\"Sends a cross domain message to the target messenger.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol\":\"OVM_L1CrossDomainMessenger\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/Abs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/* Library Imports */\\nimport { Lib_ReentrancyGuard } from \\\"../../../libraries/utils/Lib_ReentrancyGuard.sol\\\";\\n\\n/**\\n * @title Abs_BaseCrossDomainMessenger\\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common functionality used in the\\n * L1 and L2 Cross Domain Messengers. It can also serve as a template for developers wishing to implement a custom bridge \\n * contract to suit their needs.\\n *\\n * Compiler used: defined by child contract\\n * Runtime target: defined by child contract\\n */\\nabstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger, Lib_ReentrancyGuard {\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping (bytes32 => bool) public relayedMessages;\\n mapping (bytes32 => bool) public successfulMessages;\\n mapping (bytes32 => bool) public sentMessages;\\n uint256 public messageNonce;\\n address override public xDomainMessageSender;\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n constructor() Lib_ReentrancyGuard() internal {}\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes memory _message,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n messageNonce\\n );\\n\\n messageNonce += 1;\\n sentMessages[keccak256(xDomainCalldata)] = true;\\n\\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\\n emit SentMessage(xDomainCalldata);\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Generates the correct cross domain calldata for a message.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @return ABI encoded cross domain calldata.\\n */\\n function _getXDomainCalldata(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return abi.encodeWithSignature(\\n \\\"relayMessage(address,address,bytes,uint256)\\\",\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n }\\n\\n /**\\n * Sends a cross domain message.\\n * @param _message Message to send.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function _sendXDomainMessage(\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n virtual\\n internal\\n {\\n revert(\\\"Implement me in child contracts!\\\");\\n }\\n}\\n\",\"keccak256\":\"0xe43b0d2d0b52d565871388e859a719ac5f80cd8c15e35fa6770019100942b83a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_ReentrancyGuard } from \\\"../../../libraries/utils/Lib_ReentrancyGuard.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_BaseCrossDomainMessenger } from \\\"./Abs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title OVM_L1CrossDomainMessenger\\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. \\n * In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted \\n * via this contract's replay function. \\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * Pass a default zero address to the address resolver. This will be updated when initialized.\\n */\\n constructor()\\n public\\n Lib_AddressResolver(address(0))\\n {}\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n function initialize(\\n address _libAddressManager\\n )\\n public\\n {\\n require(address(libAddressManager) == address(0), \\\"L1CrossDomainMessenger already intialized.\\\");\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may successfully call a method.\\n */\\n modifier onlyRelayer() {\\n address relayer = resolve(\\\"OVM_L2MessageRelayer\\\");\\n if (relayer != address(0)) {\\n require(\\n msg.sender == relayer,\\n \\\"Only OVM_L2MessageRelayer can relay L2-to-L1 messages.\\\"\\n );\\n }\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @inheritdoc iOVM_L1CrossDomainMessenger\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n )\\n override\\n public\\n nonReentrant\\n onlyRelayer()\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n\\n require(\\n _verifyXDomainMessage(\\n xDomainCalldata,\\n _proof\\n ) == true,\\n \\\"Provided message could not be verified.\\\"\\n );\\n\\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\\n\\n require(\\n successfulMessages[xDomainCalldataHash] == false,\\n \\\"Provided message has already been received.\\\"\\n );\\n\\n xDomainMessageSender = _sender;\\n (bool success, ) = _target.call(_message);\\n\\n // Mark the message as received if the call was successful. Ensures that a message can be\\n // relayed multiple times in the case that the call reverted.\\n if (success == true) {\\n successfulMessages[xDomainCalldataHash] = true;\\n emit RelayedMessage(xDomainCalldataHash);\\n }\\n\\n // Store an identifier that can be used to prove that the given message was relayed by some\\n // user. Gives us an easy way to pay relayers for their work.\\n bytes32 relayId = keccak256(\\n abi.encodePacked(\\n xDomainCalldata,\\n msg.sender,\\n block.number\\n )\\n );\\n relayedMessages[relayId] = true;\\n }\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @inheritdoc iOVM_L1CrossDomainMessenger\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n )\\n override\\n public\\n {\\n bytes memory xDomainCalldata = _getXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n\\n require(\\n sentMessages[keccak256(xDomainCalldata)] == true,\\n \\\"Provided message has not already been sent.\\\"\\n );\\n\\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Verifies that the given message is valid.\\n * @param _xDomainCalldata Calldata to verify.\\n * @param _proof Inclusion proof for the message.\\n * @return Whether or not the provided message is valid.\\n */\\n function _verifyXDomainMessage(\\n bytes memory _xDomainCalldata,\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n return (\\n _verifyStateRootProof(_proof)\\n && _verifyStorageProof(_xDomainCalldata, _proof)\\n );\\n }\\n\\n /**\\n * Verifies that the state root within an inclusion proof is valid.\\n * @param _proof Message inclusion proof.\\n * @return Whether or not the provided proof is valid.\\n */\\n function _verifyStateRootProof(\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\\\"OVM_StateCommitmentChain\\\"));\\n\\n return (\\n ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) == false\\n && ovmStateCommitmentChain.verifyStateCommitment(\\n _proof.stateRoot,\\n _proof.stateRootBatchHeader,\\n _proof.stateRootProof\\n )\\n );\\n }\\n\\n /**\\n * Verifies that the storage proof within an inclusion proof is valid.\\n * @param _xDomainCalldata Encoded message calldata.\\n * @param _proof Message inclusion proof.\\n * @return Whether or not the provided proof is valid.\\n */\\n function _verifyStorageProof(\\n bytes memory _xDomainCalldata,\\n L2MessageInclusionProof memory _proof\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 storageKey = keccak256(\\n abi.encodePacked(\\n keccak256(\\n abi.encodePacked(\\n _xDomainCalldata,\\n resolve(\\\"OVM_L2CrossDomainMessenger\\\")\\n )\\n ),\\n uint256(0)\\n )\\n );\\n\\n (\\n bool exists,\\n bytes memory encodedMessagePassingAccount\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(0x4200000000000000000000000000000000000000),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing precompile has not been initialized or invalid proof provided.\\\"\\n );\\n\\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\\n encodedMessagePassingAccount\\n );\\n\\n return Lib_SecureMerkleTrie.verifyInclusionProof(\\n abi.encodePacked(storageKey),\\n abi.encodePacked(uint8(1)),\\n _proof.storageTrieWitness,\\n account.storageRoot\\n );\\n }\\n\\n /**\\n * Sends a cross domain message.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n bytes memory _message,\\n uint256 _gasLimit\\n )\\n override\\n internal\\n {\\n iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\")).enqueue(\\n resolve(\\\"OVM_L2CrossDomainMessenger\\\"),\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x2672850c45003fba9b64b6b4adedec848b4540a7e87c00785fbb3f6d03c7dcbd\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iAbs_BaseCrossDomainMessenger\\n */\\ninterface iAbs_BaseCrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xc2bd6b373daae2ede34281f4be5938d02b9d1cfb056b40d65ff70b7f16ce3c86\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"./iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n struct L2MessageInclusionProof {\\n bytes32 stateRoot;\\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\\n bytes stateTrieWitness;\\n bytes storageTrieWitness;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _proof Inclusion proof for the given message.\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) external;\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _sender Original sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xdcd239d0b215e400674d78e8db4ac12ba18efc34fa78e24c2ff867f61062dba2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\n\\n/**\\n * @title Lib_MerkleTrie\\n */\\nlibrary Lib_MerkleTrie {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum NodeType {\\n BranchNode,\\n ExtensionNode,\\n LeafNode\\n }\\n\\n struct TrieNode {\\n bytes encoded;\\n Lib_RLPReader.RLPItem[] decoded;\\n }\\n\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n // TREE_RADIX determines the number of elements per branch node.\\n uint256 constant TREE_RADIX = 16;\\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\\n\\n // Prefixes are prepended to the `path` within a leaf or extension node and\\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\\n // determined by the number of nibbles within the unprefixed `path`. If the\\n // number of nibbles if even, we need to insert an extra padding nibble so\\n // the resulting prefixed `path` has an even number of nibbles.\\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\\n uint8 constant PREFIX_EXTENSION_ODD = 1;\\n uint8 constant PREFIX_LEAF_EVEN = 2;\\n uint8 constant PREFIX_LEAF_ODD = 3;\\n\\n // Just a utility constant. RLP represents `NULL` as 0x80.\\n bytes1 constant RLP_NULL = bytes1(0x80);\\n bytes constant RLP_NULL_BYTES = hex'80';\\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n bytes memory value\\n ) = get(_key, _proof, _root);\\n\\n return (\\n exists && Lib_BytesUtils.equal(_value, value)\\n );\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n ) = get(_key, _proof, _root);\\n\\n return exists == false;\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n // Special case when inserting the very first node.\\n if (_root == KECCAK256_RLP_NULL_BYTES) {\\n return getSingleNodeRootHash(_key, _value);\\n }\\n\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\\n\\n return _getUpdatedTrieRoot(newPath, _key);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\\n\\n bool exists = keyRemainder.length == 0;\\n\\n require(\\n exists || isFinalNode,\\n \\\"Provided proof is invalid.\\\"\\n );\\n\\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\\n\\n return (\\n exists,\\n value\\n );\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n return keccak256(_makeLeafNode(\\n Lib_BytesUtils.toNibbles(_key),\\n _value\\n ).encoded);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * @notice Walks through a proof using a provided key.\\n * @param _proof Inclusion proof to walk through.\\n * @param _key Key to use for the walk.\\n * @param _root Known root of the trie.\\n * @return _pathLength Length of the final path\\n * @return _keyRemainder Portion of the key remaining after the walk.\\n * @return _isFinalNode Whether or not we've hit a dead end.\\n */\\n function _walkNodePath(\\n TrieNode[] memory _proof,\\n bytes memory _key,\\n bytes32 _root\\n )\\n private\\n pure\\n returns (\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bool _isFinalNode\\n )\\n {\\n uint256 pathLength = 0;\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n bytes32 currentNodeID = _root;\\n uint256 currentKeyIndex = 0;\\n uint256 currentKeyIncrement = 0;\\n TrieNode memory currentNode;\\n\\n // Proof is top-down, so we start at the first element (root).\\n for (uint256 i = 0; i < _proof.length; i++) {\\n currentNode = _proof[i];\\n currentKeyIndex += currentKeyIncrement;\\n\\n // Keep track of the proof elements we actually need.\\n // It's expensive to resize arrays, so this simply reduces gas costs.\\n pathLength += 1;\\n\\n if (currentKeyIndex == 0) {\\n // First proof element is always the root node.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid root hash\\\"\\n );\\n } else if (currentNode.encoded.length >= 32) {\\n // Nodes 32 bytes or larger are hashed inside branch nodes.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid large internal hash\\\"\\n );\\n } else {\\n // Nodes smaller than 31 bytes aren't hashed.\\n require(\\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\\n \\\"Invalid internal node hash\\\"\\n );\\n }\\n\\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\\n if (currentKeyIndex == key.length) {\\n // We've hit the end of the key, meaning the value should be within this branch node.\\n break;\\n } else {\\n // We're not at the end of the key yet.\\n // Figure out what the next node ID should be and continue.\\n uint8 branchKey = uint8(key[currentKeyIndex]);\\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\\n currentNodeID = _getNodeID(nextNode);\\n currentKeyIncrement = 1;\\n continue;\\n }\\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(currentNode);\\n uint8 prefix = uint8(path[0]);\\n uint8 offset = 2 - prefix % 2;\\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n if (\\n pathRemainder.length == sharedNibbleLength &&\\n keyRemainder.length == sharedNibbleLength\\n ) {\\n // The key within this leaf matches our key exactly.\\n // Increment the key index to reflect that we have no remainder.\\n currentKeyIndex += sharedNibbleLength;\\n }\\n\\n // We've hit a leaf node, so our next node should be NULL.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n if (sharedNibbleLength == 0) {\\n // Our extension node doesn't share any part of our key.\\n // We've hit the end of this path, updates will need to modify this extension.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else {\\n // Our extension shares some nibbles.\\n // Carry on to the next node.\\n currentNodeID = _getNodeID(currentNode.decoded[1]);\\n currentKeyIncrement = sharedNibbleLength;\\n continue;\\n }\\n } else {\\n revert(\\\"Received a node with an unknown prefix\\\");\\n }\\n } else {\\n revert(\\\"Received an unparseable node.\\\");\\n }\\n }\\n\\n // If our node ID is NULL, then we're at a dead end.\\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\\n }\\n\\n /**\\n * @notice Creates new nodes to support a k/v pair insertion into a given\\n * Merkle trie path.\\n * @param _path Path to the node nearest the k/v pair.\\n * @param _pathLength Length of the path. Necessary because the provided\\n * path may include additional nodes (e.g., it comes directly from a proof)\\n * and we can't resize in-memory arrays without costly duplication.\\n * @param _keyRemainder Portion of the initial key that must be inserted\\n * into the trie.\\n * @param _value Value to insert at the given key.\\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\\n */\\n function _getNewPath(\\n TrieNode[] memory _path,\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _newPath\\n )\\n {\\n bytes memory keyRemainder = _keyRemainder;\\n\\n // Most of our logic depends on the status of the last node in the path.\\n TrieNode memory lastNode = _path[_pathLength - 1];\\n NodeType lastNodeType = _getNodeType(lastNode);\\n\\n // Create an array for newly created nodes.\\n // We need up to three new nodes, depending on the contents of the last node.\\n // Since array resizing is expensive, we'll keep track of the size manually.\\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\\n TrieNode[] memory newNodes = new TrieNode[](3);\\n uint256 totalNewNodes = 0;\\n\\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\\n // We've found a leaf node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\\n totalNewNodes += 1;\\n } else if (lastNodeType == NodeType.BranchNode) {\\n if (keyRemainder.length == 0) {\\n // We've found a branch node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\\n totalNewNodes += 1;\\n } else {\\n // We've found a branch node, but it doesn't contain our key.\\n // Reinsert the old branch for now.\\n newNodes[totalNewNodes] = lastNode;\\n totalNewNodes += 1;\\n // Create a new leaf node, slicing our remainder since the first byte points\\n // to our branch node.\\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\\n totalNewNodes += 1;\\n }\\n } else {\\n // Our last node is either an extension node or a leaf node with a different key.\\n bytes memory lastNodeKey = _getNodeKey(lastNode);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\\n\\n if (sharedNibbleLength != 0) {\\n // We've got some shared nibbles between the last node and our key remainder.\\n // We'll need to insert an extension node that covers these shared nibbles.\\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\\n totalNewNodes += 1;\\n\\n // Cut down the keys since we've just covered these shared nibbles.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\\n }\\n\\n // Create an empty branch to fill in.\\n TrieNode memory newBranch = _makeEmptyBranchNode();\\n\\n if (lastNodeKey.length == 0) {\\n // Key remainder was larger than the key for our last node.\\n // The value within our last node is therefore going to be shifted into\\n // a branch value slot.\\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\\n } else {\\n // Last node key was larger than the key remainder.\\n // We're going to modify some index of our branch.\\n uint8 branchKey = uint8(lastNodeKey[0]);\\n // Move on to the next nibble.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\\n\\n if (lastNodeType == NodeType.LeafNode) {\\n // We're dealing with a leaf node.\\n // We'll modify the key and insert the old leaf node into the branch index.\\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else if (lastNodeKey.length != 0) {\\n // We're dealing with a shrinking extension node.\\n // We need to modify the node to decrease the size of the key.\\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else {\\n // We're dealing with an unnecessary extension node.\\n // We're going to delete the node entirely.\\n // Simply insert its current value into the branch index.\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\\n }\\n }\\n\\n if (keyRemainder.length == 0) {\\n // We've got nothing left in the key remainder.\\n // Simply insert the value into the branch value slot.\\n newBranch = _editBranchValue(newBranch, _value);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n } else {\\n // We've got some key remainder to work with.\\n // We'll be inserting a leaf node into the trie.\\n // First, move on to the next nibble.\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n // Push a new leaf node for our k/v pair.\\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\\n totalNewNodes += 1;\\n }\\n }\\n\\n // Finally, join the old path with our newly created nodes.\\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\\n }\\n\\n /**\\n * @notice Computes the trie root from a given path.\\n * @param _nodes Path to some k/v pair.\\n * @param _key Key for the k/v pair.\\n * @return _updatedRoot Root hash for the updated trie.\\n */\\n function _getUpdatedTrieRoot(\\n TrieNode[] memory _nodes,\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n // Some variables to keep track of during iteration.\\n TrieNode memory currentNode;\\n NodeType currentNodeType;\\n bytes memory previousNodeHash;\\n\\n // Run through the path backwards to rebuild our root hash.\\n for (uint256 i = _nodes.length; i > 0; i--) {\\n // Pick out the current node.\\n currentNode = _nodes[i - 1];\\n currentNodeType = _getNodeType(currentNode);\\n\\n if (currentNodeType == NodeType.LeafNode) {\\n // Leaf nodes are already correctly encoded.\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n } else if (currentNodeType == NodeType.ExtensionNode) {\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\\n }\\n } else if (currentNodeType == NodeType.BranchNode) {\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n uint8 branchKey = uint8(key[key.length - 1]);\\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\\n }\\n }\\n\\n // Compute the node hash for the next iteration.\\n previousNodeHash = _getNodeHash(currentNode.encoded);\\n }\\n\\n // Current node should be the root at this point.\\n // Simply return the hash of its encoding.\\n return keccak256(currentNode.encoded);\\n }\\n\\n /**\\n * @notice Parses an RLP-encoded proof into something more useful.\\n * @param _proof RLP-encoded proof to parse.\\n * @return _parsed Proof parsed into easily accessible structs.\\n */\\n function _parseProof(\\n bytes memory _proof\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _parsed\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\\n TrieNode[] memory proof = new TrieNode[](nodes.length);\\n\\n for (uint256 i = 0; i < nodes.length; i++) {\\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\\n proof[i] = TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n return proof;\\n }\\n\\n /**\\n * @notice Picks out the ID for a node. Node ID is referred to as the\\n * \\\"hash\\\" within the specification, but nodes < 32 bytes are not actually\\n * hashed.\\n * @param _node Node to pull an ID for.\\n * @return _nodeID ID for the node, depending on the size of its contents.\\n */\\n function _getNodeID(\\n Lib_RLPReader.RLPItem memory _node\\n )\\n private\\n pure\\n returns (\\n bytes32 _nodeID\\n )\\n {\\n bytes memory nodeID;\\n\\n if (_node.length < 32) {\\n // Nodes smaller than 32 bytes are RLP encoded.\\n nodeID = Lib_RLPReader.readRawBytes(_node);\\n } else {\\n // Nodes 32 bytes or larger are hashed.\\n nodeID = Lib_RLPReader.readBytes(_node);\\n }\\n\\n return Lib_BytesUtils.toBytes32(nodeID);\\n }\\n\\n /**\\n * @notice Gets the path for a leaf or extension node.\\n * @param _node Node to get a path for.\\n * @return _path Node path, converted to an array of nibbles.\\n */\\n function _getNodePath(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _path\\n )\\n {\\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\\n }\\n\\n /**\\n * @notice Gets the key for a leaf or extension node. Keys are essentially\\n * just paths without any prefix.\\n * @param _node Node to get a key for.\\n * @return _key Node key, converted to an array of nibbles.\\n */\\n function _getNodeKey(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _key\\n )\\n {\\n return _removeHexPrefix(_getNodePath(_node));\\n }\\n\\n /**\\n * @notice Gets the path for a node.\\n * @param _node Node to get a value for.\\n * @return _value Node value, as hex bytes.\\n */\\n function _getNodeValue(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _value\\n )\\n {\\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\\n }\\n\\n /**\\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\\n * are not hashed, all others are keccak256 hashed.\\n * @param _encoded Encoded node to hash.\\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\\n */\\n function _getNodeHash(\\n bytes memory _encoded\\n )\\n private\\n pure\\n returns (\\n bytes memory _hash\\n )\\n {\\n if (_encoded.length < 32) {\\n return _encoded;\\n } else {\\n return abi.encodePacked(keccak256(_encoded));\\n }\\n }\\n\\n /**\\n * @notice Determines the type for a given node.\\n * @param _node Node to determine a type for.\\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\\n */\\n function _getNodeType(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n NodeType _type\\n )\\n {\\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\\n return NodeType.BranchNode;\\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(_node);\\n uint8 prefix = uint8(path[0]);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n return NodeType.LeafNode;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n return NodeType.ExtensionNode;\\n }\\n }\\n\\n revert(\\\"Invalid node type\\\");\\n }\\n\\n /**\\n * @notice Utility; determines the number of nibbles shared between two\\n * nibble arrays.\\n * @param _a First nibble array.\\n * @param _b Second nibble array.\\n * @return _shared Number of shared nibbles.\\n */\\n function _getSharedNibbleLength(\\n bytes memory _a,\\n bytes memory _b\\n )\\n private\\n pure\\n returns (\\n uint256 _shared\\n )\\n {\\n uint256 i = 0;\\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\\n i++;\\n }\\n return i;\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-encoded node into our nice struct.\\n * @param _raw RLP-encoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n bytes[] memory _raw\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\\n\\n return TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-decoded node into our nice struct.\\n * @param _items RLP-decoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n Lib_RLPReader.RLPItem[] memory _items\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](_items.length);\\n for (uint256 i = 0; i < _items.length; i++) {\\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new extension node.\\n * @param _key Key for the extension node, unprefixed.\\n * @param _value Value for the extension node.\\n * @return _node New extension node with the given k/v pair.\\n */\\n function _makeExtensionNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new leaf node.\\n * @dev This function is essentially identical to `_makeExtensionNode`.\\n * Although we could route both to a single method with a flag, it's\\n * more gas efficient to keep them separate and duplicate the logic.\\n * @param _key Key for the leaf node, unprefixed.\\n * @param _value Value for the leaf node.\\n * @return _node New leaf node with the given k/v pair.\\n */\\n function _makeLeafNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, true);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates an empty branch node.\\n * @return _node Empty branch node as a TrieNode struct.\\n */\\n function _makeEmptyBranchNode()\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\\n for (uint256 i = 0; i < raw.length; i++) {\\n raw[i] = RLP_NULL_BYTES;\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Modifies the value slot for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _value Value to insert into the branch.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchValue(\\n TrieNode memory _branch,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Modifies a slot at an index for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _index Slot index to modify.\\n * @param _value Value to insert into the slot.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchIndex(\\n TrieNode memory _branch,\\n uint8 _index,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Utility; adds a prefix to a key.\\n * @param _key Key to prefix.\\n * @param _isLeaf Whether or not the key belongs to a leaf.\\n * @return _prefixedKey Prefixed key.\\n */\\n function _addHexPrefix(\\n bytes memory _key,\\n bool _isLeaf\\n )\\n private\\n pure\\n returns (\\n bytes memory _prefixedKey\\n )\\n {\\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\\n uint8 offset = uint8(_key.length % 2);\\n bytes memory prefixed = new bytes(2 - offset);\\n prefixed[0] = bytes1(prefix + offset);\\n return Lib_BytesUtils.concat(prefixed, _key);\\n }\\n\\n /**\\n * @notice Utility; removes a prefix from a path.\\n * @param _path Path to remove the prefix from.\\n * @return _unprefixedKey Unprefixed key.\\n */\\n function _removeHexPrefix(\\n bytes memory _path\\n )\\n private\\n pure\\n returns (\\n bytes memory _unprefixedKey\\n )\\n {\\n if (uint8(_path[0]) % 2 == 0) {\\n return Lib_BytesUtils.slice(_path, 2);\\n } else {\\n return Lib_BytesUtils.slice(_path, 1);\\n }\\n }\\n\\n /**\\n * @notice Utility; combines two node arrays. Array lengths are required\\n * because the actual lengths may be longer than the filled lengths.\\n * Array resizing is extremely costly and should be avoided.\\n * @param _a First array to join.\\n * @param _aLength Length of the first array.\\n * @param _b Second array to join.\\n * @param _bLength Length of the second array.\\n * @return _joined Combined node array.\\n */\\n function _joinNodeArrays(\\n TrieNode[] memory _a,\\n uint256 _aLength,\\n TrieNode[] memory _b,\\n uint256 _bLength\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _joined\\n )\\n {\\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\\n\\n // Copy elements from the first array.\\n for (uint256 i = 0; i < _aLength; i++) {\\n ret[i] = _a[i];\\n }\\n\\n // Copy elements from the second array.\\n for (uint256 i = 0; i < _bLength; i++) {\\n ret[i + _aLength] = _b[i];\\n }\\n\\n return ret;\\n }\\n}\\n\",\"keccak256\":\"0x86fecc050ffc298ac364d118e65ce8ef2418749cbef1ad0d4dce2ca8a0d15ace\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_MerkleTrie } from \\\"./Lib_MerkleTrie.sol\\\";\\n\\n/**\\n * @title Lib_SecureMerkleTrie\\n */\\nlibrary Lib_SecureMerkleTrie {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.get(key, _proof, _root);\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Computes the secure counterpart to a key.\\n * @param _key Key to get a secure key from.\\n * @return _secureKey Secure version of the key.\\n */\\n function _getSecureKey(\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes memory _secureKey\\n )\\n {\\n return abi.encodePacked(keccak256(_key));\\n }\\n}\",\"keccak256\":\"0x79355346f74bb1eb9eeb733cb5d9677d50115c4f390307cbf608fe071a1ada0c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract Lib_ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor () internal {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0xc304e479db6914188c19c56ea871f7f8c541238fdbf088fbf51c99eecef7347f\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506001600055600680546001600160a01b03191690556125c6806100356000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c806382e3702d1161006657806382e3702d1461011c578063b1b1b2091461012f578063c4d66de814610142578063d7fd19dd14610155578063ecc70428146101685761009e565b806321d800ec146100a35780633dbb202b146100cc578063461a4478146100e15780636e296e4514610101578063706ceab614610109575b600080fd5b6100b66100b136600461203d565b61017d565b6040516100c39190612253565b60405180910390f35b6100df6100da366004611fc1565b610192565b005b6100f46100ef366004612055565b610221565b6040516100c391906121db565b6100f46102fd565b6100df610117366004611f4a565b61030c565b6100b661012a36600461203d565b61037c565b6100b661013d36600461203d565b610391565b6100df610150366004611e01565b6103a6565b6100df610163366004611e1b565b6103f1565b61017061065f565b6040516100c39190612124565b60016020526000908152604090205460ff1681565b60006101a2843385600454610665565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506101e48163ffffffff84166106b2565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268160405161021391906122d5565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d60208110156102f357600080fd5b505190505b919050565b6005546001600160a01b031681565b600061031a86868686610665565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103645760405162461bcd60e51b815260040161035b90612333565b60405180910390fd5b610374818363ffffffff166106b2565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156103cf5760405162461bcd60e51b815260040161035b9061241b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610449576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015261048490610221565b90506001600160a01b038116156104bd57336001600160a01b038216146104bd5760405162461bcd60e51b815260040161035b9061237e565b60006104cb87878787610665565b90506104d7818461078a565b15156001146104f85760405162461bcd60e51b815260040161035b906123d4565b80516020808301919091206000818152600290925260409091205460ff16156105335760405162461bcd60e51b815260040161035b906122e8565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a169061056790899061213b565b6000604051808303816000865af19150503d80600081146105a4576040519150601f19603f3d011682016040523d82523d6000602084013e6105a9565b606091505b50909150506001811515141561060b5760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610602908490612124565b60405180910390a15b600083334360405160200161062293929190612189565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161067e94939291906121ef565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b6106f06040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610221565b6001600160a01b0316636fee07e061073c6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b83856040518463ffffffff1660e01b815260040161075c9392919061222c565b600060405180830381600087803b15801561077657600080fd5b505af1158015610374573d6000803e3d6000fd5b6000610795826107af565b80156107a657506107a6838361090c565b90505b92915050565b6000806107f06040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610221565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd91610822916004016124d9565b60206040518083038186803b15801561083a57600080fd5b505afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610872919061201d565b1580156109055750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee57936108b593919290919060040161225e565b60206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610905919061201d565b9392505050565b6000808361094e6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b60405160200161095f929190612157565b60405160208183030381529060405280519060200120600060405160200161098892919061212d565b6040516020818303038152906040528051906020012090506000806109d7602160991b6040516020016109bb919061210c565b60408051601f1981840301815291905260608701518751610a69565b90925090506001821515146109fe5760405162461bcd60e51b815260040161035b90612465565b6000610a0982610a92565b9050610a5e84604051602001610a1f9190612124565b6040516020818303038152906040526001604051602001610a4091906121c3565b60405160208183030381529060405288608001518460400151610b24565b979650505050505050565b600060606000610a7886610b48565b9050610a85818686610b78565b9250925050935093915050565b610a9a611bb7565b6000610aa583610c4b565b90506040518060800160405280610acf83600081518110610ac257fe5b6020026020010151610c5e565b8152602001610ae483600181518110610ac257fe5b8152602001610b0683600281518110610af957fe5b6020026020010151610c65565b8152602001610b1b83600381518110610af957fe5b90529392505050565b600080610b3086610b48565b9050610b3e81868686610d5e565b9695505050505050565b60608180519060200120604051602001610b629190612124565b6040516020818303038152906040529050919050565b600060606000610b8785610d84565b90506000806000610b99848a89610e5b565b81519295509093509150158080610bad5750815b610bfe576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610c1a5760405180602001604052806000815250610c39565b610c39866001870381518110610c2c57fe5b60200260200101516111fe565b919b919a509098505050505050505050565b60606107a9610c598361121a565b61123f565b60006107a9825b6000602182600001511115610cc1576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610ccf856113b5565b919450925090506000816001811115610ce457fe5b14610d36576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610b3e5760208490036101000a90049695505050505050565b6000806000610d6e878686610b78565b91509150818015610a5e5750610a5e86826116de565b60606000610d9183610c4b565b90506000815167ffffffffffffffff81118015610dad57600080fd5b50604051908082528060200260200182016040528015610de757816020015b610dd4611bde565b815260200190600190039081610dcc5790505b50905060005b8251811015610e53576000610e14848381518110610e0757fe5b60200260200101516116f4565b90506040518060400160405280828152602001610e3083610c4b565b815250838381518110610e3f57fe5b602090810291909101015250600101610ded565b509392505050565b60006060818080610e6b87611783565b905085600080610e79611bde565b60005b8c518110156111d6578c8181518110610e9157fe5b6020026020010151915082840193506001870196508360001415610f0557815180516020909101208514610f00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b610fcc565b815151602011610f6c57815180516020909101208514610f00576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84610f7a8360000151611880565b14610fcc576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b6020820151516011141561103b578551841415610fe8576111d6565b6000868581518110610ff657fe5b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061101b57fe5b6020026020010151905061102e816118ac565b96506001945050506111ce565b60028260200151511415611181576000611054836118e2565b905060008160008151811061106557fe5b016020015160f81c90506001811660020360006110858460ff8416611900565b905060006110938b8a611900565b905060006110a18383611931565b905060ff8516600214806110b8575060ff85166003145b156110ea578083511480156110cd5750808251145b156110d757988901985b50600160ff1b99506111d6945050505050565b60ff851615806110fd575060ff85166001145b1561114a578061111a5750600160ff1b99506111d6945050505050565b61113b886020015160018151811061112e57fe5b60200260200101516118ac565b9a5097506111ce945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061256b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610e7c565b50600160ff1b8414866111e98786611900565b909e909d50909b509950505050505050505050565b602081015180516060916107a9916000198101908110610e0757fe5b611222611bf8565b506040805180820190915281518152602082810190820152919050565b606060008061124d846113b5565b9193509091506001905081600181111561126357fe5b146112b5576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b6112d6611bf8565b8152602001906001900390816112ce5790505090506000835b86518110156113aa57602082106113375760405162461bcd60e51b815260040180806020018281038252602a815260200180612541602a913960400191505060405180910390fd5b6000806113636040518060400160405280858c60000151038152602001858c60200151018152506113b5565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061139157fe5b60209081029190910101526001939093019201016112ef565b508152949350505050565b600080600080846000015111611412576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114375760006001600094509450945050506116d7565b60b781116114ac578551607f19820190811061149a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506116d7915050565b60bf811161159057855160b619820190811061150f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161157b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506116d7915050565b60f7811161160457855160bf1982019081106115f3576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506116d7915050565b855160f619820190811061165f576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116116c4576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506116d7915050565b9193909250565b8051602091820120825192909101919091201490565b60606000806000611704856113b5565b91945092509050600081600181111561171957fe5b1461176b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61177a85602001518484611997565b95945050505050565b60606000825160020267ffffffffffffffff811180156117a257600080fd5b506040519080825280601f01601f1916602001820160405280156117cd576020820181803683370190505b50905060005b83518110156118795760048482815181106117ea57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061181057fe5b60200101906001600160f81b031916908160001a905350601084828151811061183557fe5b016020015160f81c8161184457fe5b0660f81b82826002026001018151811061185a57fe5b60200101906001600160f81b031916908160001a9053506001016117d3565b5092915050565b6000602082511015611897575060208101516102f8565b8180602001905160208110156102f357600080fd5b600060606020836000015110156118cd576118c683611a45565b90506118d9565b6118d6836116f4565b90505b61090581611880565b60606107a96118fb8360200151600081518110610e0757fe5b611783565b6060818351036000141561192357506040805160208101909152600081526107a9565b6107a6838384865103611a50565b6000805b8084511180156119455750808351115b801561198a575082818151811061195857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061197957fe5b01602001516001600160f81b031916145b156107a657600101611935565b606060008267ffffffffffffffff811180156119b257600080fd5b506040519080825280601f01601f1916602001820160405280156119dd576020820181803683370190505b5090508051600014156119f1579050610905565b8484016020820160005b60208604811015611a1c5782518252602092830192909101906001016119fb565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606107a982611ba1565b60608182601f011015611a9b576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611ae3576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611b2f576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611b4e5760405191506000825260208201604052611b98565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611b87578051835260209283019201611b6f565b5050858452601f01601f1916604052505b50949350505050565b60606107a9826020015160008460000151611997565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611c2657fe5b611c39601f8401601f19166020016124ec565b9050828152838383011115611c4d57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102f857600080fd5b600082601f830112611c8b578081fd5b6107a683833560208501611c12565b600060a08284031215611cab578081fd5b60405160a0810167ffffffffffffffff8282108183111715611cc957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611d0657600080fd5b50611d1385828601611c7b565b6080830152505092915050565b600060408284031215611d31578081fd5b6040516040810167ffffffffffffffff8282108183111715611d4f57fe5b8160405282935084358352602091508185013581811115611d6f57600080fd5b8501601f81018713611d8057600080fd5b803582811115611d8c57fe5b8381029250611d9c8484016124ec565b8181528481019083860185850187018b1015611db757600080fd5b600095505b83861015611dda578035835260019590950194918601918601611dbc565b5080868801525050505050505092915050565b803563ffffffff811681146102f857600080fd5b600060208284031215611e12578081fd5b6107a682611c64565b600080600080600060a08688031215611e32578081fd5b611e3b86611c64565b9450611e4960208701611c64565b9350604086013567ffffffffffffffff80821115611e65578283fd5b611e7189838a01611c7b565b9450606088013593506080880135915080821115611e8d578283fd5b9087019060a0828a031215611ea0578283fd5b611eaa60a06124ec565b82358152602083013582811115611ebf578485fd5b611ecb8b828601611c9a565b602083015250604083013582811115611ee2578485fd5b611eee8b828601611d20565b604083015250606083013582811115611f05578485fd5b611f118b828601611c7b565b606083015250608083013582811115611f28578485fd5b611f348b828601611c7b565b6080830152508093505050509295509295909350565b600080600080600060a08688031215611f61578081fd5b611f6a86611c64565b9450611f7860208701611c64565b9350604086013567ffffffffffffffff811115611f93578182fd5b611f9f88828901611c7b565b93505060608601359150611fb560808701611ded565b90509295509295909350565b600080600060608486031215611fd5578283fd5b611fde84611c64565b9250602084013567ffffffffffffffff811115611ff9578283fd5b61200586828701611c7b565b92505061201460408501611ded565b90509250925092565b60006020828403121561202e578081fd5b815180151581146107a6578182fd5b60006020828403121561204e578081fd5b5035919050565b600060208284031215612066578081fd5b813567ffffffffffffffff81111561207c578182fd5b8201601f8101841361208c578182fd5b61209b84823560208401611c12565b949350505050565b600081518084526120bb816020860160208601612510565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261209b60a08501826120a3565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b6000825161214d818460208701612510565b9190910192915050565b60008351612169818460208801612510565b60609390931b6001600160601b0319169190920190815260140192915050565b6000845161219b818460208901612510565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260806040820181905260009061221b908301856120a3565b905082606083015295945050505050565b600060018060a01b03851682528360208301526060604083015261177a60608301846120a3565b901515815260200190565b6000848252602060608184015261227860608401866120cf565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156122c757845182529385019360019390930192908501906122a7565b509998505050505050505050565b6000602082526107a660208301846120a3565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b6020808252604e908201527f4d6573736167652070617373696e6720707265636f6d70696c6520686173206e60408201527f6f74206265656e20696e697469616c697a6564206f7220696e76616c6964207060608201526d3937b7b310383937bb34b232b21760911b608082015260a00190565b6000602082526107a660208301846120cf565b60405181810167ffffffffffffffff8111828210171561250857fe5b604052919050565b60005b8381101561252b578181015183820152602001612513565b8381111561253a576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220d0b28cf8f96b59527ddacc889954cf7daf7a7ed3e494dd3b8457563cdc9171c464736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061009e5760003560e01c806382e3702d1161006657806382e3702d1461011c578063b1b1b2091461012f578063c4d66de814610142578063d7fd19dd14610155578063ecc70428146101685761009e565b806321d800ec146100a35780633dbb202b146100cc578063461a4478146100e15780636e296e4514610101578063706ceab614610109575b600080fd5b6100b66100b136600461203d565b61017d565b6040516100c39190612253565b60405180910390f35b6100df6100da366004611fc1565b610192565b005b6100f46100ef366004612055565b610221565b6040516100c391906121db565b6100f46102fd565b6100df610117366004611f4a565b61030c565b6100b661012a36600461203d565b61037c565b6100b661013d36600461203d565b610391565b6100df610150366004611e01565b6103a6565b6100df610163366004611e1b565b6103f1565b61017061065f565b6040516100c39190612124565b60016020526000908152604090205460ff1681565b60006101a2843385600454610665565b60048054600190810190915581516020808401919091206000908152600390915260409020805460ff1916909117905590506101e48163ffffffff84166106b2565b7f0ee9ffdb2334d78de97ffb066b23a352a4d35180cefb36589d663fbb1eb6f3268160405161021391906122d5565b60405180910390a150505050565b60065460405163bf40fac160e01b81526020600482018181528451602484015284516000946001600160a01b03169363bf40fac1938793928392604401918501908083838b5b8381101561027f578181015183820152602001610267565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c957600080fd5b505afa1580156102dd573d6000803e3d6000fd5b505050506040513d60208110156102f357600080fd5b505190505b919050565b6005546001600160a01b031681565b600061031a86868686610665565b805160208083019190912060009081526003909152604090205490915060ff1615156001146103645760405162461bcd60e51b815260040161035b90612333565b60405180910390fd5b610374818363ffffffff166106b2565b505050505050565b60036020526000908152604090205460ff1681565b60026020526000908152604090205460ff1681565b6006546001600160a01b0316156103cf5760405162461bcd60e51b815260040161035b9061241b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610449576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815560408051808201909152601481527327ab26afa61926b2b9b9b0b3b2a932b630bcb2b960611b602082015261048490610221565b90506001600160a01b038116156104bd57336001600160a01b038216146104bd5760405162461bcd60e51b815260040161035b9061237e565b60006104cb87878787610665565b90506104d7818461078a565b15156001146104f85760405162461bcd60e51b815260040161035b906123d4565b80516020808301919091206000818152600290925260409091205460ff16156105335760405162461bcd60e51b815260040161035b906122e8565b600580546001600160a01b0319166001600160a01b03898116919091179091556040516000918a169061056790899061213b565b6000604051808303816000865af19150503d80600081146105a4576040519150601f19603f3d011682016040523d82523d6000602084013e6105a9565b606091505b50909150506001811515141561060b5760008281526002602052604090819020805460ff19166001179055517f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c90610602908490612124565b60405180910390a15b600083334360405160200161062293929190612189565b60408051601f1981840301815291815281516020928301206000908152600192839052908120805460ff1916831790555550505050505050505050565b60045481565b60608484848460405160240161067e94939291906121ef565b60408051601f198184030181529190526020810180516001600160e01b031663cbd4ece960e01b1790529050949350505050565b6106f06040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e000000815250610221565b6001600160a01b0316636fee07e061073c6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b83856040518463ffffffff1660e01b815260040161075c9392919061222c565b600060405180830381600087803b15801561077657600080fd5b505af1158015610374573d6000803e3d6000fd5b6000610795826107af565b80156107a657506107a6838361090c565b90505b92915050565b6000806107f06040518060400160405280601881526020017f4f564d5f5374617465436f6d6d69746d656e74436861696e0000000000000000815250610221565b6020840151604051639418bddd60e01b81529192506001600160a01b03831691639418bddd91610822916004016124d9565b60206040518083038186803b15801561083a57600080fd5b505afa15801561084e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610872919061201d565b1580156109055750825160208401516040808601519051634d69ee5760e01b81526001600160a01b03851693634d69ee57936108b593919290919060040161225e565b60206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610905919061201d565b9392505050565b6000808361094e6040518060400160405280601a81526020017f4f564d5f4c3243726f7373446f6d61696e4d657373656e676572000000000000815250610221565b60405160200161095f929190612157565b60405160208183030381529060405280519060200120600060405160200161098892919061212d565b6040516020818303038152906040528051906020012090506000806109d7602160991b6040516020016109bb919061210c565b60408051601f1981840301815291905260608701518751610a69565b90925090506001821515146109fe5760405162461bcd60e51b815260040161035b90612465565b6000610a0982610a92565b9050610a5e84604051602001610a1f9190612124565b6040516020818303038152906040526001604051602001610a4091906121c3565b60405160208183030381529060405288608001518460400151610b24565b979650505050505050565b600060606000610a7886610b48565b9050610a85818686610b78565b9250925050935093915050565b610a9a611bb7565b6000610aa583610c4b565b90506040518060800160405280610acf83600081518110610ac257fe5b6020026020010151610c5e565b8152602001610ae483600181518110610ac257fe5b8152602001610b0683600281518110610af957fe5b6020026020010151610c65565b8152602001610b1b83600381518110610af957fe5b90529392505050565b600080610b3086610b48565b9050610b3e81868686610d5e565b9695505050505050565b60608180519060200120604051602001610b629190612124565b6040516020818303038152906040529050919050565b600060606000610b8785610d84565b90506000806000610b99848a89610e5b565b81519295509093509150158080610bad5750815b610bfe576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081610c1a5760405180602001604052806000815250610c39565b610c39866001870381518110610c2c57fe5b60200260200101516111fe565b919b919a509098505050505050505050565b60606107a9610c598361121a565b61123f565b60006107a9825b6000602182600001511115610cc1576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000610ccf856113b5565b919450925090506000816001811115610ce457fe5b14610d36576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015610b3e5760208490036101000a90049695505050505050565b6000806000610d6e878686610b78565b91509150818015610a5e5750610a5e86826116de565b60606000610d9183610c4b565b90506000815167ffffffffffffffff81118015610dad57600080fd5b50604051908082528060200260200182016040528015610de757816020015b610dd4611bde565b815260200190600190039081610dcc5790505b50905060005b8251811015610e53576000610e14848381518110610e0757fe5b60200260200101516116f4565b90506040518060400160405280828152602001610e3083610c4b565b815250838381518110610e3f57fe5b602090810291909101015250600101610ded565b509392505050565b60006060818080610e6b87611783565b905085600080610e79611bde565b60005b8c518110156111d6578c8181518110610e9157fe5b6020026020010151915082840193506001870196508360001415610f0557815180516020909101208514610f00576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b610fcc565b815151602011610f6c57815180516020909101208514610f00576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84610f7a8360000151611880565b14610fcc576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b6020820151516011141561103b578551841415610fe8576111d6565b6000868581518110610ff657fe5b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061101b57fe5b6020026020010151905061102e816118ac565b96506001945050506111ce565b60028260200151511415611181576000611054836118e2565b905060008160008151811061106557fe5b016020015160f81c90506001811660020360006110858460ff8416611900565b905060006110938b8a611900565b905060006110a18383611931565b905060ff8516600214806110b8575060ff85166003145b156110ea578083511480156110cd5750808251145b156110d757988901985b50600160ff1b99506111d6945050505050565b60ff851615806110fd575060ff85166001145b1561114a578061111a5750600160ff1b99506111d6945050505050565b61113b886020015160018151811061112e57fe5b60200260200101516118ac565b9a5097506111ce945050505050565b60405162461bcd60e51b815260040180806020018281038252602681526020018061256b6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101610e7c565b50600160ff1b8414866111e98786611900565b909e909d50909b509950505050505050505050565b602081015180516060916107a9916000198101908110610e0757fe5b611222611bf8565b506040805180820190915281518152602082810190820152919050565b606060008061124d846113b5565b9193509091506001905081600181111561126357fe5b146112b5576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b6112d6611bf8565b8152602001906001900390816112ce5790505090506000835b86518110156113aa57602082106113375760405162461bcd60e51b815260040180806020018281038252602a815260200180612541602a913960400191505060405180910390fd5b6000806113636040518060400160405280858c60000151038152602001858c60200151018152506113b5565b509150915060405180604001604052808383018152602001848b602001510181525085858151811061139157fe5b60209081029190910101526001939093019201016112ef565b508152949350505050565b600080600080846000015111611412576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f81116114375760006001600094509450945050506116d7565b60b781116114ac578551607f19820190811061149a576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506116d7915050565b60bf811161159057855160b619820190811061150f576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a600185015104905080820188600001511161157b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506116d7915050565b60f7811161160457855160bf1982019081106115f3576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506116d7915050565b855160f619820190811061165f576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116116c4576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506116d7915050565b9193909250565b8051602091820120825192909101919091201490565b60606000806000611704856113b5565b91945092509050600081600181111561171957fe5b1461176b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b61177a85602001518484611997565b95945050505050565b60606000825160020267ffffffffffffffff811180156117a257600080fd5b506040519080825280601f01601f1916602001820160405280156117cd576020820181803683370190505b50905060005b83518110156118795760048482815181106117ea57fe5b602001015160f81c60f81b6001600160f81b031916901c82826002028151811061181057fe5b60200101906001600160f81b031916908160001a905350601084828151811061183557fe5b016020015160f81c8161184457fe5b0660f81b82826002026001018151811061185a57fe5b60200101906001600160f81b031916908160001a9053506001016117d3565b5092915050565b6000602082511015611897575060208101516102f8565b8180602001905160208110156102f357600080fd5b600060606020836000015110156118cd576118c683611a45565b90506118d9565b6118d6836116f4565b90505b61090581611880565b60606107a96118fb8360200151600081518110610e0757fe5b611783565b6060818351036000141561192357506040805160208101909152600081526107a9565b6107a6838384865103611a50565b6000805b8084511180156119455750808351115b801561198a575082818151811061195857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061197957fe5b01602001516001600160f81b031916145b156107a657600101611935565b606060008267ffffffffffffffff811180156119b257600080fd5b506040519080825280601f01601f1916602001820160405280156119dd576020820181803683370190505b5090508051600014156119f1579050610905565b8484016020820160005b60208604811015611a1c5782518252602092830192909101906001016119fb565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b60606107a982611ba1565b60608182601f011015611a9b576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015611ae3576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b81830184511015611b2f576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b606082158015611b4e5760405191506000825260208201604052611b98565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015611b87578051835260209283019201611b6f565b5050858452601f01601f1916604052505b50949350505050565b60606107a9826020015160008460000151611997565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001600081525090565b600067ffffffffffffffff831115611c2657fe5b611c39601f8401601f19166020016124ec565b9050828152838383011115611c4d57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102f857600080fd5b600082601f830112611c8b578081fd5b6107a683833560208501611c12565b600060a08284031215611cab578081fd5b60405160a0810167ffffffffffffffff8282108183111715611cc957fe5b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611d0657600080fd5b50611d1385828601611c7b565b6080830152505092915050565b600060408284031215611d31578081fd5b6040516040810167ffffffffffffffff8282108183111715611d4f57fe5b8160405282935084358352602091508185013581811115611d6f57600080fd5b8501601f81018713611d8057600080fd5b803582811115611d8c57fe5b8381029250611d9c8484016124ec565b8181528481019083860185850187018b1015611db757600080fd5b600095505b83861015611dda578035835260019590950194918601918601611dbc565b5080868801525050505050505092915050565b803563ffffffff811681146102f857600080fd5b600060208284031215611e12578081fd5b6107a682611c64565b600080600080600060a08688031215611e32578081fd5b611e3b86611c64565b9450611e4960208701611c64565b9350604086013567ffffffffffffffff80821115611e65578283fd5b611e7189838a01611c7b565b9450606088013593506080880135915080821115611e8d578283fd5b9087019060a0828a031215611ea0578283fd5b611eaa60a06124ec565b82358152602083013582811115611ebf578485fd5b611ecb8b828601611c9a565b602083015250604083013582811115611ee2578485fd5b611eee8b828601611d20565b604083015250606083013582811115611f05578485fd5b611f118b828601611c7b565b606083015250608083013582811115611f28578485fd5b611f348b828601611c7b565b6080830152508093505050509295509295909350565b600080600080600060a08688031215611f61578081fd5b611f6a86611c64565b9450611f7860208701611c64565b9350604086013567ffffffffffffffff811115611f93578182fd5b611f9f88828901611c7b565b93505060608601359150611fb560808701611ded565b90509295509295909350565b600080600060608486031215611fd5578283fd5b611fde84611c64565b9250602084013567ffffffffffffffff811115611ff9578283fd5b61200586828701611c7b565b92505061201460408501611ded565b90509250925092565b60006020828403121561202e578081fd5b815180151581146107a6578182fd5b60006020828403121561204e578081fd5b5035919050565b600060208284031215612066578081fd5b813567ffffffffffffffff81111561207c578182fd5b8201601f8101841361208c578182fd5b61209b84823560208401611c12565b949350505050565b600081518084526120bb816020860160208601612510565b601f01601f19169290920160200192915050565b600081518352602082015160208401526040820151604084015260608201516060840152608082015160a0608085015261209b60a08501826120a3565b60609190911b6001600160601b031916815260140190565b90815260200190565b918252602082015260400190565b6000825161214d818460208701612510565b9190910192915050565b60008351612169818460208801612510565b60609390931b6001600160601b0319169190920190815260140192915050565b6000845161219b818460208901612510565b60609490941b6001600160601b03191691909301908152601481019190915260340192915050565b60f89190911b6001600160f81b031916815260010190565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260806040820181905260009061221b908301856120a3565b905082606083015295945050505050565b600060018060a01b03851682528360208301526060604083015261177a60608301846120a3565b901515815260200190565b6000848252602060608184015261227860608401866120cf565b838103604085015260408101855182528286015160408484015281815180845260608501915085830194508693505b808410156122c757845182529385019360019390930192908501906122a7565b509998505050505050505050565b6000602082526107a660208301846120a3565b6020808252602b908201527f50726f7669646564206d6573736167652068617320616c72656164792062656560408201526a37103932b1b2b4bb32b21760a91b606082015260800190565b6020808252602b908201527f50726f7669646564206d65737361676520686173206e6f7420616c726561647960408201526a103132b2b71039b2b73a1760a91b606082015260800190565b60208082526036908201527f4f6e6c79204f564d5f4c324d65737361676552656c617965722063616e2072656040820152753630bc90261916ba3796a6189036b2b9b9b0b3b2b99760511b606082015260800190565b60208082526027908201527f50726f7669646564206d65737361676520636f756c64206e6f742062652076656040820152663934b334b2b21760c91b606082015260800190565b6020808252602a908201527f4c3143726f7373446f6d61696e4d657373656e67657220616c72656164792069604082015269373a34b0b634bd32b21760b11b606082015260800190565b6020808252604e908201527f4d6573736167652070617373696e6720707265636f6d70696c6520686173206e60408201527f6f74206265656e20696e697469616c697a6564206f7220696e76616c6964207060608201526d3937b7b310383937bb34b232b21760911b608082015260a00190565b6000602082526107a660208301846120cf565b60405181810167ffffffffffffffff8111828210171561250857fe5b604052919050565b60005b8381101561252b578181015183820152602001612513565b8381111561253a576000848401525b5050505056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220d0b28cf8f96b59527ddacc889954cf7daf7a7ed3e494dd3b8457563cdc9171c464736f6c63430007060033", - "devdoc": { - "details": "The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted via this contract's replay function. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "initialize(address)": { - "params": { - "_libAddressManager": "Address of the Address Manager." - } - }, - "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { - "params": { - "_message": "Message to send to the target.", - "_messageNonce": "Nonce for the provided message.", - "_proof": "Inclusion proof for the given message.", - "_sender": "Message sender address.", - "_target": "Target contract address." - } - }, - "replayMessage(address,address,bytes,uint256,uint32)": { - "params": { - "_gasLimit": "Gas limit for the provided message.", - "_message": "Message to send to the target.", - "_messageNonce": "Nonce for the provided message.", - "_sender": "Original sender address.", - "_target": "Target contract address." - } - }, - "sendMessage(address,bytes,uint32)": { - "params": { - "_gasLimit": "Gas limit for the provided message.", - "_message": "Message to send to the target.", - "_target": "Target contract address." - } - } - }, - "title": "OVM_L1CrossDomainMessenger", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "constructor": { - "notice": "Pass a default zero address to the address resolver. This will be updated when initialized." - }, - "relayMessage(address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))": { - "notice": "Relays a cross domain message to a contract." - }, - "replayMessage(address,address,bytes,uint256,uint32)": { - "notice": "Replays a cross domain message to the target messenger." - }, - "sendMessage(address,bytes,uint32)": { - "notice": "Sends a cross domain message to the target messenger." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 17540, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "_status", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 681, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "relayedMessages", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 685, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "successfulMessages", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 689, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "sentMessages", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_bool)" - }, - { - "astId": 691, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "messageNonce", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 694, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "xDomainMessageSender", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol:OVM_L1CrossDomainMessenger", - "label": "libAddressManager", - "offset": 0, - "slot": "6", - "type": "t_contract(Lib_AddressManager)12330" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_mapping(t_bytes32,t_bool)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_L1MultiMessageRelayer.json b/deployments/kovan/OVM_L1MultiMessageRelayer.json deleted file mode 100644 index 9bd5aac31..000000000 --- a/deployments/kovan/OVM_L1MultiMessageRelayer.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "address": "0x41e91c4c3404D3eA4251FE58dadf7c3C3460b114", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "target", - "type": "address" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "messageNonce", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "stateRootBatchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "stateRootProof", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "stateTrieWitness", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "storageTrieWitness", - "type": "bytes" - } - ], - "internalType": "struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof", - "name": "proof", - "type": "tuple" - } - ], - "internalType": "struct iOVM_L1MultiMessageRelayer.L2ToL1Message[]", - "name": "_messages", - "type": "tuple[]" - } - ], - "name": "batchRelayMessages", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x94daa3b8710e82d088601740fe37484c482ff52385d2b8fa823650a07ddf537f", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x41e91c4c3404D3eA4251FE58dadf7c3C3460b114", - "transactionIndex": 1, - "gasUsed": "597839", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x068df5985d56b1bccac5f8611d0d3ff7b966bb45bb2dbc807211100a750675c9", - "transactionHash": "0x94daa3b8710e82d088601740fe37484c482ff52385d2b8fa823650a07ddf537f", - "logs": [], - "blockNumber": 23637130, - "cumulativeGasUsed": "643268", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"stateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"stateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"stateTrieWitness\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"storageTrieWitness\",\"type\":\"bytes\"}],\"internalType\":\"struct iOVM_L1CrossDomainMessenger.L2MessageInclusionProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"internalType\":\"struct iOVM_L1MultiMessageRelayer.L2ToL1Message[]\",\"name\":\"_messages\",\"type\":\"tuple[]\"}],\"name\":\"batchRelayMessages\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain Message Sender. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])\":{\"params\":{\"_messages\":\"An array of L2 to L1 messages\"}}},\"title\":\"OVM_L1MultiMessageRelayer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])\":{\"notice\":\"Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol\":\"OVM_L1MultiMessageRelayer\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\nimport { iOVM_L1MultiMessageRelayer } from \\\"../../../iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\\\";\\n\\n/* Contract Imports */\\nimport { Lib_AddressResolver } from \\\"../../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n\\n/**\\n * @title OVM_L1MultiMessageRelayer\\n * @dev The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the \\n * relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain\\n * Message Sender.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_L1MultiMessageRelayer is iOVM_L1MultiMessageRelayer, Lib_AddressResolver {\\n\\n /***************\\n * Constructor *\\n ***************/\\n constructor(\\n address _libAddressManager\\n ) \\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyBatchRelayer() {\\n require(\\n msg.sender == resolve(\\\"OVM_L2BatchMessageRelayer\\\"),\\n \\\"OVM_L1MultiMessageRelayer: Function can only be called by the OVM_L2BatchMessageRelayer\\\"\\n );\\n _;\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @notice Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\\n * @param _messages An array of L2 to L1 messages\\n */\\n function batchRelayMessages(L2ToL1Message[] calldata _messages) \\n override\\n external\\n onlyBatchRelayer \\n {\\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(resolve(\\\"Proxy__OVM_L1CrossDomainMessenger\\\"));\\n for (uint256 i = 0; i < _messages.length; i++) {\\n L2ToL1Message memory message = _messages[i];\\n messenger.relayMessage(\\n message.target,\\n message.sender,\\n message.message,\\n message.messageNonce,\\n message.proof\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x83fdf5867642a7ecb73a0ef082c966a9d8c348eecdc353f48640476f8508cdd5\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/**\\n * @title iAbs_BaseCrossDomainMessenger\\n */\\ninterface iAbs_BaseCrossDomainMessenger {\\n\\n /**********\\n * Events *\\n **********/\\n event SentMessage(bytes message);\\n event RelayedMessage(bytes32 msgHash);\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xc2bd6b373daae2ede34281f4be5938d02b9d1cfb056b40d65ff70b7f16ce3c86\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iAbs_BaseCrossDomainMessenger } from \\\"./iAbs_BaseCrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title iOVM_L1CrossDomainMessenger\\n */\\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n struct L2MessageInclusionProof {\\n bytes32 stateRoot;\\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\\n bytes stateTrieWitness;\\n bytes storageTrieWitness;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _proof Inclusion proof for the given message.\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) external;\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _sender Original sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xdcd239d0b215e400674d78e8db4ac12ba18efc34fa78e24c2ff867f61062dba2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Interface Imports */\\nimport { iOVM_L1CrossDomainMessenger } from \\\"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\\\";\\ninterface iOVM_L1MultiMessageRelayer {\\n\\n struct L2ToL1Message {\\n address target;\\n address sender;\\n bytes message;\\n uint256 messageNonce;\\n iOVM_L1CrossDomainMessenger.L2MessageInclusionProof proof;\\n }\\n\\n function batchRelayMessages(L2ToL1Message[] calldata _messages) external; \\n}\\n\",\"keccak256\":\"0x7135d8578f07e7cc04930e742d0e9a787345bf8ddbfc17fcad94db1d43a299a1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610a00380380610a0083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b61096f806100916000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806316e9cd9b1461003b578063461a447814610050575b600080fd5b61004e61004936600461055b565b610079565b005b61006361005e3660046105ca565b6101d7565b60405161007091906106b9565b60405180910390f35b6100b76040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101d7565b6001600160a01b0316336001600160a01b0316146100f05760405162461bcd60e51b81526004016100e7906107b5565b60405180910390fd5b6000610113604051806060016040528060218152602001610919602191396101d7565b905060005b828110156101d157600084848381811061012e57fe5b90506020028101906101409190610838565b6101499061087b565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd95610192959094909392916004016106cd565b600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505060019093019250610118915050565b50505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561023757818101518382015260200161021f565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561028157600080fd5b505afa158015610295573d6000803e3d6000fd5b505050506040513d60208110156102ab57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102c957fe5b6102dc601f8401601f1916602001610857565b90508281528383830111156102f057600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102b057600080fd5b600082601f83011261032e578081fd5b61033d838335602085016102b5565b9392505050565b600060a08284031215610355578081fd5b60405160a0810167ffffffffffffffff828210818311171561037357fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103b057600080fd5b506103bd8582860161031e565b6080830152505092915050565b6000604082840312156103db578081fd5b6040516040810167ffffffffffffffff82821081831117156103f957fe5b816040528293508435835260209150818501358181111561041957600080fd5b8501601f8101871361042a57600080fd5b80358281111561043657fe5b8381029250610446848401610857565b8181528481019083860185850187018b101561046157600080fd5b600095505b83861015610484578035835260019590950194918601918601610466565b5080868801525050505050505092915050565b600060a082840312156104a8578081fd5b6104b260a0610857565b905081358152602082013567ffffffffffffffff808211156104d357600080fd5b6104df85838601610344565b602084015260408401359150808211156104f857600080fd5b610504858386016103ca565b6040840152606084013591508082111561051d57600080fd5b6105298583860161031e565b6060840152608084013591508082111561054257600080fd5b5061054f8482850161031e565b60808301525092915050565b6000806020838503121561056d578182fd5b823567ffffffffffffffff80821115610584578384fd5b818501915085601f830112610597578384fd5b8135818111156105a5578485fd5b86602080830285010111156105b8578485fd5b60209290920196919550909350505050565b6000602082840312156105db578081fd5b813567ffffffffffffffff8111156105f1578182fd5b8201601f81018413610601578182fd5b610610848235602084016102b5565b949350505050565b60008151808452815b8181101561063d57602081850181015186830182015201610621565b8181111561064e5782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106ae578451825293830193600192909201919083019061068e565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a0604082018190526000906106f990830186610618565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261075a610140830182610618565b9050604085015182820360408401526107738282610663565b9150506060850151828203606084015261078d8282610618565b915050608085015182820360808401526107a78282610618565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261084d578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561087357fe5b604052919050565b600060a0823603121561088c578081fd5b60405160a0810167ffffffffffffffff82821081831117156108aa57fe5b816040526108b785610307565b83526108c560208601610307565b602084015260408501359150808211156108dd578384fd5b6108e93683870161031e565b604084015260608501356060840152608085013591508082111561090b578384fd5b5061054f3682860161049756fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220496799237919f1a19e0ff724ed914173ffae08bf4e918b2ba00351303fe8d51464736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806316e9cd9b1461003b578063461a447814610050575b600080fd5b61004e61004936600461055b565b610079565b005b61006361005e3660046105ca565b6101d7565b60405161007091906106b9565b60405180910390f35b6100b76040518060400160405280601981526020017f4f564d5f4c3242617463684d65737361676552656c61796572000000000000008152506101d7565b6001600160a01b0316336001600160a01b0316146100f05760405162461bcd60e51b81526004016100e7906107b5565b60405180910390fd5b6000610113604051806060016040528060218152602001610919602191396101d7565b905060005b828110156101d157600084848381811061012e57fe5b90506020028101906101409190610838565b6101499061087b565b8051602082015160408084015160608501516080860151925163d7fd19dd60e01b81529596506001600160a01b0389169563d7fd19dd95610192959094909392916004016106cd565b600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505060019093019250610118915050565b50505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561023757818101518382015260200161021f565b50505050905090810190601f1680156102645780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561028157600080fd5b505afa158015610295573d6000803e3d6000fd5b505050506040513d60208110156102ab57600080fd5b505190505b919050565b600067ffffffffffffffff8311156102c957fe5b6102dc601f8401601f1916602001610857565b90508281528383830111156102f057600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b03811681146102b057600080fd5b600082601f83011261032e578081fd5b61033d838335602085016102b5565b9392505050565b600060a08284031215610355578081fd5b60405160a0810167ffffffffffffffff828210818311171561037357fe5b816040528293508435835260208501356020840152604085013560408401526060850135606084015260808501359150808211156103b057600080fd5b506103bd8582860161031e565b6080830152505092915050565b6000604082840312156103db578081fd5b6040516040810167ffffffffffffffff82821081831117156103f957fe5b816040528293508435835260209150818501358181111561041957600080fd5b8501601f8101871361042a57600080fd5b80358281111561043657fe5b8381029250610446848401610857565b8181528481019083860185850187018b101561046157600080fd5b600095505b83861015610484578035835260019590950194918601918601610466565b5080868801525050505050505092915050565b600060a082840312156104a8578081fd5b6104b260a0610857565b905081358152602082013567ffffffffffffffff808211156104d357600080fd5b6104df85838601610344565b602084015260408401359150808211156104f857600080fd5b610504858386016103ca565b6040840152606084013591508082111561051d57600080fd5b6105298583860161031e565b6060840152608084013591508082111561054257600080fd5b5061054f8482850161031e565b60808301525092915050565b6000806020838503121561056d578182fd5b823567ffffffffffffffff80821115610584578384fd5b818501915085601f830112610597578384fd5b8135818111156105a5578485fd5b86602080830285010111156105b8578485fd5b60209290920196919550909350505050565b6000602082840312156105db578081fd5b813567ffffffffffffffff8111156105f1578182fd5b8201601f81018413610601578182fd5b610610848235602084016102b5565b949350505050565b60008151808452815b8181101561063d57602081850181015186830182015201610621565b8181111561064e5782602083870101525b50601f01601f19169290920160200192915050565b6000604083018251845260208084015160408287015282815180855260608801915083830194508592505b808310156106ae578451825293830193600192909201919083019061068e565b509695505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a0604082018190526000906106f990830186610618565b846060840152828103608084015283518152602084015160a06020830152805160a0830152602081015160c0830152604081015160e083015260608101516101008301526080810151905060a061012083015261075a610140830182610618565b9050604085015182820360408401526107738282610663565b9150506060850151828203606084015261078d8282610618565b915050608085015182820360808401526107a78282610618565b9a9950505050505050505050565b60208082526057908201527f4f564d5f4c314d756c74694d65737361676552656c617965723a2046756e637460408201527f696f6e2063616e206f6e6c792062652063616c6c656420627920746865204f5660608201527f4d5f4c3242617463684d65737361676552656c61796572000000000000000000608082015260a00190565b60008235609e1983360301811261084d578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561087357fe5b604052919050565b600060a0823603121561088c578081fd5b60405160a0810167ffffffffffffffff82821081831117156108aa57fe5b816040526108b785610307565b83526108c560208601610307565b602084015260408501359150808211156108dd578384fd5b6108e93683870161031e565b604084015260608501356060840152608085013591508082111561090b578384fd5b5061054f3682860161049756fe50726f78795f5f4f564d5f4c3143726f7373446f6d61696e4d657373656e676572a2646970667358221220496799237919f1a19e0ff724ed914173ffae08bf4e918b2ba00351303fe8d51464736f6c63430007060033", - "devdoc": { - "details": "The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain Message Sender. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])": { - "params": { - "_messages": "An array of L2 to L1 messages" - } - } - }, - "title": "OVM_L1MultiMessageRelayer", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "batchRelayMessages((address,address,bytes,uint256,(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]),bytes,bytes))[])": { - "notice": "Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol:OVM_L1MultiMessageRelayer", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - } - ], - "types": { - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_SafetyChecker.json b/deployments/kovan/OVM_SafetyChecker.json deleted file mode 100644 index ec51f3f10..000000000 --- a/deployments/kovan/OVM_SafetyChecker.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "address": "0xa9770c8F8Cac8F86815Cb41DC91f0eE7a3451304", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes", - "name": "_bytecode", - "type": "bytes" - } - ], - "name": "isBytecodeSafe", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "pure", - "type": "function" - } - ], - "transactionHash": "0x32cf8baaba87cde5cf26043361e0c2955e6d31948ed3953d11def531ac7ce5ba", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0xa9770c8F8Cac8F86815Cb41DC91f0eE7a3451304", - "transactionIndex": 2, - "gasUsed": "243548", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x44cbb30014f38bdc2b802fe94de9c29e320ab1ecf3419807ea44ab740302e688", - "transactionHash": "0x32cf8baaba87cde5cf26043361e0c2955e6d31948ed3953d11def531ac7ce5ba", - "logs": [], - "blockNumber": 23637135, - "cumulativeGasUsed": "390669", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_bytecode\",\"type\":\"bytes\"}],\"name\":\"isBytecodeSafe\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Safety Checker verifies that contracts deployed on L2 do not contain any \\\"unsafe\\\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \\\"escape the sandbox\\\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \\\"prove fraud\\\" on an honestly applied transaction. Note that a \\\"safe\\\" contract requires opcodes to appear in a particular pattern; omission of \\\"unsafe\\\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"isBytecodeSafe(bytes)\":{\"params\":{\"_bytecode\":\"The bytecode to safety check.\"},\"returns\":{\"_0\":\"`true` if the bytecode is safe, `false` otherwise.\"}}},\"title\":\"OVM_SafetyChecker\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"isBytecodeSafe(bytes)\":{\"notice\":\"Returns whether or not all of the provided bytecode is safe.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol\":\"OVM_SafetyChecker\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_SafetyChecker } from \\\"../../iOVM/execution/iOVM_SafetyChecker.sol\\\";\\n\\n/**\\n * @title OVM_SafetyChecker\\n * @dev The Safety Checker verifies that contracts deployed on L2 do not contain any\\n * \\\"unsafe\\\" operations. An operation is considered unsafe if it would access state variables which\\n * are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used\\n * to \\\"escape the sandbox\\\" of the OVM, resulting in non-deterministic fraud proofs. \\n * That is, an attacker would be able to \\\"prove fraud\\\" on an honestly applied transaction.\\n * Note that a \\\"safe\\\" contract requires opcodes to appear in a particular pattern;\\n * omission of \\\"unsafe\\\" opcodes is necessary, but not sufficient.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_SafetyChecker is iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n /**\\n * Returns whether or not all of the provided bytecode is safe.\\n * @param _bytecode The bytecode to safety check.\\n * @return `true` if the bytecode is safe, `false` otherwise.\\n */\\n function isBytecodeSafe(\\n bytes memory _bytecode\\n )\\n override\\n external\\n pure\\n returns (bool)\\n {\\n // autogenerated by gen_safety_checker_constants.py\\n // number of bytes to skip for each opcode\\n uint256[8] memory opcodeSkippableBytes = [\\n uint256(0x0001010101010101010101010000000001010101010101010101010101010000),\\n uint256(0x0100000000000000000000000000000000000000010101010101000000010100),\\n uint256(0x0000000000000000000000000000000001010101000000010101010100000000),\\n uint256(0x0203040500000000000000000000000000000000000000000000000000000000),\\n uint256(0x0101010101010101010101010101010101010101010101010101010101010101),\\n uint256(0x0101010101000000000000000000000000000000000000000000000000000000),\\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000),\\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000)\\n ];\\n // Mask to gate opcode specific cases\\n uint256 opcodeGateMask = ~uint256(0xffffffffffffffffffffffe000000000fffffffff070ffff9c0ffffec000f001);\\n // Halting opcodes\\n uint256 opcodeHaltingMask = ~uint256(0x4008000000000000000000000000000000000000004000000000000000000001);\\n // PUSH opcodes\\n uint256 opcodePushMask = ~uint256(0xffffffff000000000000000000000000);\\n\\n uint256 codeLength;\\n uint256 _pc;\\n assembly {\\n _pc := add(_bytecode, 0x20)\\n }\\n codeLength = _pc + _bytecode.length;\\n do {\\n // current opcode: 0x00...0xff\\n uint256 opNum;\\n\\n // inline assembly removes the extra add + bounds check\\n assembly {\\n let word := mload(_pc) //load the next 32 bytes at pc into word\\n\\n // Look up number of bytes to skip from opcodeSkippableBytes and then update indexInWord\\n // E.g. the 02030405 in opcodeSkippableBytes is the number of bytes to skip for PUSH1->4\\n // We repeat this 6 times, thus we can only skip bytes for up to PUSH4 ((1+4) * 6 = 30 < 32).\\n // If we see an opcode that is listed as 0 skippable bytes e.g. PUSH5,\\n // then we will get stuck on that indexInWord and then opNum will be set to the PUSH5 opcode.\\n let indexInWord := byte(0, mload(add(opcodeSkippableBytes, byte(0, word))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\\n _pc := add(_pc, indexInWord)\\n\\n opNum := byte(indexInWord, word)\\n }\\n\\n // + push opcodes\\n // + stop opcodes [STOP(0x00),JUMP(0x56),RETURN(0xf3),INVALID(0xfe)]\\n // + caller opcode CALLER(0x33)\\n // + blacklisted opcodes\\n uint256 opBit = 1 << opNum;\\n if (opBit & opcodeGateMask == 0) {\\n if (opBit & opcodePushMask == 0) {\\n // all pushes are valid opcodes\\n // subsequent bytes are not opcodes. Skip them.\\n _pc += (opNum - 0x5e); // PUSH1 is 0x60, so opNum-0x5f = PUSHed bytes and we +1 to\\n // skip the _pc++; line below in order to save gas ((-0x5f + 1) = -0x5e)\\n continue;\\n } else if (opBit & opcodeHaltingMask == 0) {\\n // STOP or JUMP or RETURN or INVALID (Note: REVERT is blacklisted, so not included here)\\n // We are now inside unreachable code until we hit a JUMPDEST!\\n do {\\n _pc++;\\n assembly {\\n opNum := byte(0, mload(_pc))\\n }\\n // encountered a JUMPDEST\\n if (opNum == 0x5b) break;\\n // skip PUSHed bytes\\n if ((1 << opNum) & opcodePushMask == 0) _pc += (opNum - 0x5f); // opNum-0x5f = PUSHed bytes (PUSH1 is 0x60)\\n } while (_pc < codeLength);\\n // opNum is 0x5b, so we don't continue here since the pc++ is fine\\n } else if (opNum == 0x33) { // Caller opcode\\n uint256 firstOps; // next 32 bytes of bytecode\\n uint256 secondOps; // following 32 bytes of bytecode\\n\\n assembly {\\n firstOps := mload(_pc)\\n // 37 bytes total, 5 left over --> 32 - 5 bytes = 27 bytes = 216 bits\\n secondOps := shr(216, mload(add(_pc, 0x20)))\\n }\\n\\n // Call identity precompile\\n // CALLER POP PUSH1 0x00 PUSH1 0x04 GAS CALL\\n // 32 - 8 bytes = 24 bytes = 192\\n if ((firstOps >> 192) == 0x3350600060045af1) {\\n _pc += 8;\\n // Call EM and abort execution if instructed\\n // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x0E ADD JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x00 REVERT JUMPDEST RETURNDATASIZE PUSH1 0x01 EQ ISZERO PC PUSH1 0x0a ADD JUMPI PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST \\n } else if (firstOps == 0x336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760 && secondOps == 0x016000f35b) {\\n _pc += 37;\\n } else {\\n return false;\\n }\\n continue;\\n } else {\\n // encountered a non-whitelisted opcode!\\n return false;\\n }\\n }\\n _pc++;\\n } while (_pc < codeLength);\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x3053b7b1bb58319d8e69e246270d123cc0085f5cc464707f45b784cae0acd774\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_SafetyChecker\\n */\\ninterface iOVM_SafetyChecker {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\\n}\\n\",\"keccak256\":\"0xde6639676d4ec4f77297652d5ede2429bc93e74e11fefd9e9de4bc92dd784878\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610373806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212203094e4fb12ca7ef3e9253b892048a07ad2cd882f0940e964f04661606fdc1fe664736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a44eb59a14610030575b600080fd5b6100d66004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184600183028401116401000000008311171561009557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506100ea945050505050565b604080519115158252519081900360200190f35b60408051610100810182527e0101010101010101010101000000000101010101010101010101010101000081526b010101010101000000010100600160f81b016020808301919091526f0101010100000001010101010000000092820192909252630203040560e01b60608201527f0101010101010101010101010101010101010101010101010101010101010101608082015264010101010160d81b60a0820152600060c0820181905260e0820181905283519092741fffffffff000000000f8f000063f000013fff0ffe916a40000000000000000000026117ff60f31b039163ffffffff60601b1991870181019087015b8051600081811a880151811a82811a890151821a0182811a890151821a0182811a890151821a0182811a890151821a0182811a89015190911a01918201911a6001811b86811661032057808516610239575001605d1901610326565b80861661027e575b8280600101935050825160001a915081605b141561025e57610279565b6001821b851661027157918101605e1901915b838310610241575b610320565b816033141561030f578251602084015160d81c673350600060045af160c083901c14156102b057600885019450610306565b817f336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a0157601480156102e357508064016000f35b145b156102f357602585019450610306565b60009a5050505050505050505050610338565b50505050610326565b600098505050505050505050610338565b50506001015b8181106101dd57600196505050505050505b91905056fea26469706673582212203094e4fb12ca7ef3e9253b892048a07ad2cd882f0940e964f04661606fdc1fe664736f6c63430007060033", - "devdoc": { - "details": "The Safety Checker verifies that contracts deployed on L2 do not contain any \"unsafe\" operations. An operation is considered unsafe if it would access state variables which are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction. Note that a \"safe\" contract requires opcodes to appear in a particular pattern; omission of \"unsafe\" opcodes is necessary, but not sufficient. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "isBytecodeSafe(bytes)": { - "params": { - "_bytecode": "The bytecode to safety check." - }, - "returns": { - "_0": "`true` if the bytecode is safe, `false` otherwise." - } - } - }, - "title": "OVM_SafetyChecker", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "isBytecodeSafe(bytes)": { - "notice": "Returns whether or not all of the provided bytecode is safe." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateCommitmentChain.json b/deployments/kovan/OVM_StateCommitmentChain.json deleted file mode 100644 index c9ef25513..000000000 --- a/deployments/kovan/OVM_StateCommitmentChain.json +++ /dev/null @@ -1,505 +0,0 @@ -{ - "address": "0x63139eC71aFf564351b2EbA21bE114D2069021cB", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_fraudProofWindow", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_sequencerPublishWindow", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_batchIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "_batchRoot", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_batchSize", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_prevTotalElements", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_extraData", - "type": "bytes" - } - ], - "name": "StateBatchAppended", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_batchIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "_batchRoot", - "type": "bytes32" - } - ], - "name": "StateBatchDeleted", - "type": "event" - }, - { - "inputs": [], - "name": "FRAUD_PROOF_WINDOW", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SEQUENCER_PUBLISH_WINDOW", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "_batch", - "type": "bytes32[]" - }, - { - "internalType": "uint256", - "name": "_shouldStartAtElement", - "type": "uint256" - } - ], - "name": "appendStateBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "batches", - "outputs": [ - { - "internalType": "contract iOVM_ChainStorageContainer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_batchHeader", - "type": "tuple" - } - ], - "name": "deleteStateBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getLastSequencerTimestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "_lastSequencerTimestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalBatches", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalBatches", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalElements", - "outputs": [ - { - "internalType": "uint256", - "name": "_totalElements", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_batchHeader", - "type": "tuple" - } - ], - "name": "insideFraudProofWindow", - "outputs": [ - { - "internalType": "bool", - "name": "_inside", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_element", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "batchIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "batchRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "batchSize", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "prevTotalElements", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "internalType": "struct Lib_OVMCodec.ChainBatchHeader", - "name": "_batchHeader", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "siblings", - "type": "bytes32[]" - } - ], - "internalType": "struct Lib_OVMCodec.ChainInclusionProof", - "name": "_proof", - "type": "tuple" - } - ], - "name": "verifyStateCommitment", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x4c0d30924c696fea16ac0447dfd2f99a413f8435511dc7bc7f17ed081d36bd26", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x63139eC71aFf564351b2EbA21bE114D2069021cB", - "transactionIndex": 0, - "gasUsed": "1620938", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe9bda56bde047ad73b05a03e4f9d610098804e3f8350c56949083d37c8d50629", - "transactionHash": "0x4c0d30924c696fea16ac0447dfd2f99a413f8435511dc7bc7f17ed081d36bd26", - "logs": [], - "blockNumber": 23637140, - "cumulativeGasUsed": "1620938", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7", - 60000, - 60000 - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fraudProofWindow\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_sequencerPublishWindow\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_prevTotalElements\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"StateBatchAppended\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_batchRoot\",\"type\":\"bytes32\"}],\"name\":\"StateBatchDeleted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FRAUD_PROOF_WINDOW\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SEQUENCER_PUBLISH_WINDOW\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"_batch\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256\",\"name\":\"_shouldStartAtElement\",\"type\":\"uint256\"}],\"name\":\"appendStateBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batches\",\"outputs\":[{\"internalType\":\"contract iOVM_ChainStorageContainer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"}],\"name\":\"deleteStateBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastSequencerTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_lastSequencerTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalBatches\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBatches\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalElements\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalElements\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"}],\"name\":\"insideFraudProofWindow\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_inside\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_element\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"_batchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"verifyStateCommitment\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Commitment Chain (SCC) contract contains a list of proposed state roots which Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique state root calculated off-chain by applying the canonical transactions one by one. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"appendStateBatch(bytes32[],uint256)\":{\"params\":{\"_batch\":\"Batch of state roots.\",\"_shouldStartAtElement\":\"Index of the element at which this batch should start.\"}},\"batches()\":{\"returns\":{\"_0\":\"Reference to the batch storage container.\"}},\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))\":{\"params\":{\"_batchHeader\":\"Header of the batch to start deleting from.\"}},\"getLastSequencerTimestamp()\":{\"returns\":{\"_lastSequencerTimestamp\":\"Last sequencer batch timestamp.\"}},\"getTotalBatches()\":{\"returns\":{\"_totalBatches\":\"Total submitted batches.\"}},\"getTotalElements()\":{\"returns\":{\"_totalElements\":\"Total submitted elements.\"}},\"insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))\":{\"params\":{\"_batchHeader\":\"Header of the batch to check.\"},\"returns\":{\"_inside\":\"Whether or not the batch is inside the fraud proof window.\"}},\"verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"params\":{\"_batchHeader\":\"Header of the batch in which the element was included.\",\"_element\":\"Hash of the element to verify a proof for.\",\"_proof\":\"Merkle inclusion proof for the element.\"}}},\"title\":\"OVM_StateCommitmentChain\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"appendStateBatch(bytes32[],uint256)\":{\"notice\":\"Appends a batch of state roots to the chain.\"},\"batches()\":{\"notice\":\"Accesses the batch storage container.\"},\"deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))\":{\"notice\":\"Deletes all state roots after (and including) a given batch.\"},\"getLastSequencerTimestamp()\":{\"notice\":\"Retrieves the timestamp of the last batch submitted by the sequencer.\"},\"getTotalBatches()\":{\"notice\":\"Retrieves the total number of batches submitted.\"},\"getTotalElements()\":{\"notice\":\"Retrieves the total number of elements submitted.\"},\"insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))\":{\"notice\":\"Checks whether a given batch is still inside its fraud proof window.\"},\"verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))\":{\"notice\":\"Verifies a batch inclusion proof.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol\":\"OVM_StateCommitmentChain\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_MerkleTree } from \\\"../../libraries/utils/Lib_MerkleTree.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\nimport { iOVM_StateCommitmentChain } from \\\"../../iOVM/chain/iOVM_StateCommitmentChain.sol\\\";\\nimport { iOVM_CanonicalTransactionChain } from \\\"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_ChainStorageContainer } from \\\"../../iOVM/chain/iOVM_ChainStorageContainer.sol\\\";\\n\\n/* External Imports */\\nimport '@openzeppelin/contracts/math/SafeMath.sol';\\n\\n/**\\n * @title OVM_StateCommitmentChain\\n * @dev The State Commitment Chain (SCC) contract contains a list of proposed state roots which\\n * Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). \\n * Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique\\n * state root calculated off-chain by applying the canonical transactions one by one.\\n *\\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResolver {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 public FRAUD_PROOF_WINDOW;\\n uint256 public SEQUENCER_PUBLISH_WINDOW;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(\\n address _libAddressManager,\\n uint256 _fraudProofWindow,\\n uint256 _sequencerPublishWindow\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n public\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n )\\n {\\n return iOVM_ChainStorageContainer(\\n resolve(\\\"OVM_ChainStorageContainer:SCC:batches\\\")\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getTotalElements()\\n override\\n public\\n view\\n returns (\\n uint256 _totalElements\\n )\\n {\\n (uint40 totalElements, ) = _getBatchExtraData();\\n return uint256(totalElements);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getTotalBatches()\\n override\\n public\\n view\\n returns (\\n uint256 _totalBatches\\n )\\n {\\n return batches().length();\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function getLastSequencerTimestamp()\\n override\\n public\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n )\\n {\\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\\n return uint256(lastSequencerTimestamp);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function appendStateBatch(\\n bytes32[] memory _batch,\\n uint256 _shouldStartAtElement\\n )\\n override\\n public\\n {\\n // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the\\n // publication of batches by some other user.\\n require(\\n _shouldStartAtElement == getTotalElements(),\\n \\\"Actual batch start index does not match expected start index.\\\"\\n );\\n\\n // Proposers must have previously staked at the BondManager\\n require(\\n iOVM_BondManager(resolve(\\\"OVM_BondManager\\\")).isCollateralized(msg.sender),\\n \\\"Proposer does not have enough collateral posted\\\"\\n );\\n\\n require(\\n _batch.length > 0,\\n \\\"Cannot submit an empty state batch.\\\"\\n );\\n\\n require(\\n getTotalElements() + _batch.length <= iOVM_CanonicalTransactionChain(resolve(\\\"OVM_CanonicalTransactionChain\\\")).getTotalElements(),\\n \\\"Number of state roots cannot exceed the number of canonical transactions.\\\"\\n );\\n\\n // Pass the block's timestamp and the publisher of the data\\n // to be used in the fraud proofs\\n _appendBatch(\\n _batch,\\n abi.encode(block.timestamp, msg.sender)\\n );\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n override\\n public\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"State batches can only be deleted by the OVM_FraudVerifier.\\\"\\n );\\n\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n insideFraudProofWindow(_batchHeader),\\n \\\"State batches can only be deleted within the fraud proof window.\\\"\\n );\\n\\n _deleteBatch(_batchHeader);\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n require(\\n Lib_MerkleTree.verify(\\n _batchHeader.batchRoot,\\n _element,\\n _proof.index,\\n _proof.siblings,\\n _batchHeader.batchSize\\n ),\\n \\\"Invalid inclusion proof.\\\"\\n );\\n\\n return true;\\n }\\n\\n /**\\n * @inheritdoc iOVM_StateCommitmentChain\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n override\\n public\\n view\\n returns (\\n bool _inside\\n )\\n {\\n (uint256 timestamp,) = abi.decode(\\n _batchHeader.extraData,\\n (uint256, address)\\n );\\n\\n require(\\n timestamp != 0,\\n \\\"Batch header timestamp cannot be zero\\\"\\n );\\n return SafeMath.add(timestamp, FRAUD_PROOF_WINDOW) > block.timestamp;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Parses the batch context from the extra data.\\n * @return Total number of elements submitted.\\n * @return Timestamp of the last batch submitted by the sequencer.\\n */\\n function _getBatchExtraData()\\n internal\\n view\\n returns (\\n uint40,\\n uint40\\n )\\n {\\n bytes27 extraData = batches().getGlobalMetadata();\\n\\n uint40 totalElements;\\n uint40 lastSequencerTimestamp;\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\\n lastSequencerTimestamp := shr(40, and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\\n }\\n\\n return (\\n totalElements,\\n lastSequencerTimestamp\\n );\\n }\\n\\n /**\\n * Encodes the batch context for the extra data.\\n * @param _totalElements Total number of elements submitted.\\n * @param _lastSequencerTimestamp Timestamp of the last batch submitted by the sequencer.\\n * @return Encoded batch context.\\n */\\n function _makeBatchExtraData(\\n uint40 _totalElements,\\n uint40 _lastSequencerTimestamp\\n )\\n internal\\n pure\\n returns (\\n bytes27\\n )\\n {\\n bytes27 extraData;\\n assembly {\\n extraData := _totalElements\\n extraData := or(extraData, shl(40, _lastSequencerTimestamp))\\n extraData := shl(40, extraData)\\n }\\n\\n return extraData;\\n }\\n\\n /**\\n * Appends a batch to the chain.\\n * @param _batch Elements within the batch.\\n * @param _extraData Any extra data to append to the batch.\\n */\\n function _appendBatch(\\n bytes32[] memory _batch,\\n bytes memory _extraData\\n )\\n internal\\n {\\n address sequencer = resolve(\\\"OVM_Sequencer\\\");\\n (uint40 totalElements, uint40 lastSequencerTimestamp) = _getBatchExtraData();\\n\\n if (msg.sender == sequencer) {\\n lastSequencerTimestamp = uint40(block.timestamp);\\n } else {\\n // We keep track of the last batch submitted by the sequencer so there's a window in\\n // which only the sequencer can publish state roots. A window like this just reduces\\n // the chance of \\\"system breaking\\\" state roots being published while we're still in\\n // testing mode. This window should be removed or significantly reduced in the future.\\n require(\\n lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp,\\n \\\"Cannot publish state roots within the sequencer publication window.\\\"\\n );\\n }\\n\\n Lib_OVMCodec.ChainBatchHeader memory batchHeader = Lib_OVMCodec.ChainBatchHeader({\\n batchIndex: getTotalBatches(),\\n batchRoot: Lib_MerkleTree.getMerkleRoot(_batch),\\n batchSize: _batch.length,\\n prevTotalElements: totalElements,\\n extraData: _extraData\\n });\\n\\n emit StateBatchAppended(\\n batchHeader.batchIndex,\\n batchHeader.batchRoot,\\n batchHeader.batchSize,\\n batchHeader.prevTotalElements,\\n batchHeader.extraData\\n );\\n\\n batches().push(\\n Lib_OVMCodec.hashBatchHeader(batchHeader),\\n _makeBatchExtraData(\\n uint40(batchHeader.prevTotalElements + batchHeader.batchSize),\\n lastSequencerTimestamp\\n )\\n );\\n }\\n\\n /**\\n * Removes a batch and all subsequent batches from the chain.\\n * @param _batchHeader Header of the batch to remove.\\n */\\n function _deleteBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n {\\n require(\\n _batchHeader.batchIndex < batches().length(),\\n \\\"Invalid batch index.\\\"\\n );\\n\\n require(\\n _isValidBatchHeader(_batchHeader),\\n \\\"Invalid batch header.\\\"\\n );\\n\\n batches().deleteElementsAfterInclusive(\\n _batchHeader.batchIndex,\\n _makeBatchExtraData(\\n uint40(_batchHeader.prevTotalElements),\\n 0\\n )\\n );\\n\\n emit StateBatchDeleted(\\n _batchHeader.batchIndex,\\n _batchHeader.batchRoot\\n );\\n }\\n\\n /**\\n * Checks that a batch header matches the stored hash for the given index.\\n * @param _batchHeader Batch header to validate.\\n * @return Whether or not the header matches the stored one.\\n */\\n function _isValidBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n view\\n returns (\\n bool\\n )\\n {\\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\\n }\\n}\\n\",\"keccak256\":\"0x69cf5f5859dbae537accdc4be2a82ec243d6519ee9fc8d01a9b5cbbd1a198fe8\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_ChainStorageContainer } from \\\"./iOVM_ChainStorageContainer.sol\\\";\\n\\n/**\\n * @title iOVM_CanonicalTransactionChain\\n */\\ninterface iOVM_CanonicalTransactionChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event TransactionEnqueued(\\n address _l1TxOrigin,\\n address _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 _queueIndex,\\n uint256 _timestamp\\n );\\n\\n event QueueBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event SequencerBatchAppended(\\n uint256 _startingQueueIndex,\\n uint256 _numQueueElements,\\n uint256 _totalElements\\n );\\n\\n event TransactionBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n\\n /**\\n * Accesses the batch storage container.\\n * @return Reference to the batch storage container.\\n */\\n function batches()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Accesses the queue storage container.\\n * @return Reference to the queue storage container.\\n */\\n function queue()\\n external\\n view\\n returns (\\n iOVM_ChainStorageContainer\\n );\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Returns the index of the next element to be enqueued.\\n * @return Index for the next queue element.\\n */\\n function getNextQueueIndex()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Gets the queue element at a particular index.\\n * @param _index Index of the queue element to access.\\n * @return _element Queue element at the given index.\\n */\\n function getQueueElement(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n Lib_OVMCodec.QueueElement memory _element\\n );\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Get the number of queue elements which have not yet been included.\\n * @return Number of pending queue elements.\\n */\\n function getNumPendingQueueElements()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n /**\\n * Retrieves the length of the queue, including\\n * both pending and canonical transactions.\\n * @return Length of the queue.\\n */\\n function getQueueLength()\\n external\\n view\\n returns (\\n uint40\\n );\\n\\n\\n /**\\n * Adds a transaction to the queue.\\n * @param _target Target contract to send the transaction to.\\n * @param _gasLimit Gas limit for the given transaction.\\n * @param _data Transaction data.\\n */\\n function enqueue(\\n address _target,\\n uint256 _gasLimit,\\n bytes memory _data\\n )\\n external;\\n\\n /**\\n * Appends a given number of queued transactions as a single batch.\\n * @param _numQueuedTransactions Number of transactions to append.\\n */\\n function appendQueueBatch(\\n uint256 _numQueuedTransactions\\n )\\n external;\\n\\n /**\\n * Allows the sequencer to append a batch of transactions.\\n * @dev This function uses a custom encoding scheme for efficiency reasons.\\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\\n * .param _contexts Array of batch contexts.\\n * .param _transactionDataFields Array of raw transaction data.\\n */\\n function appendSequencerBatch(\\n // uint40 _shouldStartAtElement,\\n // uint24 _totalElementsToAppend,\\n // BatchContext[] _contexts,\\n // bytes[] _transactionDataFields\\n )\\n external;\\n\\n /**\\n * Verifies whether a transaction is included in the chain.\\n * @param _transaction Transaction to verify.\\n * @param _txChainElement Transaction chain element corresponding to the transaction.\\n * @param _batchHeader Header of the batch the transaction was included in.\\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\\n * @return True if the transaction exists in the CTC, false if not.\\n */\\n function verifyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction,\\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\\n )\\n external\\n view\\n returns (\\n bool\\n );\\n}\\n\",\"keccak256\":\"0xb5e55488a1982841c07cdf5ff475da4789596f111dd48f01b1918ee4c775cf3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title iOVM_ChainStorageContainer\\n */\\ninterface iOVM_ChainStorageContainer {\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\\n * 27 bytes to store arbitrary data.\\n * @param _globalMetadata New global metadata to set.\\n */\\n function setGlobalMetadata(\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata()\\n external\\n view\\n returns (\\n bytes27\\n );\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length()\\n external\\n view\\n returns (\\n uint256\\n );\\n\\n /**\\n * Pushes an object into the container.\\n * @param _object A 32 byte value to insert into the container.\\n */\\n function push(\\n bytes32 _object\\n )\\n external;\\n\\n /**\\n * Pushes an object into the container. Function allows setting the global metadata since\\n * we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global\\n * metadata (it's an optimization).\\n * @param _object A 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push(\\n bytes32 _object,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. A useful optimization.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB\\n )\\n external;\\n\\n /**\\n * Pushes two objects into the container at the same time. Also allows setting the global\\n * metadata field.\\n * @param _objectA First 32 byte value to insert into the container.\\n * @param _objectB Second 32 byte value to insert into the container.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function push2(\\n bytes32 _objectA,\\n bytes32 _objectB,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Retrieves an object from the container.\\n * @param _index Index of the particular object to access.\\n * @return 32 byte object value.\\n */\\n function get(\\n uint256 _index\\n )\\n external\\n view\\n returns (\\n bytes32\\n );\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index\\n )\\n external;\\n\\n /**\\n * Removes all objects after and including a given index. Also allows setting the global\\n * metadata field.\\n * @param _index Object index to delete from.\\n * @param _globalMetadata New global metadata for the container.\\n */\\n function deleteElementsAfterInclusive(\\n uint256 _index,\\n bytes27 _globalMetadata\\n )\\n external;\\n\\n /**\\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\\n * any objects before and including the given index.\\n */\\n function setNextOverwritableIndex(\\n uint256 _index\\n )\\n external;\\n}\\n\",\"keccak256\":\"0x6bce68a9a74705ec906db3dde29673f8ba902bf71f94f47ccbf1db61d7da55b2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateCommitmentChain\\n */\\ninterface iOVM_StateCommitmentChain {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event StateBatchAppended(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot,\\n uint256 _batchSize,\\n uint256 _prevTotalElements,\\n bytes _extraData\\n );\\n\\n event StateBatchDeleted(\\n uint256 indexed _batchIndex,\\n bytes32 _batchRoot\\n );\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements()\\n external\\n view\\n returns (\\n uint256 _totalElements\\n );\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches()\\n external\\n view\\n returns (\\n uint256 _totalBatches\\n );\\n\\n /**\\n * Retrieves the timestamp of the last batch submitted by the sequencer.\\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\\n */\\n function getLastSequencerTimestamp()\\n external\\n view\\n returns (\\n uint256 _lastSequencerTimestamp\\n );\\n\\n /**\\n * Appends a batch of state roots to the chain.\\n * @param _batch Batch of state roots.\\n * @param _shouldStartAtElement Index of the element at which this batch should start.\\n */\\n function appendStateBatch(\\n bytes32[] calldata _batch,\\n uint256 _shouldStartAtElement\\n )\\n external;\\n\\n /**\\n * Deletes all state roots after (and including) a given batch.\\n * @param _batchHeader Header of the batch to start deleting from.\\n */\\n function deleteStateBatch(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external;\\n\\n /**\\n * Verifies a batch inclusion proof.\\n * @param _element Hash of the element to verify a proof for.\\n * @param _batchHeader Header of the batch in which the element was included.\\n * @param _proof Merkle inclusion proof for the element.\\n */\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n )\\n external\\n view\\n returns (\\n bool _verified\\n );\\n\\n /**\\n * Checks whether a given batch is still inside its fraud proof window.\\n * @param _batchHeader Header of the batch to check.\\n * @return _inside Whether or not the batch is inside the fraud proof window.\\n */\\n function insideFraudProofWindow(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n external\\n view\\n returns (\\n bool _inside\\n );\\n}\\n\",\"keccak256\":\"0x6646d6ff392b81aab52a7a277e91540819464751de0af5afd1962094b2e92448\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_MerkleTree\\n * @author River Keefer\\n */\\nlibrary Lib_MerkleTree {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\\n * If you do not know the original length of elements for the tree you are verifying,\\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\\n * @param _elements Array of hashes from which to generate a merkle root.\\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\\n */\\n function getMerkleRoot(\\n bytes32[] memory _elements\\n )\\n internal\\n view\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _elements.length > 0,\\n \\\"Lib_MerkleTree: Must provide at least one leaf hash.\\\"\\n );\\n\\n if (_elements.length == 0) {\\n return _elements[0];\\n }\\n\\n uint256[16] memory defaults = [\\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\\n ];\\n\\n // Reserve memory space for our hashes.\\n bytes memory buf = new bytes(64);\\n\\n // We'll need to keep track of left and right siblings.\\n bytes32 leftSibling;\\n bytes32 rightSibling;\\n\\n // Number of non-empty nodes at the current depth.\\n uint256 rowSize = _elements.length;\\n\\n // Current depth, counting from 0 at the leaves\\n uint256 depth = 0;\\n\\n // Common sub-expressions\\n uint256 halfRowSize; // rowSize / 2\\n bool rowSizeIsOdd; // rowSize % 2 == 1\\n\\n while (rowSize > 1) {\\n halfRowSize = rowSize / 2;\\n rowSizeIsOdd = rowSize % 2 == 1;\\n\\n for (uint256 i = 0; i < halfRowSize; i++) {\\n leftSibling = _elements[(2 * i) ];\\n rightSibling = _elements[(2 * i) + 1];\\n assembly {\\n mstore(add(buf, 32), leftSibling )\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[i] = keccak256(buf);\\n }\\n\\n if (rowSizeIsOdd) {\\n leftSibling = _elements[rowSize - 1];\\n rightSibling = bytes32(defaults[depth]);\\n assembly {\\n mstore(add(buf, 32), leftSibling)\\n mstore(add(buf, 64), rightSibling)\\n }\\n\\n _elements[halfRowSize] = keccak256(buf);\\n }\\n\\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\\n depth++;\\n }\\n\\n return _elements[0];\\n }\\n\\n /**\\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\\n * of leaves generated is a known, correct input, and does not return true for indices \\n * extending past that index (even if _siblings would be otherwise valid.)\\n * @param _root The Merkle root to verify against.\\n * @param _leaf The leaf hash to verify inclusion of.\\n * @param _index The index in the tree of this leaf.\\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \\n * @param _totalLeaves The total number of leaves originally passed into.\\n * @return Whether or not the merkle branch and leaf passes verification.\\n */\\n function verify(\\n bytes32 _root,\\n bytes32 _leaf,\\n uint256 _index,\\n bytes32[] memory _siblings,\\n uint256 _totalLeaves\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _totalLeaves > 0,\\n \\\"Lib_MerkleTree: Total leaves must be greater than zero.\\\"\\n );\\n\\n require(\\n _index < _totalLeaves,\\n \\\"Lib_MerkleTree: Index out of bounds.\\\"\\n );\\n\\n require(\\n _siblings.length == _ceilLog2(_totalLeaves),\\n \\\"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\\\"\\n );\\n\\n bytes32 computedRoot = _leaf;\\n\\n for (uint256 i = 0; i < _siblings.length; i++) {\\n if ((_index & 1) == 1) {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n _siblings[i],\\n computedRoot\\n )\\n );\\n } else {\\n computedRoot = keccak256(\\n abi.encodePacked(\\n computedRoot,\\n _siblings[i]\\n )\\n );\\n }\\n\\n _index >>= 1;\\n }\\n\\n return _root == computedRoot;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Calculates the integer ceiling of the log base 2 of an input.\\n * @param _in Unsigned input to calculate the log.\\n * @return ceil(log_base_2(_in))\\n */\\n function _ceilLog2(\\n uint256 _in\\n )\\n private\\n pure\\n returns (\\n uint256\\n )\\n { \\n require(\\n _in > 0,\\n \\\"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\\\"\\n );\\n\\n if (_in == 1) {\\n return 0;\\n }\\n\\n // Find the highest set bit (will be floor(log_2)).\\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\\n uint256 val = _in;\\n uint256 highest = 0;\\n for (uint8 i = 128; i >= 1; i >>= 1) {\\n if (val & (uint(1) << i) - 1 << i != 0) {\\n highest += i;\\n val >>= i;\\n }\\n }\\n\\n // Increment by one if this is not a perfect logarithm.\\n if ((uint(1) << highest) != _in) {\\n highest += 1;\\n }\\n\\n return highest;\\n }\\n}\\n\",\"keccak256\":\"0xd7459ac196122e9ba672802d2726708a206dac46efbf9820fb66f5f1c53f89bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051611bdd380380611bdd83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009c565b60008060006060848603121561006f578283fd5b83516001600160a01b0381168114610085578384fd5b602085015160409095015190969495509392505050565b611b32806100ab6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638ca5cbb9116100715780638ca5cbb91461011c5780639418bddd14610131578063b8e189ac14610144578063c17b291b14610157578063cfdf677e1461015f578063e561dddc14610167576100a9565b8063461a4478146100ae5780634d69ee57146100d75780637aa63a86146100f75780637ad168a01461010c57806381eb62ef14610114575b600080fd5b6100c16100bc3660046114d2565b61016f565b6040516100ce919061158e565b60405180910390f35b6100ea6100e5366004611420565b61024d565b6040516100ce91906115a2565b6100ff6102c0565b6040516100ce91906115ad565b6100ff6102d9565b6100ff6102f2565b61012f61012a36600461137f565b6102f8565b005b6100ea61013f366004611520565b61050c565b61012f610152366004611520565b61055c565b6100ff610614565b6100c161061a565b6100ff610642565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b505190505b919050565b6000610258836106bc565b61027d5760405162461bcd60e51b815260040161027490611738565b60405180910390fd5b61029a836020015185846000015185602001518760400151610754565b6102b65760405162461bcd60e51b8152600401610274906116a4565b5060019392505050565b6000806102cb6108d9565b5064ffffffffff1691505090565b6000806102e46108d9565b64ffffffffff169250505090565b60025481565b6103006102c0565b811461031e5760405162461bcd60e51b8152600401610274906116db565b61034e6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061016f565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b8152600401610379919061158e565b60206040518083038186803b15801561039157600080fd5b505afa1580156103a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c991906113c2565b6103e55760405162461bcd60e51b8152600401610274906118aa565b60008251116104065760405162461bcd60e51b815260040161027490611867565b6104446040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061016f565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b49190611408565b82516104be6102c0565b0111156104dd5760405162461bcd60e51b815260040161027490611635565b6105088242336040516020016104f4929190611990565b60405160208183030381529060405261096e565b5050565b60008082608001518060200190518101906105279190611553565b509050806105475760405162461bcd60e51b815260040161027490611822565b4261055482600154610b10565b119392505050565b61058e6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b81525061016f565b6001600160a01b0316336001600160a01b0316146105be5760405162461bcd60e51b8152600401610274906117c5565b6105c7816106bc565b6105e35760405162461bcd60e51b815260040161027490611738565b6105ec8161050c565b6106085760405162461bcd60e51b815260040161027490611767565b61061181610b71565b50565b60015481565b600061063d604051806060016040528060258152602001611aa46025913961016f565b905090565b600061064c61061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068457600080fd5b505afa158015610698573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190611408565b60006106c661061a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916106f4916004016115ad565b60206040518083038186803b15801561070c57600080fd5b505afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107449190611408565b61074d83610ce9565b1492915050565b60008082116107945760405162461bcd60e51b8152600401808060200182810382526037815260200180611a206037913960400191505060405180910390fd5b8184106107d25760405162461bcd60e51b81526004018080602001828103825260248152602001806119cc6024913960400191505060405180910390fd5b6107db82610d2f565b8351146108195760405162461bcd60e51b815260040180806020018281038252604d815260200180611a57604d913960600191505060405180910390fd5b8460005b84518110156108cc57856001166001141561087b5784818151811061083e57fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108c0565b8185828151811061088857fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161081d565b5090951495945050505050565b60008060006108e661061a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561091e57600080fd5b505afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906113e2565b64ffffffffff602882901c16935060501c9150509091565b600061099e6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b81525061016f565b90506000806109ab6108d9565b9092509050336001600160a01b03841614156109c85750426109f2565b426002548264ffffffffff1601106109f25760405162461bcd60e51b8152600401610274906118f9565b60006040518060a00160405280610a07610642565b8152602001610a1588610dd9565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a7e94939291906115cc565b60405180910390a2610a8e61061a565b6001600160a01b0316632015276c610aa583610ce9565b610ab9846040015185606001510186611209565b6040518363ffffffff1660e01b8152600401610ad69291906115b6565b600060405180830381600087803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b6a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b7961061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb157600080fd5b505afa158015610bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be99190611408565b815110610c085760405162461bcd60e51b815260040161027490611962565b610c11816106bc565b610c2d5760405162461bcd60e51b815260040161027490611738565b610c3561061a565b6001600160a01b031663167fd6818260000151610c5784606001516000611209565b6040518363ffffffff1660e01b8152600401610c749291906115b6565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cde91906115ad565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d1294939291906115cc565b604051602081830303815290604052805190602001209050919050565b6000808211610d6f5760405162461bcd60e51b81526004018080602001828103825260308152602001806119f06030913960400191505060405180910390fd5b8160011415610d8057506000610248565b81600060805b60018160ff1610610dc4578060ff1660018260ff166001901b03901b8316600014610db95760ff811692831c9291909101905b60011c607f16610d86565b506001811b8414610b6a576001019392505050565b600080825111610e1a5760405162461bcd60e51b8152600401808060200182810382526034815260200180611ac96034913960400191505060405180910390fd5b8151610e3c5781600081518110610e2d57fe5b60200260200101519050610248565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111e55750506002820460018084161460005b82811015611161578a816002028151811061110857fe5b602002602001015196508a816002026001018151811061112457fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061114e57fe5b60209081029190910101526001016110f1565b5080156111c45789600185038151811061117757fe5b6020026020010151955087836010811061118d57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111b757fe5b6020026020010181815250505b806111d05760006111d3565b60015b60ff16820193506001909201916110d9565b896000815181106111f257fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561122b57fe5b61123e601f8401601f19166020016119a7565b905082815283838301111561125257600080fd5b828260208301376000602084830101529392505050565b600082601f830112611279578081fd5b8135602067ffffffffffffffff82111561128f57fe5b80820261129d8282016119a7565b8381528281019086840183880185018910156112b7578687fd5b8693505b858410156112d95780358352600193909301929184019184016112bb565b50979650505050505050565b600060a082840312156112f6578081fd5b60405160a0810167ffffffffffffffff828210818311171561131457fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561135157600080fd5b508301601f8101851361136357600080fd5b61137285823560208401611217565b6080830152505092915050565b60008060408385031215611391578182fd5b823567ffffffffffffffff8111156113a7578283fd5b6113b385828601611269565b95602094909401359450505050565b6000602082840312156113d3578081fd5b81518015158114610b6a578182fd5b6000602082840312156113f3578081fd5b815164ffffffffff1981168114610b6a578182fd5b600060208284031215611419578081fd5b5051919050565b600080600060608486031215611434578081fd5b83359250602084013567ffffffffffffffff80821115611452578283fd5b61145e878388016112e5565b93506040860135915080821115611473578283fd5b9085019060408288031215611486578283fd5b60405160408101818110838211171561149b57fe5b604052823581526020830135828111156114b3578485fd5b6114bf89828601611269565b6020830152508093505050509250925092565b6000602082840312156114e3578081fd5b813567ffffffffffffffff8111156114f9578182fd5b8201601f81018413611509578182fd5b61151884823560208401611217565b949350505050565b600060208284031215611531578081fd5b813567ffffffffffffffff811115611547578182fd5b611518848285016112e5565b60008060408385031215611565578182fd5b825160208401519092506001600160a01b0381168114611583578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561160b5785810183015185820160a0015282016115ef565b8181111561161c578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119c357fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209cac82e6f8ed57077f98f7f2fa680b67b8ab39a271ed4164dce93565b3664cd864736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638ca5cbb9116100715780638ca5cbb91461011c5780639418bddd14610131578063b8e189ac14610144578063c17b291b14610157578063cfdf677e1461015f578063e561dddc14610167576100a9565b8063461a4478146100ae5780634d69ee57146100d75780637aa63a86146100f75780637ad168a01461010c57806381eb62ef14610114575b600080fd5b6100c16100bc3660046114d2565b61016f565b6040516100ce919061158e565b60405180910390f35b6100ea6100e5366004611420565b61024d565b6040516100ce91906115a2565b6100ff6102c0565b6040516100ce91906115ad565b6100ff6102d9565b6100ff6102f2565b61012f61012a36600461137f565b6102f8565b005b6100ea61013f366004611520565b61050c565b61012f610152366004611520565b61055c565b6100ff610614565b6100c161061a565b6100ff610642565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156101cf5781810151838201526020016101b7565b50505050905090810190601f1680156101fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b505190505b919050565b6000610258836106bc565b61027d5760405162461bcd60e51b815260040161027490611738565b60405180910390fd5b61029a836020015185846000015185602001518760400151610754565b6102b65760405162461bcd60e51b8152600401610274906116a4565b5060019392505050565b6000806102cb6108d9565b5064ffffffffff1691505090565b6000806102e46108d9565b64ffffffffff169250505090565b60025481565b6103006102c0565b811461031e5760405162461bcd60e51b8152600401610274906116db565b61034e6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061016f565b6001600160a01b03166302ad4d2a336040518263ffffffff1660e01b8152600401610379919061158e565b60206040518083038186803b15801561039157600080fd5b505afa1580156103a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c991906113c2565b6103e55760405162461bcd60e51b8152600401610274906118aa565b60008251116104065760405162461bcd60e51b815260040161027490611867565b6104446040518060400160405280601d81526020017f4f564d5f43616e6f6e6963616c5472616e73616374696f6e436861696e00000081525061016f565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b49190611408565b82516104be6102c0565b0111156104dd5760405162461bcd60e51b815260040161027490611635565b6105088242336040516020016104f4929190611990565b60405160208183030381529060405261096e565b5050565b60008082608001518060200190518101906105279190611553565b509050806105475760405162461bcd60e51b815260040161027490611822565b4261055482600154610b10565b119392505050565b61058e6040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b81525061016f565b6001600160a01b0316336001600160a01b0316146105be5760405162461bcd60e51b8152600401610274906117c5565b6105c7816106bc565b6105e35760405162461bcd60e51b815260040161027490611738565b6105ec8161050c565b6106085760405162461bcd60e51b815260040161027490611767565b61061181610b71565b50565b60015481565b600061063d604051806060016040528060258152602001611aa46025913961016f565b905090565b600061064c61061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561068457600080fd5b505afa158015610698573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190611408565b60006106c661061a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916106f4916004016115ad565b60206040518083038186803b15801561070c57600080fd5b505afa158015610720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107449190611408565b61074d83610ce9565b1492915050565b60008082116107945760405162461bcd60e51b8152600401808060200182810382526037815260200180611a206037913960400191505060405180910390fd5b8184106107d25760405162461bcd60e51b81526004018080602001828103825260248152602001806119cc6024913960400191505060405180910390fd5b6107db82610d2f565b8351146108195760405162461bcd60e51b815260040180806020018281038252604d815260200180611a57604d913960600191505060405180910390fd5b8460005b84518110156108cc57856001166001141561087b5784818151811061083e57fe5b60200260200101518260405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091506108c0565b8185828151811061088857fe5b602002602001015160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012091505b600195861c950161081d565b5090951495945050505050565b60008060006108e661061a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561091e57600080fd5b505afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906113e2565b64ffffffffff602882901c16935060501c9150509091565b600061099e6040518060400160405280600d81526020016c27ab26afa9b2b8bab2b731b2b960991b81525061016f565b90506000806109ab6108d9565b9092509050336001600160a01b03841614156109c85750426109f2565b426002548264ffffffffff1601106109f25760405162461bcd60e51b8152600401610274906118f9565b60006040518060a00160405280610a07610642565b8152602001610a1588610dd9565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610a7e94939291906115cc565b60405180910390a2610a8e61061a565b6001600160a01b0316632015276c610aa583610ce9565b610ab9846040015185606001510186611209565b6040518363ffffffff1660e01b8152600401610ad69291906115b6565b600060405180830381600087803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b50505050505050505050565b600082820183811015610b6a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610b7961061a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb157600080fd5b505afa158015610bc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be99190611408565b815110610c085760405162461bcd60e51b815260040161027490611962565b610c11816106bc565b610c2d5760405162461bcd60e51b815260040161027490611738565b610c3561061a565b6001600160a01b031663167fd6818260000151610c5784606001516000611209565b6040518363ffffffff1660e01b8152600401610c749291906115b6565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd648260200151604051610cde91906115ad565b60405180910390a250565b60008160200151826040015183606001518460800151604051602001610d1294939291906115cc565b604051602081830303815290604052805190602001209050919050565b6000808211610d6f5760405162461bcd60e51b81526004018080602001828103825260308152602001806119f06030913960400191505060405180910390fd5b8160011415610d8057506000610248565b81600060805b60018160ff1610610dc4578060ff1660018260ff166001901b03901b8316600014610db95760ff811692831c9291909101905b60011c607f16610d86565b506001811b8414610b6a576001019392505050565b600080825111610e1a5760405162461bcd60e51b8152600401808060200182810382526034815260200180611ac96034913960400191505060405180910390fd5b8151610e3c5781600081518110610e2d57fe5b60200260200101519050610248565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156111e55750506002820460018084161460005b82811015611161578a816002028151811061110857fe5b602002602001015196508a816002026001018151811061112457fe5b6020026020010151955086602089015285604089015287805190602001208b828151811061114e57fe5b60209081029190910101526001016110f1565b5080156111c45789600185038151811061117757fe5b6020026020010151955087836010811061118d57fe5b602002015160001b945085602088015284604088015286805190602001208a83815181106111b757fe5b6020026020010181815250505b806111d05760006111d3565b60015b60ff16820193506001909201916110d9565b896000815181106111f257fe5b602002602001015198505050505050505050919050565b602890811b91909117901b90565b600067ffffffffffffffff83111561122b57fe5b61123e601f8401601f19166020016119a7565b905082815283838301111561125257600080fd5b828260208301376000602084830101529392505050565b600082601f830112611279578081fd5b8135602067ffffffffffffffff82111561128f57fe5b80820261129d8282016119a7565b8381528281019086840183880185018910156112b7578687fd5b8693505b858410156112d95780358352600193909301929184019184016112bb565b50979650505050505050565b600060a082840312156112f6578081fd5b60405160a0810167ffffffffffffffff828210818311171561131457fe5b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561135157600080fd5b508301601f8101851361136357600080fd5b61137285823560208401611217565b6080830152505092915050565b60008060408385031215611391578182fd5b823567ffffffffffffffff8111156113a7578283fd5b6113b385828601611269565b95602094909401359450505050565b6000602082840312156113d3578081fd5b81518015158114610b6a578182fd5b6000602082840312156113f3578081fd5b815164ffffffffff1981168114610b6a578182fd5b600060208284031215611419578081fd5b5051919050565b600080600060608486031215611434578081fd5b83359250602084013567ffffffffffffffff80821115611452578283fd5b61145e878388016112e5565b93506040860135915080821115611473578283fd5b9085019060408288031215611486578283fd5b60405160408101818110838211171561149b57fe5b604052823581526020830135828111156114b3578485fd5b6114bf89828601611269565b6020830152508093505050509250925092565b6000602082840312156114e3578081fd5b813567ffffffffffffffff8111156114f9578182fd5b8201601f81018413611509578182fd5b61151884823560208401611217565b949350505050565b600060208284031215611531578081fd5b813567ffffffffffffffff811115611547578182fd5b611518848285016112e5565b60008060408385031215611565578182fd5b825160208401519092506001600160a01b0381168114611583578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b91825264ffffffffff1916602082015260400190565b600085825260208581840152846040840152608060608401528351806080850152825b8181101561160b5785810183015185820160a0015282016115ef565b8181111561161c578360a083870101525b50601f01601f19169290920160a0019695505050505050565b60208082526049908201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360408201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60608201526839b0b1ba34b7b7399760b91b608082015260a00190565b60208082526018908201527f496e76616c696420696e636c7573696f6e2070726f6f662e0000000000000000604082015260600190565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b602080825260409082018190527f537461746520626174636865732063616e206f6e6c792062652064656c657465908201527f642077697468696e207468652066726175642070726f6f662077696e646f772e606082015260800190565b6020808252603b908201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560408201527f6420627920746865204f564d5f467261756456657269666965722e0000000000606082015260800190565b60208082526025908201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604082015264207a65726f60d81b606082015260800190565b60208082526023908201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460408201526231b41760e91b606082015260800190565b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60208082526043908201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960408201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460608201526237bb9760e91b608082015260a00190565b60208082526014908201527324b73b30b634b2103130ba31b41034b73232bc1760611b604082015260600190565b9182526001600160a01b0316602082015260400190565b60405181810167ffffffffffffffff811182821017156119c357fe5b60405291905056fe4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756e64732e4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206365696c286c6f675f3229206f6620302e4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d7573742062652067726561746572207468616e207a65726f2e4c69625f4d65726b6c65547265653a20546f74616c207369626c696e677320646f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f20746f74616c206c65617665732e4f564d5f436861696e53746f72616765436f6e7461696e65723a5343433a626174636865734c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206c65617374206f6e65206c65616620686173682ea26469706673582212209cac82e6f8ed57077f98f7f2fa680b67b8ab39a271ed4164dce93565b3664cd864736f6c63430007060033", - "devdoc": { - "details": "The State Commitment Chain (SCC) contract contains a list of proposed state roots which Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique state root calculated off-chain by applying the canonical transactions one by one. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "appendStateBatch(bytes32[],uint256)": { - "params": { - "_batch": "Batch of state roots.", - "_shouldStartAtElement": "Index of the element at which this batch should start." - } - }, - "batches()": { - "returns": { - "_0": "Reference to the batch storage container." - } - }, - "constructor": { - "params": { - "_libAddressManager": "Address of the Address Manager." - } - }, - "deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))": { - "params": { - "_batchHeader": "Header of the batch to start deleting from." - } - }, - "getLastSequencerTimestamp()": { - "returns": { - "_lastSequencerTimestamp": "Last sequencer batch timestamp." - } - }, - "getTotalBatches()": { - "returns": { - "_totalBatches": "Total submitted batches." - } - }, - "getTotalElements()": { - "returns": { - "_totalElements": "Total submitted elements." - } - }, - "insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))": { - "params": { - "_batchHeader": "Header of the batch to check." - }, - "returns": { - "_inside": "Whether or not the batch is inside the fraud proof window." - } - }, - "verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "params": { - "_batchHeader": "Header of the batch in which the element was included.", - "_element": "Hash of the element to verify a proof for.", - "_proof": "Merkle inclusion proof for the element." - } - } - }, - "title": "OVM_StateCommitmentChain", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "appendStateBatch(bytes32[],uint256)": { - "notice": "Appends a batch of state roots to the chain." - }, - "batches()": { - "notice": "Accesses the batch storage container." - }, - "deleteStateBatch((uint256,bytes32,uint256,uint256,bytes))": { - "notice": "Deletes all state roots after (and including) a given batch." - }, - "getLastSequencerTimestamp()": { - "notice": "Retrieves the timestamp of the last batch submitted by the sequencer." - }, - "getTotalBatches()": { - "notice": "Retrieves the total number of batches submitted." - }, - "getTotalElements()": { - "notice": "Retrieves the total number of elements submitted." - }, - "insideFraudProofWindow((uint256,bytes32,uint256,uint256,bytes))": { - "notice": "Checks whether a given batch is still inside its fraud proof window." - }, - "verifyStateCommitment(bytes32,(uint256,bytes32,uint256,uint256,bytes),(uint256,bytes32[]))": { - "notice": "Verifies a batch inclusion proof." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - }, - { - "astId": 3783, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", - "label": "FRAUD_PROOF_WINDOW", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 3785, - "contract": "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol:OVM_StateCommitmentChain", - "label": "SEQUENCER_PUBLISH_WINDOW", - "offset": 0, - "slot": "2", - "type": "t_uint256" - } - ], - "types": { - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateManagerFactory.json b/deployments/kovan/OVM_StateManagerFactory.json deleted file mode 100644 index 99bd26d90..000000000 --- a/deployments/kovan/OVM_StateManagerFactory.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "address": "0x2B518585718dd8a3812A0441dE0f1DDF2FA3cBf5", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "name": "create", - "outputs": [ - { - "internalType": "contract iOVM_StateManager", - "name": "_ovmStateManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xa008a616f18db05c6ace3e94b96d133407cb70f8b7bd6ca5809fd30f4ce40c9e", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x2B518585718dd8a3812A0441dE0f1DDF2FA3cBf5", - "transactionIndex": 4, - "gasUsed": "1170970", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6213746630f139c66f8c55df2186ef11f690ca4606f1adf6770ecfe70898ce1e", - "transactionHash": "0xa008a616f18db05c6ace3e94b96d133407cb70f8b7bd6ca5809fd30f4ce40c9e", - "logs": [], - "blockNumber": 23637144, - "cumulativeGasUsed": "1342685", - "status": 1, - "byzantium": true - }, - "args": [], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"create\",\"outputs\":[{\"internalType\":\"contract iOVM_StateManager\",\"name\":\"_ovmStateManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Manager Factory is called by a State Transitioner's init code, to create a new State Manager for use in the Fraud Verification process. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"create(address)\":{\"params\":{\"_owner\":\"Owner of the created contract.\"},\"returns\":{\"_ovmStateManager\":\"New OVM_StateManager instance.\"}}},\"title\":\"OVM_StateManagerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address)\":{\"notice\":\"Creates a new OVM_StateManager\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol\":\"OVM_StateManagerFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title OVM_StateManager\\n * @dev The State Manager contract holds all storage values for contracts in the OVM. It can only be written to by the\\n * the Execution Manager and State Transitioner. It runs on L1 during the setup and execution of a fraud proof.\\n * The same logic runs on L2, but has been implemented as a precompile in the L2 go-ethereum client\\n * (see https://github.com/ethereum-optimism/go-ethereum/blob/master/core/vm/ovm_state_manager.go).\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateManager is iOVM_StateManager {\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n bytes32 constant internal EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\\n bytes32 constant internal EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n bytes32 constant internal STORAGE_XOR_VALUE = 0xFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEF;\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n address override public owner;\\n address override public ovmExecutionManager;\\n\\n\\n /****************************************\\n * Contract Variables: Internal Storage *\\n ****************************************/\\n\\n mapping (address => Lib_OVMCodec.Account) internal accounts;\\n mapping (address => mapping (bytes32 => bytes32)) internal contractStorage;\\n mapping (address => mapping (bytes32 => bool)) internal verifiedContractStorage;\\n mapping (bytes32 => ItemState) internal itemStates;\\n uint256 internal totalUncommittedAccounts;\\n uint256 internal totalUncommittedContractStorage;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _owner Address of the owner of this contract.\\n */\\n constructor(\\n address _owner\\n )\\n public\\n {\\n owner = _owner;\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Simple authentication, this contract should only be accessible to the owner (which is expected to be the State Transitioner during `PRE_EXECUTION` \\n * or the OVM_ExecutionManager during transaction execution.\\n */\\n modifier authenticated() {\\n // owner is the State Transitioner\\n require(\\n msg.sender == owner || msg.sender == ovmExecutionManager,\\n \\\"Function can only be called by authenticated addresses\\\"\\n );\\n _;\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n\\n function isAuthenticated(\\n address _address\\n )\\n override\\n public\\n view\\n returns (bool)\\n {\\n return (_address == owner || _address == ovmExecutionManager);\\n }\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n /**\\n * Sets the address of the OVM_ExecutionManager.\\n * @param _ovmExecutionManager Address of the OVM_ExecutionManager.\\n */\\n function setExecutionManager(\\n address _ovmExecutionManager\\n )\\n override\\n public\\n authenticated\\n {\\n ovmExecutionManager = _ovmExecutionManager;\\n }\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n /**\\n * Inserts an account into the state.\\n * @param _address Address of the account to insert.\\n * @param _account Account to insert for the given address.\\n */\\n function putAccount(\\n address _address,\\n Lib_OVMCodec.Account memory _account\\n )\\n override\\n public\\n authenticated\\n {\\n accounts[_address] = _account;\\n }\\n\\n /**\\n * Marks an account as empty.\\n * @param _address Address of the account to mark.\\n */\\n function putEmptyAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\\n }\\n\\n /**\\n * Retrieves an account from the state.\\n * @param _address Address of the account to retrieve.\\n * @return _account Account for the given address.\\n */\\n function getAccount(address _address)\\n override\\n public\\n view\\n returns (\\n Lib_OVMCodec.Account memory _account\\n )\\n {\\n return accounts[_address];\\n }\\n\\n /**\\n * Checks whether the state has a given account.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the state has the account.\\n */\\n function hasAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return accounts[_address].codeHash != bytes32(0);\\n }\\n\\n /**\\n * Checks whether the state has a given known empty account.\\n * @param _address Address of the account to check.\\n * @return _exists Whether or not the state has the empty account.\\n */\\n function hasEmptyAccount(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return (\\n accounts[_address].codeHash == EMPTY_ACCOUNT_CODE_HASH\\n && accounts[_address].nonce == 0\\n );\\n }\\n\\n /**\\n * Sets the nonce of an account.\\n * @param _address Address of the account to modify.\\n * @param _nonce New account nonce.\\n */\\n function setAccountNonce(\\n address _address,\\n uint256 _nonce\\n )\\n override\\n public\\n authenticated\\n {\\n accounts[_address].nonce = _nonce;\\n }\\n\\n /**\\n * Gets the nonce of an account.\\n * @param _address Address of the account to access.\\n * @return _nonce Nonce of the account.\\n */\\n function getAccountNonce(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n uint256 _nonce\\n )\\n {\\n return accounts[_address].nonce;\\n }\\n\\n /**\\n * Retrieves the Ethereum address of an account.\\n * @param _address Address of the account to access.\\n * @return _ethAddress Corresponding Ethereum address.\\n */\\n function getAccountEthAddress(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n address _ethAddress\\n )\\n {\\n return accounts[_address].ethAddress;\\n }\\n\\n /**\\n * Retrieves the storage root of an account.\\n * @param _address Address of the account to access.\\n * @return _storageRoot Corresponding storage root.\\n */\\n function getAccountStorageRoot(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bytes32 _storageRoot\\n )\\n {\\n return accounts[_address].storageRoot;\\n }\\n\\n /**\\n * Initializes a pending account (during CREATE or CREATE2) with the default values.\\n * @param _address Address of the account to initialize.\\n */\\n function initPendingAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.nonce = 1;\\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\\n account.isFresh = true;\\n }\\n\\n /**\\n * Finalizes the creation of a pending account (during CREATE or CREATE2).\\n * @param _address Address of the account to finalize.\\n * @param _ethAddress Address of the account's associated contract on Ethereum.\\n * @param _codeHash Hash of the account's code.\\n */\\n function commitPendingAccount(\\n address _address,\\n address _ethAddress,\\n bytes32 _codeHash\\n )\\n override\\n public\\n authenticated\\n {\\n Lib_OVMCodec.Account storage account = accounts[_address];\\n account.ethAddress = _ethAddress;\\n account.codeHash = _codeHash;\\n }\\n\\n /**\\n * Checks whether an account has already been retrieved, and marks it as retrieved if not.\\n * @param _address Address of the account to check.\\n * @return _wasAccountAlreadyLoaded Whether or not the account was already loaded.\\n */\\n function testAndSetAccountLoaded(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountAlreadyLoaded\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_address),\\n ItemState.ITEM_LOADED\\n );\\n }\\n\\n /**\\n * Checks whether an account has already been modified, and marks it as modified if not.\\n * @param _address Address of the account to check.\\n * @return _wasAccountAlreadyChanged Whether or not the account was already modified.\\n */\\n function testAndSetAccountChanged(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountAlreadyChanged\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_address),\\n ItemState.ITEM_CHANGED\\n );\\n }\\n\\n /**\\n * Attempts to mark an account as committed.\\n * @param _address Address of the account to commit.\\n * @return _wasAccountCommitted Whether or not the account was committed.\\n */\\n function commitAccount(\\n address _address\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasAccountCommitted\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\\n return false;\\n }\\n\\n itemStates[item] = ItemState.ITEM_COMMITTED;\\n totalUncommittedAccounts -= 1;\\n\\n return true;\\n }\\n\\n /**\\n * Increments the total number of uncommitted accounts.\\n */\\n function incrementTotalUncommittedAccounts()\\n override\\n public\\n authenticated\\n {\\n totalUncommittedAccounts += 1;\\n }\\n\\n /**\\n * Gets the total number of uncommitted accounts.\\n * @return _total Total uncommitted accounts.\\n */\\n function getTotalUncommittedAccounts()\\n override\\n public\\n view\\n returns (\\n uint256 _total\\n )\\n {\\n return totalUncommittedAccounts;\\n }\\n\\n /**\\n * Checks whether a given account was changed during execution.\\n * @param _address Address to check.\\n * @return Whether or not the account was changed.\\n */\\n function wasAccountChanged(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n return itemStates[item] >= ItemState.ITEM_CHANGED;\\n }\\n\\n /**\\n * Checks whether a given account was committed after execution.\\n * @param _address Address to check.\\n * @return Whether or not the account was committed.\\n */\\n function wasAccountCommitted(\\n address _address\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_address);\\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\\n }\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n /**\\n * Changes a contract storage slot value.\\n * @param _contract Address of the contract to modify.\\n * @param _key 32 byte storage slot key.\\n * @param _value 32 byte storage slot value.\\n */\\n function putContractStorage(\\n address _contract,\\n bytes32 _key,\\n bytes32 _value\\n )\\n override\\n public\\n authenticated\\n {\\n // A hilarious optimization. `SSTORE`ing a value of `bytes32(0)` is common enough that it's\\n // worth populating this with a non-zero value in advance (during the fraud proof\\n // initialization phase) to cut the execution-time cost down to 5000 gas.\\n contractStorage[_contract][_key] = _value ^ STORAGE_XOR_VALUE;\\n\\n // Only used when initially populating the contract storage. OVM_ExecutionManager will\\n // perform a `hasContractStorage` INVALID_STATE_ACCESS check before putting any contract\\n // storage because writing to zero when the actual value is nonzero causes a gas\\n // discrepancy. Could be moved into a new `putVerifiedContractStorage` function, or\\n // something along those lines.\\n if (verifiedContractStorage[_contract][_key] == false) {\\n verifiedContractStorage[_contract][_key] = true;\\n }\\n }\\n\\n /**\\n * Retrieves a contract storage slot value.\\n * @param _contract Address of the contract to access.\\n * @param _key 32 byte storage slot key.\\n * @return _value 32 byte storage slot value.\\n */\\n function getContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bytes32 _value\\n )\\n {\\n // Storage XOR system doesn't work for newly created contracts that haven't set this\\n // storage slot value yet.\\n if (\\n verifiedContractStorage[_contract][_key] == false\\n && accounts[_contract].isFresh\\n ) {\\n return bytes32(0);\\n }\\n\\n // See `putContractStorage` for more information about the XOR here.\\n return contractStorage[_contract][_key] ^ STORAGE_XOR_VALUE;\\n }\\n\\n /**\\n * Checks whether a contract storage slot exists in the state.\\n * @param _contract Address of the contract to access.\\n * @param _key 32 byte storage slot key.\\n * @return _exists Whether or not the key was set in the state.\\n */\\n function hasContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool _exists\\n )\\n {\\n return verifiedContractStorage[_contract][_key] || accounts[_contract].isFresh;\\n }\\n\\n /**\\n * Checks whether a storage slot has already been retrieved, and marks it as retrieved if not.\\n * @param _contract Address of the contract to check.\\n * @param _key 32 byte storage slot key.\\n * @return _wasContractStorageAlreadyLoaded Whether or not the slot was already loaded.\\n */\\n function testAndSetContractStorageLoaded(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageAlreadyLoaded\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_contract, _key),\\n ItemState.ITEM_LOADED\\n );\\n }\\n\\n /**\\n * Checks whether a storage slot has already been modified, and marks it as modified if not.\\n * @param _contract Address of the contract to check.\\n * @param _key 32 byte storage slot key.\\n * @return _wasContractStorageAlreadyChanged Whether or not the slot was already modified.\\n */\\n function testAndSetContractStorageChanged(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageAlreadyChanged\\n )\\n {\\n return _testAndSetItemState(\\n _getItemHash(_contract, _key),\\n ItemState.ITEM_CHANGED\\n );\\n }\\n\\n /**\\n * Attempts to mark a storage slot as committed.\\n * @param _contract Address of the account to commit.\\n * @param _key 32 byte slot key to commit.\\n * @return _wasContractStorageCommitted Whether or not the slot was committed.\\n */\\n function commitContractStorage(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n authenticated\\n returns (\\n bool _wasContractStorageCommitted\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\\n return false;\\n }\\n\\n itemStates[item] = ItemState.ITEM_COMMITTED;\\n totalUncommittedContractStorage -= 1;\\n\\n return true;\\n }\\n\\n /**\\n * Increments the total number of uncommitted storage slots.\\n */\\n function incrementTotalUncommittedContractStorage()\\n override\\n public\\n authenticated\\n {\\n totalUncommittedContractStorage += 1;\\n }\\n\\n /**\\n * Gets the total number of uncommitted storage slots.\\n * @return _total Total uncommitted storage slots.\\n */\\n function getTotalUncommittedContractStorage()\\n override\\n public\\n view\\n returns (\\n uint256 _total\\n )\\n {\\n return totalUncommittedContractStorage;\\n }\\n\\n /**\\n * Checks whether a given storage slot was changed during execution.\\n * @param _contract Address to check.\\n * @param _key Key of the storage slot to check.\\n * @return Whether or not the storage slot was changed.\\n */\\n function wasContractStorageChanged(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n return itemStates[item] >= ItemState.ITEM_CHANGED;\\n }\\n\\n /**\\n * Checks whether a given storage slot was committed after execution.\\n * @param _contract Address to check.\\n * @param _key Key of the storage slot to check.\\n * @return Whether or not the storage slot was committed.\\n */\\n function wasContractStorageCommitted(\\n address _contract,\\n bytes32 _key\\n )\\n override\\n public\\n view\\n returns (\\n bool\\n )\\n {\\n bytes32 item = _getItemHash(_contract, _key);\\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Generates a unique hash for an address.\\n * @param _address Address to generate a hash for.\\n * @return Unique hash for the given address.\\n */\\n function _getItemHash(\\n address _address\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(_address));\\n }\\n\\n /**\\n * Generates a unique hash for an address/key pair.\\n * @param _contract Address to generate a hash for.\\n * @param _key Key to generate a hash for.\\n * @return Unique hash for the given pair.\\n */\\n function _getItemHash(\\n address _contract,\\n bytes32 _key\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return keccak256(abi.encodePacked(\\n _contract,\\n _key\\n ));\\n }\\n\\n /**\\n * Checks whether an item is in a particular state (ITEM_LOADED or ITEM_CHANGED) and sets the\\n * item to the provided state if not.\\n * @param _item 32 byte item ID to check.\\n * @param _minItemState Minimum state that must be satisfied by the item.\\n * @return _wasItemState Whether or not the item was already in the state.\\n */\\n function _testAndSetItemState(\\n bytes32 _item,\\n ItemState _minItemState\\n )\\n internal\\n returns (\\n bool _wasItemState\\n )\\n {\\n bool wasItemState = itemStates[_item] >= _minItemState;\\n\\n if (wasItemState == false) {\\n itemStates[_item] = _minItemState;\\n }\\n\\n return wasItemState;\\n }\\n}\\n\",\"keccak256\":\"0x0b94b51e9da97ae06fc61499af543174c15954616f30996064a53a02f5b34d7a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Interface Imports */\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_StateManagerFactory } from \\\"../../iOVM/execution/iOVM_StateManagerFactory.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_StateManager } from \\\"./OVM_StateManager.sol\\\";\\n\\n/**\\n * @title OVM_StateManagerFactory\\n * @dev The State Manager Factory is called by a State Transitioner's init code, to create a new \\n * State Manager for use in the Fraud Verification process.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateManagerFactory is iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n /**\\n * Creates a new OVM_StateManager\\n * @param _owner Owner of the created contract.\\n * @return _ovmStateManager New OVM_StateManager instance.\\n */\\n function create(\\n address _owner\\n )\\n override\\n public\\n returns (\\n iOVM_StateManager _ovmStateManager\\n )\\n {\\n return new OVM_StateManager(_owner);\\n }\\n}\\n\",\"keccak256\":\"0xecc22c73897708daccd0fb5f32e6a3f9eef5f0dab9d593834a83c9e0983e5144\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateManager } from \\\"./iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title iOVM_StateManagerFactory\\n */\\ninterface iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _owner\\n )\\n external\\n returns (\\n iOVM_StateManager _ovmStateManager\\n );\\n}\\n\",\"keccak256\":\"0x27a90fc43889d0c7d1db50f37907ef7386d9b415d15a1e91a0a068cba59afd36\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50611437806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220e828fe40bec66e46eda3270ac747c1de16bdf5522d70c49b6a3f57a17ac6330e64736f6c63430007060033a264697066735822122076e75b14babd96506fc8c5ce0f379018a386361ff1618a85cde718d095d69b0764736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80639ed9331814610030575b600080fd5b6100566004803603602081101561004657600080fd5b50356001600160a01b0316610072565b604080516001600160a01b039092168252519081900360200190f35b600081604051610081906100b5565b6001600160a01b03909116815260405190819003602001906000f0801580156100ae573d6000803e3d6000fd5b5092915050565b61133f806100c38339019056fe608060405234801561001057600080fd5b5060405161133f38038061133f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610082565b600060208284031215610065578081fd5b81516001600160a01b038116811461007b578182fd5b9392505050565b6112ae806100916000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c80638f3b96471161010f578063d126199f116100a2578063e90abb8611610071578063e90abb86146103f9578063fb37b31c1461040c578063fbcbc0f11461041f578063fcf149a21461043f576101f0565b8063d126199f146103b8578063d15d4150146103cb578063d54414c8146103de578063d7bd4a2a146103f1576101f0565b8063c3fd9b25116100de578063c3fd9b2514610377578063c7650bf21461037f578063c8e40fbf14610392578063d0a215f2146103a5576101f0565b80638f3b96471461033657806399056ba914610349578063af37b86414610351578063af3dc01114610364576101f0565b806333f94305116101875780636f3c75af116101565780636f3c75af146102f55780637c8ee703146103085780637e86faa81461031b5780638da5cb5b1461032e576101f0565b806333f94305146102b25780635c17d629146102ba5780636b18e4e8146102cd5780636c87ad20146102e0576101f0565b8063167020d2116101c3578063167020d2146102595780631aaf392f1461026c5780631b208a5a1461028c57806326dc5b121461029f576101f0565b806307a12945146101f55780630ad226791461021e57806311b1f790146102315780631381ba4d14610244575b600080fd5b61020861020336600461101d565b610452565b60405161021591906111c4565b60405180910390f35b61020861022c366004611072565b6104ba565b61020861023f36600461101d565b610517565b61025761025236600461101d565b610573565b005b61020861026736600461101d565b6105d4565b61027f61027a366004611072565b610679565b60405161021591906111cf565b61020861029a36600461101d565b610727565b61027f6102ad36600461101d565b61075e565b61025761077d565b6102576102c836600461109b565b6107c7565b6102576102db36600461101d565b61089a565b6102e8610944565b60405161021591906111b0565b610208610303366004611072565b610953565b6102e861031636600461101d565b61098c565b610208610329366004611072565b6109ad565b6102e86109c3565b6102576103443660046110cd565b6109d2565b61027f610a88565b61020861035f366004611072565b610a8e565b610208610372366004611072565b610ae2565b610257610b2f565b61020861038d366004611072565b610b79565b6102086103a036600461101d565b610c20565b6102576103b3366004611037565b610c40565b61027f6103c636600461101d565b610cb9565b6102086103d936600461101d565b610cd4565b6102086103ec36600461101d565b610d01565b61027f610d16565b610257610407366004611072565b610d1c565b61020861041a36600461101d565b610d77565b61043261042d36600461101d565b610dc3565b604051610215919061122e565b61025761044d36600461101d565b610e37565b6001600160a01b0381166000908152600260205260408120600301547fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701480156104b257506001600160a01b038216600090815260026020526040902054155b90505b919050565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff168061050e57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b90505b92915050565b600080546001600160a01b031633148061053b57506001546001600160a01b031633145b6105605760405162461bcd60e51b8152600401610557906111d8565b60405180910390fd5b6104b261056c83610ef8565b6002610f28565b6000546001600160a01b031633148061059657506001546001600160a01b031633145b6105b25760405162461bcd60e51b8152600401610557906111d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314806105f857506001546001600160a01b031633145b6106145760405162461bcd60e51b8152600401610557906111d8565b600061061f83610ef8565b9050600260008281526005602052604090205460ff16600381111561064057fe5b1461064f5760009150506104b5565b6000908152600560205260409020805460ff19166003179055505060068054600019019055600190565b6001600160a01b038216600090815260046020908152604080832084845290915281205460ff161580156106cf57506001600160a01b038316600090815260026020526040902060040154600160a01b900460ff165b156106dc57506000610511565b506001600160a01b0391909116600090815260036020908152604080832093835292905220547ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef1890565b60008061073383610ef8565b905060025b60008281526005602052604090205460ff16600381111561075557fe5b10159392505050565b6001600160a01b03166000908152600260208190526040909120015490565b6000546001600160a01b03163314806107a057506001546001600160a01b031633145b6107bc5760405162461bcd60e51b8152600401610557906111d8565b600680546001019055565b6000546001600160a01b03163314806107ea57506001546001600160a01b031633145b6108065760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b038316600081815260036020908152604080832086845282528083207ffeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef86189055928252600481528282208583529052205460ff16610895576001600160a01b03831660009081526004602090815260408083208584529091529020805460ff191660011790555b505050565b6000546001600160a01b03163314806108bd57506001546001600160a01b031633145b6108d95760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b031660009081526002602081905260409091207f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470600390910155565b6001546001600160a01b031681565b6000806109608484610f8e565b905060025b60008281526005602052604090205460ff16600381111561098257fe5b1015949350505050565b6001600160a01b039081166000908152600260205260409020600401541690565b6000806109ba8484610f8e565b90506003610965565b6000546001600160a01b031681565b6000546001600160a01b03163314806109f557506001546001600160a01b031633145b610a115760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b039182166000908152600260208181526040928390208451815590840151600182015591830151908201556060820151600382015560808201516004909101805460a0909301516001600160a01b0319909316919093161760ff60a01b1916600160a01b91151591909102179055565b60075490565b600080546001600160a01b0316331480610ab257506001546001600160a01b031633145b610ace5760405162461bcd60e51b8152600401610557906111d8565b61050e610adb8484610f8e565b6001610f28565b600080546001600160a01b0316331480610b0657506001546001600160a01b031633145b610b225760405162461bcd60e51b8152600401610557906111d8565b61050e61056c8484610f8e565b6000546001600160a01b0316331480610b5257506001546001600160a01b031633145b610b6e5760405162461bcd60e51b8152600401610557906111d8565b600780546001019055565b600080546001600160a01b0316331480610b9d57506001546001600160a01b031633145b610bb95760405162461bcd60e51b8152600401610557906111d8565b6000610bc58484610f8e565b9050600260008281526005602052604090205460ff166003811115610be657fe5b14610bf5576000915050610511565b6000908152600560205260409020805460ff1916600317905550506007805460001901905550600190565b6001600160a01b0316600090815260026020526040902060030154151590565b6000546001600160a01b0316331480610c6357506001546001600160a01b031633145b610c7f5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b0392831660009081526002602052604090206004810180546001600160a01b031916939094169290921790925560030155565b6001600160a01b031660009081526002602052604090205490565b600080546001600160a01b03838116911614806104b25750506001546001600160a01b0390811691161490565b600080610d0d83610ef8565b90506003610738565b60065490565b6000546001600160a01b0316331480610d3f57506001546001600160a01b031633145b610d5b5760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03909116600090815260026020526040902055565b600080546001600160a01b0316331480610d9b57506001546001600160a01b031633145b610db75760405162461bcd60e51b8152600401610557906111d8565b6104b2610adb83610ef8565b610dcb610fc1565b506001600160a01b03908116600090815260026020818152604092839020835160c08101855281548152600182015492810192909252918201549281019290925260038101546060830152600401549182166080820152600160a01b90910460ff16151560a082015290565b6000546001600160a01b0316331480610e5a57506001546001600160a01b031633145b610e765760405162461bcd60e51b8152600401610557906111d8565b6001600160a01b03166000908152600260208190526040909120600181557f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421918101919091557fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4706003820155600401805460ff60a01b1916600160a01b179055565b600081604051602001610f0b9190611171565b604051602081830303815290604052805190602001209050919050565b600080826003811115610f3757fe5b60008581526005602052604090205460ff166003811115610f5457fe5b101590508061050e576000848152600560205260409020805484919060ff19166001836003811115610f8257fe5b02179055509392505050565b60008282604051602001610fa392919061118e565b60405160208183030381529060405280519060200120905092915050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915290565b80356001600160a01b03811681146104b557600080fd5b803580151581146104b557600080fd5b60006020828403121561102e578081fd5b61050e82610ff6565b60008060006060848603121561104b578182fd5b61105484610ff6565b925061106260208501610ff6565b9150604084013590509250925092565b60008060408385031215611084578182fd5b61108d83610ff6565b946020939093013593505050565b6000806000606084860312156110af578283fd5b6110b884610ff6565b95602085013595506040909401359392505050565b60008082840360e08112156110e0578283fd5b6110e984610ff6565b925060c0601f19820112156110fc578182fd5b5060405160c0810181811067ffffffffffffffff8211171561111a57fe5b80604052506020840135815260408401356020820152606084013560408201526080840135606082015261115060a08501610ff6565b608082015261116160c0850161100d565b60a0820152809150509250929050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b60208082526036908201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c65642062792061604082015275757468656e746963617465642061646472657373657360501b606082015260800190565b815181526020808301519082015260408083015190820152606080830151908201526080808301516001600160a01b03169082015260a09182015115159181019190915260c0019056fea2646970667358221220e828fe40bec66e46eda3270ac747c1de16bdf5522d70c49b6a3f57a17ac6330e64736f6c63430007060033a264697066735822122076e75b14babd96506fc8c5ce0f379018a386361ff1618a85cde718d095d69b0764736f6c63430007060033", - "devdoc": { - "details": "The State Manager Factory is called by a State Transitioner's init code, to create a new State Manager for use in the Fraud Verification process. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "create(address)": { - "params": { - "_owner": "Owner of the created contract." - }, - "returns": { - "_ovmStateManager": "New OVM_StateManager instance." - } - } - }, - "title": "OVM_StateManagerFactory", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "create(address)": { - "notice": "Creates a new OVM_StateManager" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} \ No newline at end of file diff --git a/deployments/kovan/OVM_StateTransitionerFactory.json b/deployments/kovan/OVM_StateTransitionerFactory.json deleted file mode 100644 index 86bf5165d..000000000 --- a/deployments/kovan/OVM_StateTransitionerFactory.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "address": "0x08337386255CaA3ddC2b55E0aa546218c92a5dCE", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_libAddressManager", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_stateTransitionIndex", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_preStateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_transactionHash", - "type": "bytes32" - } - ], - "name": "create", - "outputs": [ - { - "internalType": "contract iOVM_StateTransitioner", - "name": "_ovmStateTransitioner", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - } - ], - "name": "resolve", - "outputs": [ - { - "internalType": "address", - "name": "_contract", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0xcf2e9291837c499aa978653ac290e26ec001fc0f5da228484c9bb7c91825c2b4", - "receipt": { - "to": null, - "from": "0x3a953298098CADCb621a40c1efCfb7DD73B727aF", - "contractAddress": "0x08337386255CaA3ddC2b55E0aa546218c92a5dCE", - "transactionIndex": 2, - "gasUsed": "4021009", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa30a364c7e784548599fc347c78edd15bef45bff4a7d2551ceead391dfcdf03f", - "transactionHash": "0xcf2e9291837c499aa978653ac290e26ec001fc0f5da228484c9bb7c91825c2b4", - "logs": [], - "blockNumber": 23637147, - "cumulativeGasUsed": "4109675", - "status": 1, - "byzantium": true - }, - "args": [ - "0x30ADa33Cb29e6478D3F3Ed3b089aC7A0b34837f7" - ], - "solcInputHash": "167e1592944606d9f946a16ee2ddffd3", - "metadata": "{\"compiler\":{\"version\":\"0.7.6+commit.7338295f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stateTransitionIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_preStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_transactionHash\",\"type\":\"bytes32\"}],\"name\":\"create\",\"outputs\":[{\"internalType\":\"contract iOVM_StateTransitioner\",\"name\":\"_ovmStateTransitioner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_contract\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The State Transitioner Factory is used by the Fraud Verifier to create a new State Transitioner during the initialization of a fraud proof. Compiler used: solc Runtime target: EVM\",\"kind\":\"dev\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\",\"_preStateRoot\":\"State root before the transition was executed.\",\"_stateTransitionIndex\":\"Index of the state transition being verified.\",\"_transactionHash\":\"Hash of the executed transaction.\"},\"returns\":{\"_ovmStateTransitioner\":\"New OVM_StateTransitioner instance.\"}}},\"title\":\"OVM_StateTransitionerFactory\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"create(address,uint256,bytes32,bytes32)\":{\"notice\":\"Creates a new OVM_StateTransitioner\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol\":\"OVM_StateTransitionerFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/// Minimal contract to be inherited by contracts consumed by users that provide\\n/// data for fraud proofs\\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\\n /// Decorate your functions with this modifier to store how much total gas was\\n /// consumed by the sender, to reward users fairly\\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\\n uint256 startGas = gasleft();\\n _;\\n uint256 gasSpent = startGas - gasleft();\\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\\n }\\n}\\n\",\"keccak256\":\"0x6c27d089a297103cb93b30f7649ab68691cc6b948c315f1037e5de1fe9bf5903\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_EthUtils } from \\\"../../libraries/utils/Lib_EthUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../../libraries/utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../../libraries/utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../../libraries/rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_RLPReader } from \\\"../../libraries/rlp/Lib_RLPReader.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_BondManager } from \\\"../../iOVM/verification/iOVM_BondManager.sol\\\";\\nimport { iOVM_ExecutionManager } from \\\"../../iOVM/execution/iOVM_ExecutionManager.sol\\\";\\nimport { iOVM_StateManager } from \\\"../../iOVM/execution/iOVM_StateManager.sol\\\";\\nimport { iOVM_StateManagerFactory } from \\\"../../iOVM/execution/iOVM_StateManagerFactory.sol\\\";\\n\\n/* Contract Imports */\\nimport { Abs_FraudContributor } from \\\"./Abs_FraudContributor.sol\\\";\\n\\n/**\\n * @title OVM_StateTransitioner\\n * @dev The State Transitioner coordinates the execution of a state transition during the evaluation of a\\n * fraud proof. It feeds verified input to the Execution Manager's run(), and controls a State Manager (which is\\n * uniquely created for each fraud proof).\\n * Once a fraud proof has been initialized, this contract is provided with the pre-state root and verifies\\n * that the OVM storage slots committed to the State Mangager are contained in that state\\n * This contract controls the State Manager and Execution Manager, and uses them to calculate the\\n * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by comparing\\n * the calculated post-state root with the proposed post-state root.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum TransitionPhase {\\n PRE_EXECUTION,\\n POST_EXECUTION,\\n COMPLETE\\n }\\n\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n iOVM_StateManager public ovmStateManager;\\n\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n bytes32 internal preStateRoot;\\n bytes32 internal postStateRoot;\\n TransitionPhase public phase;\\n uint256 internal stateTransitionIndex;\\n bytes32 internal transactionHash;\\n\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\\n bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _stateTransitionIndex Index of the state transition being verified.\\n * @param _preStateRoot State root before the transition was executed.\\n * @param _transactionHash Hash of the executed transaction.\\n */\\n constructor(\\n address _libAddressManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {\\n stateTransitionIndex = _stateTransitionIndex;\\n preStateRoot = _preStateRoot;\\n postStateRoot = _preStateRoot;\\n transactionHash = _transactionHash;\\n\\n ovmStateManager = iOVM_StateManagerFactory(resolve(\\\"OVM_StateManagerFactory\\\")).create(address(this));\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Checks that a function is only run during a specific phase.\\n * @param _phase Phase the function must run within.\\n */\\n modifier onlyDuringPhase(\\n TransitionPhase _phase\\n ) {\\n require(\\n phase == _phase,\\n \\\"Function must be called during the correct phase.\\\"\\n );\\n _;\\n }\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n /**\\n * Retrieves the state root before execution.\\n * @return _preStateRoot State root before execution.\\n */\\n function getPreStateRoot()\\n override\\n public\\n view\\n returns (\\n bytes32 _preStateRoot\\n )\\n {\\n return preStateRoot;\\n }\\n\\n /**\\n * Retrieves the state root after execution.\\n * @return _postStateRoot State root after execution.\\n */\\n function getPostStateRoot()\\n override\\n public\\n view\\n returns (\\n bytes32 _postStateRoot\\n )\\n {\\n return postStateRoot;\\n }\\n\\n /**\\n * Checks whether the transitioner is complete.\\n * @return _complete Whether or not the transition process is finished.\\n */\\n function isComplete()\\n override\\n public\\n view\\n returns (\\n bool _complete\\n )\\n {\\n return phase == TransitionPhase.COMPLETE;\\n }\\n \\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n /**\\n * Allows a user to prove the initial state of a contract.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _ethContractAddress Address of the corresponding contract on L1.\\n * @param _stateTrieWitness Proof of the account state.\\n */\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes memory _stateTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n // Exit quickly to avoid unnecessary work.\\n require(\\n (\\n ovmStateManager.hasAccount(_ovmContractAddress) == false\\n && ovmStateManager.hasEmptyAccount(_ovmContractAddress) == false\\n ),\\n \\\"Account state has already been proven.\\\"\\n );\\n\\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\\n (\\n bool exists,\\n bytes memory encodedAccount\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(_ovmContractAddress),\\n _stateTrieWitness,\\n preStateRoot\\n );\\n\\n if (exists == true) {\\n // Account exists, this was an inclusion proof.\\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\\n encodedAccount\\n );\\n\\n address ethContractAddress = _ethContractAddress;\\n if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) {\\n // Use a known empty contract to prevent an attack in which a user provides a\\n // contract address here and then later deploys code to it.\\n ethContractAddress = 0x0000000000000000000000000000000000000000;\\n } else {\\n // Otherwise, make sure that the code at the provided eth address matches the hash\\n // of the code stored on L2.\\n require(\\n Lib_EthUtils.getCodeHash(ethContractAddress) == account.codeHash,\\n \\\"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash.\\\"\\n );\\n }\\n\\n ovmStateManager.putAccount(\\n _ovmContractAddress,\\n Lib_OVMCodec.Account({\\n nonce: account.nonce,\\n balance: account.balance,\\n storageRoot: account.storageRoot,\\n codeHash: account.codeHash,\\n ethAddress: ethContractAddress,\\n isFresh: false\\n })\\n );\\n } else {\\n // Account does not exist, this was an exclusion proof.\\n ovmStateManager.putEmptyAccount(_ovmContractAddress);\\n }\\n }\\n\\n /**\\n * Allows a user to prove the initial state of a contract storage slot.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _key Claimed account slot key.\\n * @param _storageTrieWitness Proof of the storage slot.\\n */\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes memory _storageTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n // Exit quickly to avoid unnecessary work.\\n require(\\n ovmStateManager.hasContractStorage(_ovmContractAddress, _key) == false,\\n \\\"Storage slot has already been proven.\\\"\\n );\\n\\n require(\\n ovmStateManager.hasAccount(_ovmContractAddress) == true,\\n \\\"Contract must be verified before proving a storage slot.\\\"\\n );\\n\\n bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress);\\n bytes32 value;\\n\\n if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) {\\n // Storage trie was empty, so the user is always allowed to insert zero-byte values.\\n value = bytes32(0);\\n } else {\\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\\n (\\n bool exists,\\n bytes memory encodedValue\\n ) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(_key),\\n _storageTrieWitness,\\n storageRoot\\n );\\n\\n if (exists == true) {\\n // Inclusion proof.\\n // Stored values are RLP encoded, with leading zeros removed.\\n value = Lib_BytesUtils.toBytes32PadLeft(\\n Lib_RLPReader.readBytes(encodedValue)\\n );\\n } else {\\n // Exclusion proof, can only be zero bytes.\\n value = bytes32(0);\\n }\\n }\\n\\n ovmStateManager.putContractStorage(\\n _ovmContractAddress,\\n _key,\\n value\\n );\\n }\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n /**\\n * Executes the state transition.\\n * @param _transaction OVM transaction to execute.\\n */\\n function applyTransaction(\\n Lib_OVMCodec.Transaction memory _transaction\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n Lib_OVMCodec.hashTransaction(_transaction) == transactionHash,\\n \\\"Invalid transaction provided.\\\"\\n );\\n\\n // We require gas to complete the logic here in run() before/after execution,\\n // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism)\\n // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first \\n // going into EM, then going into the code contract).\\n require(\\n gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, // 1032/1000 = 1.032 = (64/63)^2 rounded up\\n \\\"Not enough gas to execute transaction deterministically.\\\"\\n );\\n\\n iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve(\\\"OVM_ExecutionManager\\\"));\\n\\n // We call `setExecutionManager` right before `run` (and not earlier) just in case the\\n // OVM_ExecutionManager address was updated between the time when this contract was created\\n // and when `applyTransaction` was called.\\n ovmStateManager.setExecutionManager(address(ovmExecutionManager));\\n\\n // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction`\\n // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line\\n // if that's the case.\\n ovmExecutionManager.run(_transaction, address(ovmStateManager));\\n\\n phase = TransitionPhase.POST_EXECUTION;\\n }\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n /**\\n * Allows a user to commit the final state of a contract.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _stateTrieWitness Proof of the account state.\\n */\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes memory _stateTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\\n \\\"All storage must be committed before committing account states.\\\"\\n );\\n\\n require (\\n ovmStateManager.commitAccount(_ovmContractAddress) == true,\\n \\\"Account state wasn't changed or has already been committed.\\\"\\n );\\n\\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\\n\\n postStateRoot = Lib_SecureMerkleTrie.update(\\n abi.encodePacked(_ovmContractAddress),\\n Lib_OVMCodec.encodeEVMAccount(\\n Lib_OVMCodec.toEVMAccount(account)\\n ),\\n _stateTrieWitness,\\n postStateRoot\\n );\\n\\n // Emit an event to help clients figure out the proof ordering.\\n emit AccountCommitted(\\n _ovmContractAddress\\n );\\n }\\n\\n /**\\n * Allows a user to commit the final state of a contract storage slot.\\n * @param _ovmContractAddress Address of the contract on the OVM.\\n * @param _key Claimed account slot key.\\n * @param _storageTrieWitness Proof of the storage slot.\\n */\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes memory _storageTrieWitness\\n )\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n contributesToFraudProof(preStateRoot, transactionHash)\\n {\\n require(\\n ovmStateManager.commitContractStorage(_ovmContractAddress, _key) == true,\\n \\\"Storage slot value wasn't changed or has already been committed.\\\"\\n );\\n\\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\\n bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key);\\n\\n account.storageRoot = Lib_SecureMerkleTrie.update(\\n abi.encodePacked(_key),\\n Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(value)\\n ),\\n _storageTrieWitness,\\n account.storageRoot\\n );\\n\\n ovmStateManager.putAccount(_ovmContractAddress, account);\\n\\n // Emit an event to help clients figure out the proof ordering.\\n emit ContractStorageCommitted(\\n _ovmContractAddress,\\n _key\\n );\\n }\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n /**\\n * Finalizes the transition process.\\n */\\n function completeTransition()\\n override\\n public\\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\\n {\\n require(\\n ovmStateManager.getTotalUncommittedAccounts() == 0,\\n \\\"All accounts must be committed before completing a transition.\\\"\\n );\\n\\n require(\\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\\n \\\"All storage must be committed before completing a transition.\\\"\\n );\\n\\n phase = TransitionPhase.COMPLETE;\\n }\\n}\\n\",\"keccak256\":\"0xbff1135355a03ea535c952bd130799fdc95d2a559622830afabf70aba7f62742\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"../../iOVM/verification/iOVM_StateTransitioner.sol\\\";\\nimport { iOVM_StateTransitionerFactory } from \\\"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\\\";\\nimport { iOVM_FraudVerifier } from \\\"../../iOVM/verification/iOVM_FraudVerifier.sol\\\";\\n\\n/* Contract Imports */\\nimport { OVM_StateTransitioner } from \\\"./OVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title OVM_StateTransitionerFactory\\n * @dev The State Transitioner Factory is used by the Fraud Verifier to create a new State \\n * Transitioner during the initialization of a fraud proof.\\n * \\n * Compiler used: solc\\n * Runtime target: EVM\\n */\\ncontract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_AddressResolver {\\n\\n constructor(\\n address _libAddressManager\\n )\\n public\\n Lib_AddressResolver(_libAddressManager)\\n {}\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n /**\\n * Creates a new OVM_StateTransitioner\\n * @param _libAddressManager Address of the Address Manager.\\n * @param _stateTransitionIndex Index of the state transition being verified.\\n * @param _preStateRoot State root before the transition was executed.\\n * @param _transactionHash Hash of the executed transaction.\\n * @return _ovmStateTransitioner New OVM_StateTransitioner instance.\\n */\\n function create(\\n address _libAddressManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n override\\n public\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n )\\n {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"Create can only be done by the OVM_FraudVerifier.\\\"\\n );\\n return new OVM_StateTransitioner(\\n _libAddressManager,\\n _stateTransitionIndex,\\n _preStateRoot,\\n _transactionHash\\n );\\n }\\n}\\n\",\"keccak256\":\"0x6caf30cd761fb3b1fbe4765fd18e2636fbd8f96bf8403216797664dac726aed2\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\ninterface iOVM_ExecutionManager {\\n /**********\\n * Enums *\\n *********/\\n\\n enum RevertFlag {\\n DID_NOT_REVERT,\\n OUT_OF_GAS,\\n INTENTIONAL_REVERT,\\n EXCEEDS_NUISANCE_GAS,\\n INVALID_STATE_ACCESS,\\n UNSAFE_BYTECODE,\\n CREATE_COLLISION,\\n STATIC_VIOLATION,\\n CREATE_EXCEPTION,\\n CREATOR_NOT_ALLOWED\\n }\\n\\n enum GasMetadataKey {\\n CURRENT_EPOCH_START_TIMESTAMP,\\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\\n CUMULATIVE_L1TOL2_QUEUE_GAS,\\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\\n PREV_EPOCH_L1TOL2_QUEUE_GAS\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct GasMeterConfig {\\n uint256 minTransactionGasLimit;\\n uint256 maxTransactionGasLimit;\\n uint256 maxGasPerQueuePerEpoch;\\n uint256 secondsPerEpoch;\\n }\\n\\n struct GlobalContext {\\n uint256 ovmCHAINID;\\n }\\n\\n struct TransactionContext {\\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\\n uint256 ovmTIMESTAMP;\\n uint256 ovmNUMBER;\\n uint256 ovmGASLIMIT;\\n uint256 ovmTXGASLIMIT;\\n address ovmL1TXORIGIN;\\n }\\n\\n struct TransactionRecord {\\n uint256 ovmGasRefund;\\n }\\n\\n struct MessageContext {\\n address ovmCALLER;\\n address ovmADDRESS;\\n bool isStatic;\\n }\\n\\n struct MessageRecord {\\n uint256 nuisanceGasLeft;\\n RevertFlag revertFlag;\\n }\\n\\n\\n /************************************\\n * Transaction Execution Entrypoint *\\n ************************************/\\n\\n function run(\\n Lib_OVMCodec.Transaction calldata _transaction,\\n address _txStateManager\\n ) external;\\n\\n\\n /*******************\\n * Context Opcodes *\\n *******************/\\n\\n function ovmCALLER() external view returns (address _caller);\\n function ovmADDRESS() external view returns (address _address);\\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\\n function ovmNUMBER() external view returns (uint256 _number);\\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\\n function ovmCHAINID() external view returns (uint256 _chainId);\\n\\n\\n /**********************\\n * L2 Context Opcodes *\\n **********************/\\n\\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\\n\\n\\n /*******************\\n * Halting Opcodes *\\n *******************/\\n\\n function ovmREVERT(bytes memory _data) external;\\n\\n\\n /*****************************\\n * Contract Creation Opcodes *\\n *****************************/\\n\\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\\n\\n\\n /*******************************\\n * Account Abstraction Opcodes *\\n ******************************/\\n\\n function ovmGETNONCE() external returns (uint256 _nonce);\\n function ovmSETNONCE(uint256 _nonce) external;\\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\\n\\n\\n /****************************\\n * Contract Calling Opcodes *\\n ****************************/\\n\\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\\n\\n\\n /****************************\\n * Contract Storage Opcodes *\\n ****************************/\\n\\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\\n\\n\\n /*************************\\n * Contract Code Opcodes *\\n *************************/\\n\\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\\n\\n\\n /**************************************\\n * Public Functions: Execution Safety *\\n **************************************/\\n\\n function safeCREATE(address _address, bytes memory _bytecode) external;\\n\\n /***************************************\\n * Public Functions: Execution Context *\\n ***************************************/\\n\\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\\n}\\n\",\"keccak256\":\"0xed2ea81fb87874b10ebd34339f0690107a841672941de37b405c2da2c285cff0\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateManager\\n */\\ninterface iOVM_StateManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum ItemState {\\n ITEM_UNTOUCHED,\\n ITEM_LOADED,\\n ITEM_CHANGED,\\n ITEM_COMMITTED\\n }\\n\\n /***************************\\n * Public Functions: Misc *\\n ***************************/\\n\\n function isAuthenticated(address _address) external view returns (bool);\\n\\n /***************************\\n * Public Functions: Setup *\\n ***************************/\\n\\n function owner() external view returns (address _owner);\\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\\n function setExecutionManager(address _ovmExecutionManager) external;\\n\\n\\n /************************************\\n * Public Functions: Account Access *\\n ************************************/\\n\\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\\n function putEmptyAccount(address _address) external;\\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\\n function hasAccount(address _address) external view returns (bool _exists);\\n function hasEmptyAccount(address _address) external view returns (bool _exists);\\n function setAccountNonce(address _address, uint256 _nonce) external;\\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\\n function initPendingAccount(address _address) external;\\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\\n function incrementTotalUncommittedAccounts() external;\\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\\n function wasAccountChanged(address _address) external view returns (bool);\\n function wasAccountCommitted(address _address) external view returns (bool);\\n\\n\\n /************************************\\n * Public Functions: Storage Access *\\n ************************************/\\n\\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\\n function incrementTotalUncommittedContractStorage() external;\\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x7a11dbd1f61593ba34debe07e39eef59967307f7f372ba9855bee0953585d08d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateManager } from \\\"./iOVM_StateManager.sol\\\";\\n\\n/**\\n * @title iOVM_StateManagerFactory\\n */\\ninterface iOVM_StateManagerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _owner\\n )\\n external\\n returns (\\n iOVM_StateManager _ovmStateManager\\n );\\n}\\n\",\"keccak256\":\"0x27a90fc43889d0c7d1db50f37907ef7386d9b415d15a1e91a0a068cba59afd36\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\ninterface ERC20 {\\n function transfer(address, uint256) external returns (bool);\\n function transferFrom(address, address, uint256) external returns (bool);\\n}\\n\\n/// All the errors which may be encountered on the bond manager\\nlibrary Errors {\\n string constant ERC20_ERR = \\\"BondManager: Could not post bond\\\";\\n string constant ALREADY_FINALIZED = \\\"BondManager: Fraud proof for this pre-state root has already been finalized\\\";\\n string constant SLASHED = \\\"BondManager: Cannot finalize withdrawal, you probably got slashed\\\";\\n string constant WRONG_STATE = \\\"BondManager: Wrong bond state for proposer\\\";\\n string constant CANNOT_CLAIM = \\\"BondManager: Cannot claim yet. Dispute must be finalized first\\\";\\n\\n string constant WITHDRAWAL_PENDING = \\\"BondManager: Withdrawal already pending\\\";\\n string constant TOO_EARLY = \\\"BondManager: Too early to finalize your withdrawal\\\";\\n\\n string constant ONLY_TRANSITIONER = \\\"BondManager: Only the transitioner for this pre-state root may call this function\\\";\\n string constant ONLY_FRAUD_VERIFIER = \\\"BondManager: Only the fraud verifier may call this function\\\";\\n string constant ONLY_STATE_COMMITMENT_CHAIN = \\\"BondManager: Only the state commitment chain may call this function\\\";\\n string constant WAIT_FOR_DISPUTES = \\\"BondManager: Wait for other potential disputes\\\";\\n}\\n\\n/**\\n * @title iOVM_BondManager\\n */\\ninterface iOVM_BondManager {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n /// The lifecycle of a proposer's bond\\n enum State {\\n // Before depositing or after getting slashed, a user is uncollateralized\\n NOT_COLLATERALIZED,\\n // After depositing, a user is collateralized\\n COLLATERALIZED,\\n // After a user has initiated a withdrawal\\n WITHDRAWING\\n }\\n\\n /// A bond posted by a proposer\\n struct Bond {\\n // The user's state\\n State state;\\n // The timestamp at which a proposer issued their withdrawal request\\n uint32 withdrawalTimestamp;\\n // The time when the first disputed was initiated for this bond\\n uint256 firstDisputeAt;\\n // The earliest observed state root for this bond which has had fraud\\n bytes32 earliestDisputedStateRoot;\\n // The state root's timestamp\\n uint256 earliestTimestamp;\\n }\\n\\n // Per pre-state root, store the number of state provisions that were made\\n // and how many of these calls were made by each user. Payouts will then be\\n // claimed by users proportionally for that dispute.\\n struct Rewards {\\n // Flag to check if rewards for a fraud proof are claimable\\n bool canClaim;\\n // Total number of `recordGasSpent` calls made\\n uint256 total;\\n // The gas spent by each user to provide witness data. The sum of all\\n // values inside this map MUST be equal to the value of `total`\\n mapping(address => uint256) gasSpent;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function recordGasSpent(\\n bytes32 _preStateRoot,\\n bytes32 _txHash,\\n address _who,\\n uint256 _gasSpent\\n ) external;\\n\\n function finalize(\\n bytes32 _preStateRoot,\\n address _publisher,\\n uint256 _timestamp\\n ) external;\\n\\n function deposit() external;\\n\\n function startWithdrawal() external;\\n\\n function finalizeWithdrawal() external;\\n\\n function claim(\\n address _who\\n ) external;\\n\\n function isCollateralized(\\n address _who\\n ) external view returns (bool);\\n\\n function getGasSpent(\\n bytes32 _preStateRoot,\\n address _who\\n ) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x3c2a8a399487857158649db1896749d86e39cba545a8aeb2e2bb0f3bdfa7a5b1\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_FraudVerifier\\n */\\ninterface iOVM_FraudVerifier {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event FraudProofInitialized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n event FraudProofFinalized(\\n bytes32 _preStateRoot,\\n uint256 _preStateRootIndex,\\n bytes32 _transactionHash,\\n address _who\\n );\\n\\n\\n /***************************************\\n * Public Functions: Transition Status *\\n ***************************************/\\n\\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\\n\\n\\n /****************************************\\n * Public Functions: Fraud Verification *\\n ****************************************/\\n\\n function initializeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n Lib_OVMCodec.Transaction calldata _transaction,\\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\\n ) external;\\n\\n function finalizeFraudVerification(\\n bytes32 _preStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\\n bytes32 _txHash,\\n bytes32 _postStateRoot,\\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\\n ) external;\\n}\\n\",\"keccak256\":\"0x5efd7bb18164bbd3e9d58379e8203fbf2a7ee802b1a48dff3ceaaec1523b1751\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitioner\\n */\\ninterface iOVM_StateTransitioner {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AccountCommitted(\\n address _address\\n );\\n\\n event ContractStorageCommitted(\\n address _address,\\n bytes32 _key\\n );\\n\\n\\n /**********************************\\n * Public Functions: State Access *\\n **********************************/\\n\\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\\n function isComplete() external view returns (bool _complete);\\n\\n\\n /***********************************\\n * Public Functions: Pre-Execution *\\n ***********************************/\\n\\n function proveContractState(\\n address _ovmContractAddress,\\n address _ethContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function proveStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /*******************************\\n * Public Functions: Execution *\\n *******************************/\\n\\n function applyTransaction(\\n Lib_OVMCodec.Transaction calldata _transaction\\n ) external;\\n\\n\\n /************************************\\n * Public Functions: Post-Execution *\\n ************************************/\\n\\n function commitContractState(\\n address _ovmContractAddress,\\n bytes calldata _stateTrieWitness\\n ) external;\\n\\n function commitStorageSlot(\\n address _ovmContractAddress,\\n bytes32 _key,\\n bytes calldata _storageTrieWitness\\n ) external;\\n\\n\\n /**********************************\\n * Public Functions: Finalization *\\n **********************************/\\n\\n function completeTransition() external;\\n}\\n\",\"keccak256\":\"0x3d044ac0a3bb6ad3d529f904b3191117511f9c379678ca03010e1ebdfcb5c34b\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { iOVM_StateTransitioner } from \\\"./iOVM_StateTransitioner.sol\\\";\\n\\n/**\\n * @title iOVM_StateTransitionerFactory\\n */\\ninterface iOVM_StateTransitionerFactory {\\n\\n /***************************************\\n * Public Functions: Contract Creation *\\n ***************************************/\\n\\n function create(\\n address _proxyManager,\\n uint256 _stateTransitionIndex,\\n bytes32 _preStateRoot,\\n bytes32 _transactionHash\\n )\\n external\\n returns (\\n iOVM_StateTransitioner _ovmStateTransitioner\\n );\\n}\\n\",\"keccak256\":\"0x60a0f0c104e4c0c7863268a93005762e8146d393f9cfddfdd6a2d6585c5911fc\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"../utils/Lib_Bytes32Utils.sol\\\";\\nimport { Lib_SafeExecutionManagerWrapper } from \\\"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\\\";\\n\\n/**\\n * @title Lib_OVMCodec\\n */\\nlibrary Lib_OVMCodec {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n bytes constant internal RLP_NULL_BYTES = hex'80';\\n bytes constant internal NULL_BYTES = bytes('');\\n\\n // Ring buffer IDs\\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\\\"RING_BUFFER_SCC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\\\"RING_BUFFER_CTC_BATCHES\\\");\\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\\\"RING_BUFFER_CTC_QUEUE\\\");\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum EOASignatureType {\\n EIP155_TRANSACTON,\\n ETH_SIGNED_MESSAGE\\n }\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Account {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n address ethAddress;\\n bool isFresh;\\n }\\n\\n struct EVMAccount {\\n uint256 nonce;\\n uint256 balance;\\n bytes32 storageRoot;\\n bytes32 codeHash;\\n }\\n\\n struct ChainBatchHeader {\\n uint256 batchIndex;\\n bytes32 batchRoot;\\n uint256 batchSize;\\n uint256 prevTotalElements;\\n bytes extraData;\\n }\\n\\n struct ChainInclusionProof {\\n uint256 index;\\n bytes32[] siblings;\\n }\\n\\n struct Transaction {\\n uint256 timestamp;\\n uint256 blockNumber;\\n QueueOrigin l1QueueOrigin;\\n address l1TxOrigin;\\n address entrypoint;\\n uint256 gasLimit;\\n bytes data;\\n }\\n\\n struct TransactionChainElement {\\n bool isSequenced;\\n uint256 queueIndex; // QUEUED TX ONLY\\n uint256 timestamp; // SEQUENCER TX ONLY\\n uint256 blockNumber; // SEQUENCER TX ONLY\\n bytes txData; // SEQUENCER TX ONLY\\n }\\n\\n struct QueueElement {\\n bytes32 queueRoot;\\n uint40 timestamp;\\n uint40 blockNumber;\\n }\\n\\n struct EIP155Transaction {\\n uint256 nonce;\\n uint256 gasPrice;\\n uint256 gasLimit;\\n address to;\\n uint256 value;\\n bytes data;\\n uint256 chainId;\\n }\\n\\n\\n /*********************************************\\n * Internal Functions: Encoding and Decoding *\\n *********************************************/\\n\\n /**\\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\\n * @param _transaction Encoded EOA transaction.\\n * @return _decoded Transaction decoded into a struct.\\n */\\n function decodeEIP155Transaction(\\n bytes memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n EIP155Transaction memory _decoded\\n )\\n {\\n if (_isEthSignedMessage) {\\n (\\n uint256 _nonce,\\n uint256 _gasLimit,\\n uint256 _gasPrice,\\n uint256 _chainId,\\n address _to,\\n bytes memory _data\\n ) = abi.decode(\\n _transaction,\\n (uint256, uint256, uint256, uint256, address ,bytes)\\n );\\n return EIP155Transaction({\\n nonce: _nonce,\\n gasPrice: _gasPrice,\\n gasLimit: _gasLimit,\\n to: _to,\\n value: 0,\\n data: _data,\\n chainId: _chainId\\n });\\n } else {\\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\\n\\n return EIP155Transaction({\\n nonce: Lib_RLPReader.readUint256(decoded[0]),\\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\\n to: Lib_RLPReader.readAddress(decoded[3]),\\n value: Lib_RLPReader.readUint256(decoded[4]),\\n data: Lib_RLPReader.readBytes(decoded[5]),\\n chainId: Lib_RLPReader.readUint256(decoded[6])\\n });\\n }\\n }\\n\\n function decompressEIP155Transaction(\\n bytes memory _transaction\\n )\\n internal\\n returns (\\n EIP155Transaction memory _decompressed\\n )\\n {\\n return EIP155Transaction({\\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\\n to: Lib_BytesUtils.toAddress(_transaction, 9),\\n data: Lib_BytesUtils.slice(_transaction, 29),\\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\\n value: 0\\n });\\n }\\n\\n /**\\n * Encodes an EOA transaction back into the original transaction.\\n * @param _transaction EIP155transaction to encode.\\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\\n * @return Encoded transaction.\\n */\\n function encodeEIP155Transaction(\\n EIP155Transaction memory _transaction,\\n bool _isEthSignedMessage\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n if (_isEthSignedMessage) {\\n return abi.encode(\\n _transaction.nonce,\\n _transaction.gasLimit,\\n _transaction.gasPrice,\\n _transaction.chainId,\\n _transaction.to,\\n _transaction.data\\n );\\n } else {\\n bytes[] memory raw = new bytes[](9);\\n\\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\\n if (_transaction.to == address(0)) {\\n raw[3] = Lib_RLPWriter.writeBytes('');\\n } else {\\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\\n }\\n raw[4] = Lib_RLPWriter.writeUint(0);\\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n }\\n\\n /**\\n * Encodes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _encoded Encoded transaction bytes.\\n */\\n function encodeTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n return abi.encodePacked(\\n _transaction.timestamp,\\n _transaction.blockNumber,\\n _transaction.l1QueueOrigin,\\n _transaction.l1TxOrigin,\\n _transaction.entrypoint,\\n _transaction.gasLimit,\\n _transaction.data\\n );\\n }\\n\\n /**\\n * Hashes a standard OVM transaction.\\n * @param _transaction OVM transaction to encode.\\n * @return _hash Hashed transaction\\n */\\n function hashTransaction(\\n Transaction memory _transaction\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(encodeTransaction(_transaction));\\n }\\n\\n /**\\n * Converts an OVM account to an EVM account.\\n * @param _in OVM account to convert.\\n * @return _out Converted EVM account.\\n */\\n function toEVMAccount(\\n Account memory _in\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _out\\n )\\n {\\n return EVMAccount({\\n nonce: _in.nonce,\\n balance: _in.balance,\\n storageRoot: _in.storageRoot,\\n codeHash: _in.codeHash\\n });\\n }\\n\\n /**\\n * @notice RLP-encodes an account state struct.\\n * @param _account Account state struct.\\n * @return _encoded RLP-encoded account state.\\n */\\n function encodeEVMAccount(\\n EVMAccount memory _account\\n )\\n internal\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes[] memory raw = new bytes[](4);\\n\\n // Unfortunately we can't create this array outright because\\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\\n // index-by-index circumvents this issue.\\n raw[0] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.nonce)\\n )\\n );\\n raw[1] = Lib_RLPWriter.writeBytes(\\n Lib_Bytes32Utils.removeLeadingZeros(\\n bytes32(_account.balance)\\n )\\n );\\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\\n\\n return Lib_RLPWriter.writeList(raw);\\n }\\n\\n /**\\n * @notice Decodes an RLP-encoded account state into a useful struct.\\n * @param _encoded RLP-encoded account state.\\n * @return _account Account state struct.\\n */\\n function decodeEVMAccount(\\n bytes memory _encoded\\n )\\n internal\\n pure\\n returns (\\n EVMAccount memory _account\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return EVMAccount({\\n nonce: Lib_RLPReader.readUint256(accountState[0]),\\n balance: Lib_RLPReader.readUint256(accountState[1]),\\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\\n });\\n }\\n\\n /**\\n * Calculates a hash for a given batch header.\\n * @param _batchHeader Header to hash.\\n * @return _hash Hash of the header.\\n */\\n function hashBatchHeader(\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x19d78734777b4998f1544e235cf3934f20c5055cd76c2bd60bf0f6dacdd72b3a\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Contract Imports */\\nimport { Ownable } from \\\"./Lib_Ownable.sol\\\";\\n\\n/**\\n * @title Lib_AddressManager\\n */\\ncontract Lib_AddressManager is Ownable {\\n\\n /**********\\n * Events *\\n **********/\\n\\n event AddressSet(\\n string _name,\\n address _newAddress\\n );\\n\\n /*******************************************\\n * Contract Variables: Internal Accounting *\\n *******************************************/\\n\\n mapping (bytes32 => address) private addresses;\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function setAddress(\\n string memory _name,\\n address _address\\n )\\n public\\n onlyOwner\\n {\\n emit AddressSet(_name, _address);\\n addresses[_getNameHash(_name)] = _address;\\n }\\n\\n function getAddress(\\n string memory _name\\n )\\n public\\n view\\n returns (address)\\n {\\n return addresses[_getNameHash(_name)];\\n }\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function _getNameHash(\\n string memory _name\\n )\\n internal\\n pure\\n returns (\\n bytes32 _hash\\n )\\n {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0x3a490595cc21ff170e4027843093670ff845d5972481fbfb956b722ea564bb06\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\ncontract Lib_AddressResolver {\\n\\n /*******************************************\\n * Contract Variables: Contract References *\\n *******************************************/\\n\\n Lib_AddressManager internal libAddressManager;\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(\\n address _libAddressManager\\n ) public {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function resolve(\\n string memory _name\\n )\\n public\\n view\\n returns (\\n address _contract\\n )\\n {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0xc44f1c6e022e57ba6d62f2eaccc9bca2fec54b38d52b6e7288f71ddc133ef61d\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Ownable\\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\\n */\\nabstract contract Ownable {\\n\\n /*************\\n * Variables *\\n *************/\\n\\n address public owner;\\n\\n\\n /**********\\n * Events *\\n **********/\\n\\n event OwnershipTransferred(\\n address indexed previousOwner,\\n address indexed newOwner\\n );\\n\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor() internal {\\n owner = msg.sender;\\n emit OwnershipTransferred(address(0), owner);\\n }\\n\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n owner == msg.sender,\\n \\\"Ownable: caller is not the owner\\\"\\n );\\n _;\\n }\\n\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function renounceOwnership()\\n public\\n virtual\\n onlyOwner\\n {\\n emit OwnershipTransferred(owner, address(0));\\n owner = address(0);\\n }\\n\\n function transferOwnership(address _newOwner)\\n public\\n virtual\\n onlyOwner\\n {\\n require(\\n _newOwner != address(0),\\n \\\"Ownable: new owner cannot be the zero address\\\"\\n );\\n\\n emit OwnershipTransferred(owner, _newOwner);\\n owner = _newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xeaed44565a7fd2c957b5a30d999934b93d558d4fa8011aa48afafeda76b8bf6e\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 constant internal MAX_LIST_LENGTH = 32;\\n\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n \\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\n }\\n \\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n \\n /**\\n * Converts bytes to a reference to memory position and length.\\n * @param _in Input bytes to convert.\\n * @return Output memory reference.\\n */\\n function toRLPItem(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem memory\\n )\\n {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({\\n length: _in.length,\\n ptr: ptr\\n });\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n (\\n uint256 listOffset,\\n ,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.LIST_ITEM,\\n \\\"Invalid RLP list value.\\\"\\n );\\n\\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\\n // writing to the length. Since we can't know the number of RLP items without looping over\\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\\n // simply set a reasonable maximum list length and decrease the size before we finish.\\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\\n\\n uint256 itemCount = 0;\\n uint256 offset = listOffset;\\n while (offset < _in.length) {\\n require(\\n itemCount < MAX_LIST_LENGTH,\\n \\\"Provided RLP list exceeds max list length.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n ) = _decodeLength(RLPItem({\\n length: _in.length - offset,\\n ptr: _in.ptr + offset\\n }));\\n\\n out[itemCount] = RLPItem({\\n length: itemLength + itemOffset,\\n ptr: _in.ptr + offset\\n });\\n\\n itemCount += 1;\\n offset += itemOffset + itemLength;\\n }\\n\\n // Decrease the array size to match the actual item count.\\n assembly {\\n mstore(out, itemCount)\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP list value into a list of RLP items.\\n * @param _in RLP list value.\\n * @return Decoded RLP list items.\\n */\\n function readList(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n RLPItem[] memory\\n )\\n {\\n return readList(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes value.\\\"\\n );\\n\\n return _copy(_in.ptr, itemOffset, itemLength);\\n }\\n\\n /**\\n * Reads an RLP bytes value into bytes.\\n * @param _in RLP bytes value.\\n * @return Decoded bytes.\\n */\\n function readBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return readBytes(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return string(readBytes(_in));\\n }\\n\\n /**\\n * Reads an RLP string value into a string.\\n * @param _in RLP string value.\\n * @return Decoded string.\\n */\\n function readString(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n string memory\\n )\\n {\\n return readString(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n require(\\n _in.length <= 33,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n (\\n uint256 itemOffset,\\n uint256 itemLength,\\n RLPItemType itemType\\n ) = _decodeLength(_in);\\n\\n require(\\n itemType == RLPItemType.DATA_ITEM,\\n \\\"Invalid RLP bytes32 value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr + itemOffset;\\n bytes32 out;\\n assembly {\\n out := mload(ptr)\\n\\n // Shift the bytes over to match the item size.\\n if lt(itemLength, 32) {\\n out := div(out, exp(256, sub(32, itemLength)))\\n }\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Reads an RLP bytes32 value into a bytes32.\\n * @param _in RLP bytes32 value.\\n * @return Decoded bytes32.\\n */\\n function readBytes32(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes32\\n )\\n {\\n return readBytes32(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return uint256(readBytes32(_in));\\n }\\n\\n /**\\n * Reads an RLP uint256 value into a uint256.\\n * @param _in RLP uint256 value.\\n * @return Decoded uint256.\\n */\\n function readUint256(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n uint256\\n )\\n {\\n return readUint256(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n require(\\n _in.length == 1,\\n \\\"Invalid RLP boolean value.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n return out != 0;\\n }\\n\\n /**\\n * Reads an RLP bool value into a bool.\\n * @param _in RLP bool value.\\n * @return Decoded bool.\\n */\\n function readBool(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bool\\n )\\n {\\n return readBool(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(\\n _in.length == 21,\\n \\\"Invalid RLP address value.\\\"\\n );\\n\\n return address(readUint256(_in));\\n }\\n\\n /**\\n * Reads an RLP address value into a address.\\n * @param _in RLP address value.\\n * @return Decoded address.\\n */\\n function readAddress(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n address\\n )\\n {\\n return readAddress(\\n toRLPItem(_in)\\n );\\n }\\n\\n /**\\n * Reads the raw bytes of an RLP item.\\n * @param _in RLP item to read.\\n * @return Raw RLP bytes.\\n */\\n function readRawBytes(\\n RLPItem memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Decodes the length of an RLP item.\\n * @param _in RLP item to decode.\\n * @return Offset of the encoded data.\\n * @return Length of the encoded data.\\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\\n */\\n function _decodeLength(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(\\n _in.length > 0,\\n \\\"RLP item cannot be null.\\\"\\n );\\n\\n uint256 ptr = _in.ptr;\\n uint256 prefix;\\n assembly {\\n prefix := byte(0, mload(ptr))\\n }\\n\\n if (prefix <= 0x7f) {\\n // Single byte.\\n\\n return (0, 1, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xb7) {\\n // Short string.\\n\\n uint256 strLen = prefix - 0x80;\\n \\n require(\\n _in.length > strLen,\\n \\\"Invalid RLP short string.\\\"\\n );\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(\\n _in.length > lenOfStrLen,\\n \\\"Invalid RLP long string length.\\\"\\n );\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfStrLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfStrLen + strLen,\\n \\\"Invalid RLP long string.\\\"\\n );\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n uint256 listLen = prefix - 0xc0;\\n\\n require(\\n _in.length > listLen,\\n \\\"Invalid RLP short list.\\\"\\n );\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(\\n _in.length > lenOfListLen,\\n \\\"Invalid RLP long list length.\\\"\\n );\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(\\n mload(add(ptr, 1)),\\n exp(256, sub(32, lenOfListLen))\\n )\\n }\\n\\n require(\\n _in.length > lenOfListLen + listLen,\\n \\\"Invalid RLP long list.\\\"\\n );\\n\\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\\n }\\n }\\n\\n /**\\n * Copies the bytes from a memory location.\\n * @param _src Pointer to the location to read from.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return Copied bytes.\\n */\\n function _copy(\\n uint256 _src,\\n uint256 _offset,\\n uint256 _length\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n bytes memory out = new bytes(_length);\\n if (out.length == 0) {\\n return out;\\n }\\n\\n uint256 src = _src + _offset;\\n uint256 dest;\\n assembly {\\n dest := add(out, 32)\\n }\\n\\n // Copy over as many complete words as we can.\\n for (uint256 i = 0; i < _length / 32; i++) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n\\n src += 32;\\n dest += 32;\\n }\\n\\n // Pick out the remaining bytes.\\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\\n assembly {\\n mstore(\\n dest,\\n or(\\n and(mload(src), not(mask)),\\n and(mload(dest), mask)\\n )\\n )\\n }\\n\\n return out;\\n }\\n\\n /**\\n * Copies an RLP item into bytes.\\n * @param _in RLP item to copy.\\n * @return Copied bytes.\\n */\\n function _copy(\\n RLPItem memory _in\\n )\\n private\\n pure\\n returns (\\n bytes memory\\n )\\n {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xf0c0dbbe5e77adb1b603d6d4af319d15cea8c6d66fd5dca8115d80917617bf77\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * RLP encodes a byte string.\\n * @param _in The byte string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeBytes(\\n bytes memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded;\\n\\n if (_in.length == 1 && uint8(_in[0]) < 128) {\\n encoded = _in;\\n } else {\\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * RLP encodes a list of RLP encoded byte byte strings.\\n * @param _in The list of RLP encoded byte strings.\\n * @return _out The RLP encoded list of items in bytes.\\n */\\n function writeList(\\n bytes[] memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory list = _flatten(_in);\\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\\n }\\n\\n /**\\n * RLP encodes a string.\\n * @param _in The string to encode.\\n * @return _out The RLP encoded string in bytes.\\n */\\n function writeString(\\n string memory _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(bytes(_in));\\n }\\n\\n /**\\n * RLP encodes an address.\\n * @param _in The address to encode.\\n * @return _out The RLP encoded address in bytes.\\n */\\n function writeAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(abi.encodePacked(_in));\\n }\\n\\n /**\\n * RLP encodes a uint.\\n * @param _in The uint256 to encode.\\n * @return _out The RLP encoded uint256 in bytes.\\n */\\n function writeUint(\\n uint256 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n return writeBytes(_toBinary(_in));\\n }\\n\\n /**\\n * RLP encodes a bool.\\n * @param _in The bool to encode.\\n * @return _out The RLP encoded bool in bytes.\\n */\\n function writeBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\\n * @param _len The length of the string or the payload.\\n * @param _offset 128 if item is string, 192 if item is list.\\n * @return _encoded RLP encoded bytes.\\n */\\n function _writeLength(\\n uint256 _len,\\n uint256 _offset\\n )\\n private\\n pure\\n returns (\\n bytes memory _encoded\\n )\\n {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = byte(uint8(_len) + uint8(_offset));\\n } else {\\n uint256 lenLen;\\n uint256 i = 1;\\n while (_len / i != 0) {\\n lenLen++;\\n i *= 256;\\n }\\n\\n encoded = new bytes(lenLen + 1);\\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\\n for(i = 1; i <= lenLen; i++) {\\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\\n }\\n }\\n\\n return encoded;\\n }\\n\\n /**\\n * Encode integer in big endian binary form with no leading zeroes.\\n * @notice TODO: This should be optimized with assembly to save gas costs.\\n * @param _x The integer to encode.\\n * @return _binary RLP encoded bytes.\\n */\\n function _toBinary(\\n uint256 _x\\n )\\n private\\n pure\\n returns (\\n bytes memory _binary\\n )\\n {\\n bytes memory b = abi.encodePacked(_x);\\n\\n uint256 i = 0;\\n for (; i < 32; i++) {\\n if (b[i] != 0) {\\n break;\\n }\\n }\\n\\n bytes memory res = new bytes(32 - i);\\n for (uint256 j = 0; j < res.length; j++) {\\n res[j] = b[i++];\\n }\\n\\n return res;\\n }\\n\\n /**\\n * Copies a piece of memory to another location.\\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\\n * @param _dest Destination location.\\n * @param _src Source location.\\n * @param _len Length of memory to copy.\\n */\\n function _memcpy(\\n uint256 _dest,\\n uint256 _src,\\n uint256 _len\\n )\\n private\\n pure\\n {\\n uint256 dest = _dest;\\n uint256 src = _src;\\n uint256 len = _len;\\n\\n for(; len >= 32; len -= 32) {\\n assembly {\\n mstore(dest, mload(src))\\n }\\n dest += 32;\\n src += 32;\\n }\\n\\n uint256 mask = 256 ** (32 - len) - 1;\\n assembly {\\n let srcpart := and(mload(src), not(mask))\\n let destpart := and(mload(dest), mask)\\n mstore(dest, or(destpart, srcpart))\\n }\\n }\\n\\n /**\\n * Flattens a list of byte strings into one byte string.\\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\\n * @param _list List of byte strings to flatten.\\n * @return _flattened The flattened byte string.\\n */\\n function _flatten(\\n bytes[] memory _list\\n )\\n private\\n pure\\n returns (\\n bytes memory _flattened\\n )\\n {\\n if (_list.length == 0) {\\n return new bytes(0);\\n }\\n\\n uint256 len;\\n uint256 i = 0;\\n for (; i < _list.length; i++) {\\n len += _list[i].length;\\n }\\n\\n bytes memory flattened = new bytes(len);\\n uint256 flattenedPtr;\\n assembly { flattenedPtr := add(flattened, 0x20) }\\n\\n for(i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly { listPtr := add(item, 0x20)}\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\",\"keccak256\":\"0x854dfe1ed365e5840ad9b9d1330f5b196d4b1b9890a1187f3d32d785acd742bf\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/* Library Imports */\\nimport { Lib_BytesUtils } from \\\"../utils/Lib_BytesUtils.sol\\\";\\nimport { Lib_RLPReader } from \\\"../rlp/Lib_RLPReader.sol\\\";\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\n\\n/**\\n * @title Lib_MerkleTrie\\n */\\nlibrary Lib_MerkleTrie {\\n\\n /*******************\\n * Data Structures *\\n *******************/\\n\\n enum NodeType {\\n BranchNode,\\n ExtensionNode,\\n LeafNode\\n }\\n\\n struct TrieNode {\\n bytes encoded;\\n Lib_RLPReader.RLPItem[] decoded;\\n }\\n\\n\\n /**********************\\n * Contract Constants *\\n **********************/\\n\\n // TREE_RADIX determines the number of elements per branch node.\\n uint256 constant TREE_RADIX = 16;\\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\\n\\n // Prefixes are prepended to the `path` within a leaf or extension node and\\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\\n // determined by the number of nibbles within the unprefixed `path`. If the\\n // number of nibbles if even, we need to insert an extra padding nibble so\\n // the resulting prefixed `path` has an even number of nibbles.\\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\\n uint8 constant PREFIX_EXTENSION_ODD = 1;\\n uint8 constant PREFIX_LEAF_EVEN = 2;\\n uint8 constant PREFIX_LEAF_ODD = 3;\\n\\n // Just a utility constant. RLP represents `NULL` as 0x80.\\n bytes1 constant RLP_NULL = bytes1(0x80);\\n bytes constant RLP_NULL_BYTES = hex'80';\\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\\n\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n bytes memory value\\n ) = get(_key, _proof, _root);\\n\\n return (\\n exists && Lib_BytesUtils.equal(_value, value)\\n );\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n (\\n bool exists,\\n ) = get(_key, _proof, _root);\\n\\n return exists == false;\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n // Special case when inserting the very first node.\\n if (_root == KECCAK256_RLP_NULL_BYTES) {\\n return getSingleNodeRootHash(_key, _value);\\n }\\n\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\\n\\n return _getUpdatedTrieRoot(newPath, _key);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\\n\\n bool exists = keyRemainder.length == 0;\\n\\n require(\\n exists || isFinalNode,\\n \\\"Provided proof is invalid.\\\"\\n );\\n\\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\\n\\n return (\\n exists,\\n value\\n );\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n return keccak256(_makeLeafNode(\\n Lib_BytesUtils.toNibbles(_key),\\n _value\\n ).encoded);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * @notice Walks through a proof using a provided key.\\n * @param _proof Inclusion proof to walk through.\\n * @param _key Key to use for the walk.\\n * @param _root Known root of the trie.\\n * @return _pathLength Length of the final path\\n * @return _keyRemainder Portion of the key remaining after the walk.\\n * @return _isFinalNode Whether or not we've hit a dead end.\\n */\\n function _walkNodePath(\\n TrieNode[] memory _proof,\\n bytes memory _key,\\n bytes32 _root\\n )\\n private\\n pure\\n returns (\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bool _isFinalNode\\n )\\n {\\n uint256 pathLength = 0;\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n bytes32 currentNodeID = _root;\\n uint256 currentKeyIndex = 0;\\n uint256 currentKeyIncrement = 0;\\n TrieNode memory currentNode;\\n\\n // Proof is top-down, so we start at the first element (root).\\n for (uint256 i = 0; i < _proof.length; i++) {\\n currentNode = _proof[i];\\n currentKeyIndex += currentKeyIncrement;\\n\\n // Keep track of the proof elements we actually need.\\n // It's expensive to resize arrays, so this simply reduces gas costs.\\n pathLength += 1;\\n\\n if (currentKeyIndex == 0) {\\n // First proof element is always the root node.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid root hash\\\"\\n );\\n } else if (currentNode.encoded.length >= 32) {\\n // Nodes 32 bytes or larger are hashed inside branch nodes.\\n require(\\n keccak256(currentNode.encoded) == currentNodeID,\\n \\\"Invalid large internal hash\\\"\\n );\\n } else {\\n // Nodes smaller than 31 bytes aren't hashed.\\n require(\\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\\n \\\"Invalid internal node hash\\\"\\n );\\n }\\n\\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\\n if (currentKeyIndex == key.length) {\\n // We've hit the end of the key, meaning the value should be within this branch node.\\n break;\\n } else {\\n // We're not at the end of the key yet.\\n // Figure out what the next node ID should be and continue.\\n uint8 branchKey = uint8(key[currentKeyIndex]);\\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\\n currentNodeID = _getNodeID(nextNode);\\n currentKeyIncrement = 1;\\n continue;\\n }\\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(currentNode);\\n uint8 prefix = uint8(path[0]);\\n uint8 offset = 2 - prefix % 2;\\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n if (\\n pathRemainder.length == sharedNibbleLength &&\\n keyRemainder.length == sharedNibbleLength\\n ) {\\n // The key within this leaf matches our key exactly.\\n // Increment the key index to reflect that we have no remainder.\\n currentKeyIndex += sharedNibbleLength;\\n }\\n\\n // We've hit a leaf node, so our next node should be NULL.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n if (sharedNibbleLength == 0) {\\n // Our extension node doesn't share any part of our key.\\n // We've hit the end of this path, updates will need to modify this extension.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else {\\n // Our extension shares some nibbles.\\n // Carry on to the next node.\\n currentNodeID = _getNodeID(currentNode.decoded[1]);\\n currentKeyIncrement = sharedNibbleLength;\\n continue;\\n }\\n } else {\\n revert(\\\"Received a node with an unknown prefix\\\");\\n }\\n } else {\\n revert(\\\"Received an unparseable node.\\\");\\n }\\n }\\n\\n // If our node ID is NULL, then we're at a dead end.\\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\\n }\\n\\n /**\\n * @notice Creates new nodes to support a k/v pair insertion into a given\\n * Merkle trie path.\\n * @param _path Path to the node nearest the k/v pair.\\n * @param _pathLength Length of the path. Necessary because the provided\\n * path may include additional nodes (e.g., it comes directly from a proof)\\n * and we can't resize in-memory arrays without costly duplication.\\n * @param _keyRemainder Portion of the initial key that must be inserted\\n * into the trie.\\n * @param _value Value to insert at the given key.\\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\\n */\\n function _getNewPath(\\n TrieNode[] memory _path,\\n uint256 _pathLength,\\n bytes memory _keyRemainder,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _newPath\\n )\\n {\\n bytes memory keyRemainder = _keyRemainder;\\n\\n // Most of our logic depends on the status of the last node in the path.\\n TrieNode memory lastNode = _path[_pathLength - 1];\\n NodeType lastNodeType = _getNodeType(lastNode);\\n\\n // Create an array for newly created nodes.\\n // We need up to three new nodes, depending on the contents of the last node.\\n // Since array resizing is expensive, we'll keep track of the size manually.\\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\\n TrieNode[] memory newNodes = new TrieNode[](3);\\n uint256 totalNewNodes = 0;\\n\\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\\n // We've found a leaf node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\\n totalNewNodes += 1;\\n } else if (lastNodeType == NodeType.BranchNode) {\\n if (keyRemainder.length == 0) {\\n // We've found a branch node with the given key.\\n // Simply need to update the value of the node to match.\\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\\n totalNewNodes += 1;\\n } else {\\n // We've found a branch node, but it doesn't contain our key.\\n // Reinsert the old branch for now.\\n newNodes[totalNewNodes] = lastNode;\\n totalNewNodes += 1;\\n // Create a new leaf node, slicing our remainder since the first byte points\\n // to our branch node.\\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\\n totalNewNodes += 1;\\n }\\n } else {\\n // Our last node is either an extension node or a leaf node with a different key.\\n bytes memory lastNodeKey = _getNodeKey(lastNode);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\\n\\n if (sharedNibbleLength != 0) {\\n // We've got some shared nibbles between the last node and our key remainder.\\n // We'll need to insert an extension node that covers these shared nibbles.\\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\\n totalNewNodes += 1;\\n\\n // Cut down the keys since we've just covered these shared nibbles.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\\n }\\n\\n // Create an empty branch to fill in.\\n TrieNode memory newBranch = _makeEmptyBranchNode();\\n\\n if (lastNodeKey.length == 0) {\\n // Key remainder was larger than the key for our last node.\\n // The value within our last node is therefore going to be shifted into\\n // a branch value slot.\\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\\n } else {\\n // Last node key was larger than the key remainder.\\n // We're going to modify some index of our branch.\\n uint8 branchKey = uint8(lastNodeKey[0]);\\n // Move on to the next nibble.\\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\\n\\n if (lastNodeType == NodeType.LeafNode) {\\n // We're dealing with a leaf node.\\n // We'll modify the key and insert the old leaf node into the branch index.\\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else if (lastNodeKey.length != 0) {\\n // We're dealing with a shrinking extension node.\\n // We need to modify the node to decrease the size of the key.\\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\\n } else {\\n // We're dealing with an unnecessary extension node.\\n // We're going to delete the node entirely.\\n // Simply insert its current value into the branch index.\\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\\n }\\n }\\n\\n if (keyRemainder.length == 0) {\\n // We've got nothing left in the key remainder.\\n // Simply insert the value into the branch value slot.\\n newBranch = _editBranchValue(newBranch, _value);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n } else {\\n // We've got some key remainder to work with.\\n // We'll be inserting a leaf node into the trie.\\n // First, move on to the next nibble.\\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\\n // Push the branch into the list of new nodes.\\n newNodes[totalNewNodes] = newBranch;\\n totalNewNodes += 1;\\n // Push a new leaf node for our k/v pair.\\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\\n totalNewNodes += 1;\\n }\\n }\\n\\n // Finally, join the old path with our newly created nodes.\\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\\n }\\n\\n /**\\n * @notice Computes the trie root from a given path.\\n * @param _nodes Path to some k/v pair.\\n * @param _key Key for the k/v pair.\\n * @return _updatedRoot Root hash for the updated trie.\\n */\\n function _getUpdatedTrieRoot(\\n TrieNode[] memory _nodes,\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\\n\\n // Some variables to keep track of during iteration.\\n TrieNode memory currentNode;\\n NodeType currentNodeType;\\n bytes memory previousNodeHash;\\n\\n // Run through the path backwards to rebuild our root hash.\\n for (uint256 i = _nodes.length; i > 0; i--) {\\n // Pick out the current node.\\n currentNode = _nodes[i - 1];\\n currentNodeType = _getNodeType(currentNode);\\n\\n if (currentNodeType == NodeType.LeafNode) {\\n // Leaf nodes are already correctly encoded.\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n } else if (currentNodeType == NodeType.ExtensionNode) {\\n // Shift the key over to account for the nodes key.\\n bytes memory nodeKey = _getNodeKey(currentNode);\\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\\n\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\\n }\\n } else if (currentNodeType == NodeType.BranchNode) {\\n // If this node is the last element in the path, it'll be correctly encoded\\n // and we can skip this part.\\n if (previousNodeHash.length > 0) {\\n // Re-encode the node based on the previous node.\\n uint8 branchKey = uint8(key[key.length - 1]);\\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\\n }\\n }\\n\\n // Compute the node hash for the next iteration.\\n previousNodeHash = _getNodeHash(currentNode.encoded);\\n }\\n\\n // Current node should be the root at this point.\\n // Simply return the hash of its encoding.\\n return keccak256(currentNode.encoded);\\n }\\n\\n /**\\n * @notice Parses an RLP-encoded proof into something more useful.\\n * @param _proof RLP-encoded proof to parse.\\n * @return _parsed Proof parsed into easily accessible structs.\\n */\\n function _parseProof(\\n bytes memory _proof\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _parsed\\n )\\n {\\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\\n TrieNode[] memory proof = new TrieNode[](nodes.length);\\n\\n for (uint256 i = 0; i < nodes.length; i++) {\\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\\n proof[i] = TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n return proof;\\n }\\n\\n /**\\n * @notice Picks out the ID for a node. Node ID is referred to as the\\n * \\\"hash\\\" within the specification, but nodes < 32 bytes are not actually\\n * hashed.\\n * @param _node Node to pull an ID for.\\n * @return _nodeID ID for the node, depending on the size of its contents.\\n */\\n function _getNodeID(\\n Lib_RLPReader.RLPItem memory _node\\n )\\n private\\n pure\\n returns (\\n bytes32 _nodeID\\n )\\n {\\n bytes memory nodeID;\\n\\n if (_node.length < 32) {\\n // Nodes smaller than 32 bytes are RLP encoded.\\n nodeID = Lib_RLPReader.readRawBytes(_node);\\n } else {\\n // Nodes 32 bytes or larger are hashed.\\n nodeID = Lib_RLPReader.readBytes(_node);\\n }\\n\\n return Lib_BytesUtils.toBytes32(nodeID);\\n }\\n\\n /**\\n * @notice Gets the path for a leaf or extension node.\\n * @param _node Node to get a path for.\\n * @return _path Node path, converted to an array of nibbles.\\n */\\n function _getNodePath(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _path\\n )\\n {\\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\\n }\\n\\n /**\\n * @notice Gets the key for a leaf or extension node. Keys are essentially\\n * just paths without any prefix.\\n * @param _node Node to get a key for.\\n * @return _key Node key, converted to an array of nibbles.\\n */\\n function _getNodeKey(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _key\\n )\\n {\\n return _removeHexPrefix(_getNodePath(_node));\\n }\\n\\n /**\\n * @notice Gets the path for a node.\\n * @param _node Node to get a value for.\\n * @return _value Node value, as hex bytes.\\n */\\n function _getNodeValue(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n bytes memory _value\\n )\\n {\\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\\n }\\n\\n /**\\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\\n * are not hashed, all others are keccak256 hashed.\\n * @param _encoded Encoded node to hash.\\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\\n */\\n function _getNodeHash(\\n bytes memory _encoded\\n )\\n private\\n pure\\n returns (\\n bytes memory _hash\\n )\\n {\\n if (_encoded.length < 32) {\\n return _encoded;\\n } else {\\n return abi.encodePacked(keccak256(_encoded));\\n }\\n }\\n\\n /**\\n * @notice Determines the type for a given node.\\n * @param _node Node to determine a type for.\\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\\n */\\n function _getNodeType(\\n TrieNode memory _node\\n )\\n private\\n pure\\n returns (\\n NodeType _type\\n )\\n {\\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\\n return NodeType.BranchNode;\\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(_node);\\n uint8 prefix = uint8(path[0]);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n return NodeType.LeafNode;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n return NodeType.ExtensionNode;\\n }\\n }\\n\\n revert(\\\"Invalid node type\\\");\\n }\\n\\n /**\\n * @notice Utility; determines the number of nibbles shared between two\\n * nibble arrays.\\n * @param _a First nibble array.\\n * @param _b Second nibble array.\\n * @return _shared Number of shared nibbles.\\n */\\n function _getSharedNibbleLength(\\n bytes memory _a,\\n bytes memory _b\\n )\\n private\\n pure\\n returns (\\n uint256 _shared\\n )\\n {\\n uint256 i = 0;\\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\\n i++;\\n }\\n return i;\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-encoded node into our nice struct.\\n * @param _raw RLP-encoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n bytes[] memory _raw\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\\n\\n return TrieNode({\\n encoded: encoded,\\n decoded: Lib_RLPReader.readList(encoded)\\n });\\n }\\n\\n /**\\n * @notice Utility; converts an RLP-decoded node into our nice struct.\\n * @param _items RLP-decoded node to convert.\\n * @return _node Node as a TrieNode struct.\\n */\\n function _makeNode(\\n Lib_RLPReader.RLPItem[] memory _items\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](_items.length);\\n for (uint256 i = 0; i < _items.length; i++) {\\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new extension node.\\n * @param _key Key for the extension node, unprefixed.\\n * @param _value Value for the extension node.\\n * @return _node New extension node with the given k/v pair.\\n */\\n function _makeExtensionNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, false);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates a new leaf node.\\n * @dev This function is essentially identical to `_makeExtensionNode`.\\n * Although we could route both to a single method with a flag, it's\\n * more gas efficient to keep them separate and duplicate the logic.\\n * @param _key Key for the leaf node, unprefixed.\\n * @param _value Value for the leaf node.\\n * @return _node New leaf node with the given k/v pair.\\n */\\n function _makeLeafNode(\\n bytes memory _key,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](2);\\n bytes memory key = _addHexPrefix(_key, true);\\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\\n raw[1] = Lib_RLPWriter.writeBytes(_value);\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Creates an empty branch node.\\n * @return _node Empty branch node as a TrieNode struct.\\n */\\n function _makeEmptyBranchNode()\\n private\\n pure\\n returns (\\n TrieNode memory _node\\n )\\n {\\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\\n for (uint256 i = 0; i < raw.length; i++) {\\n raw[i] = RLP_NULL_BYTES;\\n }\\n return _makeNode(raw);\\n }\\n\\n /**\\n * @notice Modifies the value slot for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _value Value to insert into the branch.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchValue(\\n TrieNode memory _branch,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Modifies a slot at an index for a given branch.\\n * @param _branch Branch node to modify.\\n * @param _index Slot index to modify.\\n * @param _value Value to insert into the slot.\\n * @return _updatedNode Modified branch node.\\n */\\n function _editBranchIndex(\\n TrieNode memory _branch,\\n uint8 _index,\\n bytes memory _value\\n )\\n private\\n pure\\n returns (\\n TrieNode memory _updatedNode\\n )\\n {\\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\\n return _makeNode(_branch.decoded);\\n }\\n\\n /**\\n * @notice Utility; adds a prefix to a key.\\n * @param _key Key to prefix.\\n * @param _isLeaf Whether or not the key belongs to a leaf.\\n * @return _prefixedKey Prefixed key.\\n */\\n function _addHexPrefix(\\n bytes memory _key,\\n bool _isLeaf\\n )\\n private\\n pure\\n returns (\\n bytes memory _prefixedKey\\n )\\n {\\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\\n uint8 offset = uint8(_key.length % 2);\\n bytes memory prefixed = new bytes(2 - offset);\\n prefixed[0] = bytes1(prefix + offset);\\n return Lib_BytesUtils.concat(prefixed, _key);\\n }\\n\\n /**\\n * @notice Utility; removes a prefix from a path.\\n * @param _path Path to remove the prefix from.\\n * @return _unprefixedKey Unprefixed key.\\n */\\n function _removeHexPrefix(\\n bytes memory _path\\n )\\n private\\n pure\\n returns (\\n bytes memory _unprefixedKey\\n )\\n {\\n if (uint8(_path[0]) % 2 == 0) {\\n return Lib_BytesUtils.slice(_path, 2);\\n } else {\\n return Lib_BytesUtils.slice(_path, 1);\\n }\\n }\\n\\n /**\\n * @notice Utility; combines two node arrays. Array lengths are required\\n * because the actual lengths may be longer than the filled lengths.\\n * Array resizing is extremely costly and should be avoided.\\n * @param _a First array to join.\\n * @param _aLength Length of the first array.\\n * @param _b Second array to join.\\n * @param _bLength Length of the second array.\\n * @return _joined Combined node array.\\n */\\n function _joinNodeArrays(\\n TrieNode[] memory _a,\\n uint256 _aLength,\\n TrieNode[] memory _b,\\n uint256 _bLength\\n )\\n private\\n pure\\n returns (\\n TrieNode[] memory _joined\\n )\\n {\\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\\n\\n // Copy elements from the first array.\\n for (uint256 i = 0; i < _aLength; i++) {\\n ret[i] = _a[i];\\n }\\n\\n // Copy elements from the second array.\\n for (uint256 i = 0; i < _bLength; i++) {\\n ret[i + _aLength] = _b[i];\\n }\\n\\n return ret;\\n }\\n}\\n\",\"keccak256\":\"0x86fecc050ffc298ac364d118e65ce8ef2418749cbef1ad0d4dce2ca8a0d15ace\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_MerkleTrie } from \\\"./Lib_MerkleTrie.sol\\\";\\n\\n/**\\n * @title Lib_SecureMerkleTrie\\n */\\nlibrary Lib_SecureMerkleTrie {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * @notice Verifies a proof that a given key/value pair is present in the\\n * Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _value Value of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\\n * traditional Merkle trees, this proof is executed top-down and consists\\n * of a list of RLP-encoded nodes that make a path down to the target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\\n */\\n function verifyInclusionProof(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Verifies a proof that a given key is *not* present in\\n * the Merkle trie.\\n * @param _key Key of the node to search for, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\\n */\\n function verifyExclusionProof(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _verified\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\\n }\\n\\n /**\\n * @notice Updates a Merkle trie and returns a new root hash.\\n * @param _key Key of the node to update, as a hex string.\\n * @param _value Value of the node to update, as a hex string.\\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\\n * target node. If the key exists, we can simply update the value.\\n * Otherwise, we need to modify the trie to handle the new k/v pair.\\n * @param _root Known root of the Merkle trie. Used to verify that the\\n * included proof is correctly constructed.\\n * @return _updatedRoot Root hash of the newly constructed trie.\\n */\\n function update(\\n bytes memory _key,\\n bytes memory _value,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\\n }\\n\\n /**\\n * @notice Retrieves the value associated with a given key.\\n * @param _key Key to search for, as hex bytes.\\n * @param _proof Merkle trie inclusion proof for the key.\\n * @param _root Known root of the Merkle trie.\\n * @return _exists Whether or not the key exists.\\n * @return _value Value of the key if it exists.\\n */\\n function get(\\n bytes memory _key,\\n bytes memory _proof,\\n bytes32 _root\\n )\\n internal\\n pure\\n returns (\\n bool _exists,\\n bytes memory _value\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.get(key, _proof, _root);\\n }\\n\\n /**\\n * Computes the root hash for a trie with a single node.\\n * @param _key Key for the single node.\\n * @param _value Value for the single node.\\n * @return _updatedRoot Hash of the trie.\\n */\\n function getSingleNodeRootHash(\\n bytes memory _key,\\n bytes memory _value\\n )\\n internal\\n pure\\n returns (\\n bytes32 _updatedRoot\\n )\\n {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\\n }\\n\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Computes the secure counterpart to a key.\\n * @param _key Key to get a secure key from.\\n * @return _secureKey Secure version of the key.\\n */\\n function _getSecureKey(\\n bytes memory _key\\n )\\n private\\n pure\\n returns (\\n bytes memory _secureKey\\n )\\n {\\n return abi.encodePacked(keccak256(_key));\\n }\\n}\",\"keccak256\":\"0x79355346f74bb1eb9eeb733cb5d9677d50115c4f390307cbf608fe071a1ada0c\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function toBool(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bool _out\\n )\\n {\\n return _in != 0;\\n }\\n\\n function fromBool(\\n bool _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in ? 1 : 0));\\n }\\n\\n function toAddress(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n address _out\\n )\\n {\\n return address(uint160(uint256(_in)));\\n }\\n\\n function fromAddress(\\n address _in\\n )\\n internal\\n pure\\n returns (\\n bytes32 _out\\n )\\n {\\n return bytes32(uint256(_in));\\n }\\n\\n function removeLeadingZeros(\\n bytes32 _in\\n )\\n internal\\n pure\\n returns (\\n bytes memory _out\\n )\\n {\\n bytes memory out;\\n\\n assembly {\\n // Figure out how many leading zero bytes to remove.\\n let shift := 0\\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\\n shift := add(shift, 1)\\n }\\n\\n // Reserve some space for our output and fix the free memory pointer.\\n out := mload(0x40)\\n mstore(0x40, add(out, 0x40))\\n\\n // Shift the value and store it into the output bytes.\\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\\n\\n // Store the new size (with leading zero bytes removed) in the output byte size.\\n mstore(out, sub(32, shift))\\n }\\n\\n return out;\\n }\\n}\\n\",\"keccak256\":\"0x438bb0b8f4c188b29eb4c4b1b9473841d957f779eff36dbb0115b9f81bd4e815\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function concat(\\n bytes memory _preBytes,\\n bytes memory _postBytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(0x40, and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n ))\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n require(_length + 31 >= _length, \\\"slice_overflow\\\");\\n require(_start + _length >= _start, \\\"slice_overflow\\\");\\n require(_bytes.length >= _start + _length, \\\"slice_outOfBounds\\\");\\n\\n bytes memory tempBytes;\\n\\n assembly {\\n switch iszero(_length)\\n case 0 {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // The first word of the slice result is potentially a partial\\n // word read from the original array. To read it, we calculate\\n // the length of that partial word and start copying that many\\n // bytes into the array. The first word we copy will start with\\n // data we don't care about, but the last `lengthmod` bytes will\\n // land at the beginning of the contents of the new array. When\\n // we're done copying, we overwrite the full first word with\\n // the actual length of the slice.\\n let lengthmod := and(_length, 31)\\n\\n // The multiplication in the next line is necessary\\n // because when slicing multiples of 32 bytes (lengthmod == 0)\\n // the following copy loop was copying the origin's length\\n // and then ending prematurely not copying everything it should.\\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\\n let end := add(mc, _length)\\n\\n for {\\n // The multiplication in the next line has the same exact purpose\\n // as the one above.\\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n mstore(tempBytes, _length)\\n\\n //update free-memory pointer\\n //allocating the array padded to 32 bytes like the compiler does now\\n mstore(0x40, and(add(mc, 31), not(31)))\\n }\\n //if we want a zero-length slice let's just return a zero-length array\\n default {\\n tempBytes := mload(0x40)\\n\\n //zero out the 32 bytes slice we are about to return\\n //we need to do it because Solidity does not garbage collect\\n mstore(tempBytes, 0)\\n\\n mstore(0x40, add(tempBytes, 0x20))\\n }\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n if (_bytes.length - _start == 0) {\\n return bytes('');\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32PadLeft(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n bytes32 ret;\\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\\n assembly {\\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\\n }\\n return ret;\\n }\\n\\n function toBytes32(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes32)\\n {\\n if (_bytes.length < 32) {\\n bytes32 ret;\\n assembly {\\n ret := mload(add(_bytes, 32))\\n }\\n return ret;\\n }\\n\\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\\n }\\n\\n function toUint256(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\\n require(_start + 3 >= _start, \\\"toUint24_overflow\\\");\\n require(_bytes.length >= _start + 3 , \\\"toUint24_outOfBounds\\\");\\n uint24 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x3), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\\n require(_start + 1 >= _start, \\\"toUint8_overflow\\\");\\n require(_bytes.length >= _start + 1 , \\\"toUint8_outOfBounds\\\");\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\\n require(_start + 20 >= _start, \\\"toAddress_overflow\\\");\\n require(_bytes.length >= _start + 20, \\\"toAddress_outOfBounds\\\");\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\\n }\\n\\n return tempAddress;\\n }\\n\\n function toNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory nibbles = new bytes(_bytes.length * 2);\\n\\n for (uint256 i = 0; i < _bytes.length; i++) {\\n nibbles[i * 2] = _bytes[i] >> 4;\\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\\n }\\n\\n return nibbles;\\n }\\n\\n function fromNibbles(\\n bytes memory _bytes\\n )\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory ret = new bytes(_bytes.length / 2);\\n\\n for (uint256 i = 0; i < ret.length; i++) {\\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\\n }\\n\\n return ret;\\n }\\n\\n function equal(\\n bytes memory _bytes,\\n bytes memory _other\\n )\\n internal\\n pure\\n returns (bool)\\n {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0x2d3a590134be0a2ee41673dfe97f2ab9a00224f4f1603f9b1bb068c4fcee6014\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// @unsupported: ovm\\npragma solidity >0.5.0 <0.8.0;\\npragma experimental ABIEncoderV2;\\n\\n/* Library Imports */\\nimport { Lib_RLPWriter } from \\\"../rlp/Lib_RLPWriter.sol\\\";\\nimport { Lib_Bytes32Utils } from \\\"./Lib_Bytes32Utils.sol\\\";\\n\\n/**\\n * @title Lib_EthUtils\\n */\\nlibrary Lib_EthUtils {\\n\\n /***********************************\\n * Internal Functions: Code Access *\\n ***********************************/\\n\\n /**\\n * Gets the code for a given address.\\n * @param _address Address to get code for.\\n * @param _offset Offset to start reading from.\\n * @param _length Number of bytes to read.\\n * @return _code Code read from the contract.\\n */\\n function getCode(\\n address _address,\\n uint256 _offset,\\n uint256 _length\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n assembly {\\n _code := mload(0x40)\\n mstore(0x40, add(_code, add(_length, 0x20)))\\n mstore(_code, _length)\\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\\n }\\n\\n return _code;\\n }\\n\\n /**\\n * Gets the full code for a given address.\\n * @param _address Address to get code for.\\n * @return _code Full code of the contract.\\n */\\n function getCode(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes memory _code\\n )\\n {\\n return getCode(\\n _address,\\n 0,\\n getCodeSize(_address)\\n );\\n }\\n\\n /**\\n * Gets the size of a contract's code in bytes.\\n * @param _address Address to get code size for.\\n * @return _codeSize Size of the contract's code in bytes.\\n */\\n function getCodeSize(\\n address _address\\n )\\n internal\\n view\\n returns (\\n uint256 _codeSize\\n )\\n {\\n assembly {\\n _codeSize := extcodesize(_address)\\n }\\n\\n return _codeSize;\\n }\\n\\n /**\\n * Gets the hash of a contract's code.\\n * @param _address Address to get a code hash for.\\n * @return _codeHash Hash of the contract's code.\\n */\\n function getCodeHash(\\n address _address\\n )\\n internal\\n view\\n returns (\\n bytes32 _codeHash\\n )\\n {\\n assembly {\\n _codeHash := extcodehash(_address)\\n }\\n\\n return _codeHash;\\n }\\n\\n\\n /*****************************************\\n * Internal Functions: Contract Creation *\\n *****************************************/\\n\\n /**\\n * Creates a contract with some given initialization code.\\n * @param _code Contract initialization code.\\n * @return _created Address of the created contract.\\n */\\n function createContract(\\n bytes memory _code\\n )\\n internal\\n returns (\\n address _created\\n )\\n {\\n assembly {\\n _created := create(\\n 0,\\n add(_code, 0x20),\\n mload(_code)\\n )\\n }\\n\\n return _created;\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE.\\n * @param _creator Address creating the contract.\\n * @param _nonce Creator's nonce.\\n * @return _address Address to be generated by CREATE.\\n */\\n function getAddressForCREATE(\\n address _creator,\\n uint256 _nonce\\n )\\n internal\\n pure\\n returns (\\n address _address\\n )\\n {\\n bytes[] memory encoded = new bytes[](2);\\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\\n\\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\\n }\\n\\n /**\\n * Computes the address that would be generated by CREATE2.\\n * @param _creator Address creating the contract.\\n * @param _bytecode Bytecode of the contract to be created.\\n * @param _salt 32 byte salt value mixed into the hash.\\n * @return _address Address to be generated by CREATE2.\\n */\\n function getAddressForCREATE2(\\n address _creator,\\n bytes memory _bytecode,\\n bytes32 _salt\\n )\\n internal\\n pure\\n returns (address _address)\\n {\\n bytes32 hashedData = keccak256(abi.encodePacked(\\n byte(0xff),\\n _creator,\\n _salt,\\n keccak256(_bytecode)\\n ));\\n\\n return Lib_Bytes32Utils.toAddress(hashedData);\\n }\\n}\\n\",\"keccak256\":\"0x5fdf009da11f90cb5e99e5cd160d07bb744a5a2055774a646bdf277ad6910595\",\"license\":\"MIT\"},\"contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.8.0;\\n\\n/**\\n * @title Lib_SafeExecutionManagerWrapper\\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \\n * code using the standard solidity compiler, by routing all its operations through the Execution \\n * Manager.\\n * \\n * Compiler used: solc\\n * Runtime target: OVM\\n */\\nlibrary Lib_SafeExecutionManagerWrapper {\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Performs a safe ovmCALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeCALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmDELEGATECALL.\\n * @param _gasLimit Gas limit for the call.\\n * @param _target Address to call.\\n * @param _calldata Data to send to the call.\\n * @return _success Whether or not the call reverted.\\n * @return _returndata Data returned by the call.\\n */\\n function safeDELEGATECALL(\\n uint256 _gasLimit,\\n address _target,\\n bytes memory _calldata\\n )\\n internal\\n returns (\\n bool _success,\\n bytes memory _returndata\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmDELEGATECALL(uint256,address,bytes)\\\",\\n _gasLimit,\\n _target,\\n _calldata\\n )\\n );\\n\\n return abi.decode(returndata, (bool, bytes));\\n }\\n\\n /**\\n * Performs a safe ovmCREATE call.\\n * @param _gasLimit Gas limit for the creation.\\n * @param _bytecode Code for the new contract.\\n * @return _contract Address of the created contract.\\n */\\n function safeCREATE(\\n uint256 _gasLimit,\\n bytes memory _bytecode\\n )\\n internal\\n returns (\\n address _contract\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n _gasLimit,\\n abi.encodeWithSignature(\\n \\\"ovmCREATE(bytes)\\\",\\n _bytecode\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmEXTCODESIZE call.\\n * @param _contract Address of the contract to query the size of.\\n * @return _EXTCODESIZE Size of the requested contract in bytes.\\n */\\n function safeEXTCODESIZE(\\n address _contract\\n )\\n internal\\n returns (\\n uint256 _EXTCODESIZE\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmEXTCODESIZE(address)\\\",\\n _contract\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCHAINID call.\\n * @return _CHAINID Result of calling ovmCHAINID.\\n */\\n function safeCHAINID()\\n internal\\n returns (\\n uint256 _CHAINID\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCHAINID()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmCALLER call.\\n * @return _CALLER Result of calling ovmCALLER.\\n */\\n function safeCALLER()\\n internal\\n returns (\\n address _CALLER\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCALLER()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmADDRESS call.\\n * @return _ADDRESS Result of calling ovmADDRESS.\\n */\\n function safeADDRESS()\\n internal\\n returns (\\n address _ADDRESS\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmADDRESS()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (address));\\n }\\n\\n /**\\n * Performs a safe ovmGETNONCE call.\\n * @return _nonce Result of calling ovmGETNONCE.\\n */\\n function safeGETNONCE()\\n internal\\n returns (\\n uint256 _nonce\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmGETNONCE()\\\"\\n )\\n );\\n\\n return abi.decode(returndata, (uint256));\\n }\\n\\n /**\\n * Performs a safe ovmSETNONCE call.\\n * @param _nonce New account nonce.\\n */\\n function safeSETNONCE(\\n uint256 _nonce\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSETNONCE(uint256)\\\",\\n _nonce\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe ovmCREATEEOA call.\\n * @param _messageHash Message hash which was signed by EOA\\n * @param _v v value of signature (0 or 1)\\n * @param _r r value of signature\\n * @param _s s value of signature\\n */\\n function safeCREATEEOA(\\n bytes32 _messageHash,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\\\",\\n _messageHash,\\n _v,\\n _r,\\n _s\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe REVERT.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREVERT(\\n string memory _reason\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmREVERT(bytes)\\\",\\n bytes(_reason)\\n )\\n );\\n }\\n\\n /**\\n * Performs a safe \\\"require\\\".\\n * @param _condition Boolean condition that must be true or will revert.\\n * @param _reason String revert reason to pass along with the REVERT.\\n */\\n function safeREQUIRE(\\n bool _condition,\\n string memory _reason\\n )\\n internal\\n {\\n if (!_condition) {\\n safeREVERT(\\n _reason\\n );\\n }\\n }\\n\\n /**\\n * Performs a safe ovmSLOAD call.\\n */\\n function safeSLOAD(\\n bytes32 _key\\n )\\n internal\\n returns (\\n bytes32\\n )\\n {\\n bytes memory returndata = _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSLOAD(bytes32)\\\",\\n _key\\n )\\n );\\n\\n return abi.decode(returndata, (bytes32));\\n }\\n\\n /**\\n * Performs a safe ovmSSTORE call.\\n */\\n function safeSSTORE(\\n bytes32 _key,\\n bytes32 _value\\n )\\n internal\\n {\\n _safeExecutionManagerInteraction(\\n abi.encodeWithSignature(\\n \\\"ovmSSTORE(bytes32,bytes32)\\\",\\n _key,\\n _value\\n )\\n );\\n }\\n\\n /*********************\\n * Private Functions *\\n *********************/\\n\\n /**\\n * Performs an ovm interaction and the necessary safety checks.\\n * @param _gasLimit Gas limit for the interaction.\\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\\n * @return _returndata Data sent back by the OVM_ExecutionManager.\\n */\\n function _safeExecutionManagerInteraction(\\n uint256 _gasLimit,\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n address ovmExecutionManager = msg.sender;\\n (\\n bool success,\\n bytes memory returndata\\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\\n\\n if (success == false) {\\n assembly {\\n revert(add(returndata, 0x20), mload(returndata))\\n }\\n } else if (returndata.length == 1) {\\n assembly {\\n return(0, 1)\\n }\\n } else {\\n return returndata;\\n }\\n }\\n\\n function _safeExecutionManagerInteraction(\\n bytes memory _calldata\\n )\\n private\\n returns (\\n bytes memory _returndata\\n )\\n {\\n return _safeExecutionManagerInteraction(\\n gasleft(),\\n _calldata\\n );\\n }\\n}\\n\",\"keccak256\":\"0xaf87c3829bcb83f6385e9316f5b14f68f838c21946c480625bce6cf743440de2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516147cb3803806147cb8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055614766806100656000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806322d147021461003b578063461a44781461008f575b600080fd5b6100736004803603608081101561005157600080fd5b506001600160a01b038135169060208101359060408101359060600135610135565b604080516001600160a01b039092168252519081900360200190f35b610073600480360360208110156100a557600080fd5b8101906020810181356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610216945050505050565b60006101696040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610216565b6001600160a01b0316336001600160a01b0316146101b85760405162461bcd60e51b81526004018080602001828103825260318152602001806147006031913960400191505060405180910390fd5b848484846040516101c8906102f2565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561020c573d6000803e3d6000fd5b5095945050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561027657818101518382015260200161025e565b50505050905090810190601f1680156102a35780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d60208110156102ea57600080fd5b505192915050565b614400806103008339019056fe60806040523480156200001157600080fd5b506040516200440038038062004400833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61412a80620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a244316a11610071578063a244316a14610145578063b1c9fe6e1461014d578063b2fa1c9e14610162578063b528057114610177578063b91943101461017f578063c1c618b814610192576100b4565b80632e1ac36c146100b95780632eb13758146100ce578063461a4478146100e1578063732f960b1461010a578063805e9d301461011d578063845fe7a314610132575b600080fd5b6100cc6100c73660046137bd565b61019a565b005b6100cc6100dc3660046137fd565b610533565b6100f46100ef36600461387c565b61086f565b6040516101019190613ac9565b60405180910390f35b6100cc610118366004613940565b61094d565b610125610bb5565b6040516101019190613a51565b6100cc6101403660046137bd565b610bbb565b6100cc610ee7565b61015561106e565b6040516101019190613b7b565b61016a611077565b6040516101019190613b70565b6100f4611092565b6100cc61018d36600461375e565b6110a1565b6101256113bb565b60018060045460ff1660028111156101ae57fe5b146101d45760405162461bcd60e51b81526004016101cb90613ecc565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610210908a908a90600401613add565b602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610262919061384a565b15156001146102835760405162461bcd60e51b81526004016101cb90613c77565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102b4908b90600401613ac9565b60c06040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906138c1565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061033c908c908c90600401613add565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190613864565b90506103cd886040516020016103a29190613a51565b6040516020818303038152906040526103c26103bd846113c1565b61140a565b89856040015161145c565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610407908c908690600401613b17565b600060405180830381600087803b15801561042157600080fd5b505af1158015610435573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161046a929190613add565b60405180910390a1505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561054757fe5b146105645760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105bd57600080fd5b505afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190613864565b156106125760405162461bcd60e51b81526004016101cb90613d58565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610642908990600401613ac9565b602060405180830381600087803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610694919061384a565b15156001146106b55760405162461bcd60e51b81526004016101cb90613e12565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906106e6908a90600401613ac9565b60c06040518083038186803b1580156106fe57600080fd5b505afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073691906138c1565b90506107758760405160200161074c9190613a34565b60405160208183030381529060405261076c61076784611482565b6114c2565b8860035461145c565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107a8908990613ac9565b60405180910390a15060005a820390506107e86040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156108cf5781810151838201526020016108b7565b50505050905090810190601f1680156108fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561091957600080fd5b505afa15801561092d573d6000803e3d6000fd5b505050506040513d602081101561094357600080fd5b505190505b919050565b60008060045460ff16600281111561096157fe5b1461097e5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600654610995866115cb565b146109b25760405162461bcd60e51b81526004016101cb90613f1d565b6103e88560a0015161040802816109c557fe5b04620186a0015a10156109ea5760405162461bcd60e51b81526004016101cb90613db5565b6000610a216040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b81525061086f565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a52908490600401613ac9565b600060405180830381600087803b158015610a6c57600080fd5b505af1158015610a80573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ab7928b92911690600401613fb1565b600060405180830381600087803b158015610ad157600080fd5b505af1158015610ae5573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610b2f6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610bcf57fe5b14610bec5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610c28908a908a90600401613add565b60206040518083038186803b158015610c4057600080fd5b505afa158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c78919061384a565b15610c955760405162461bcd60e51b81526004016101cb90613b8f565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610cc5908a90600401613ac9565b60206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061384a565b1515600114610d365760405162461bcd60e51b81526004016101cb90613f54565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610d67908b90600401613ac9565b60206040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190613864565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610deb57506000610e48565b600080610e188a604051602001610e029190613a51565b6040516020818303038152906040528a866115e4565b909250905060018215151415610e4057610e39610e348261160d565b611620565b9250610e45565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610e7c908c908c908690600401613af6565b600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60018060045460ff166002811115610efb57fe5b14610f185760405162461bcd60e51b81526004016101cb90613ecc565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6657600080fd5b505afa158015610f7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9e9190613864565b15610fbb5760405162461bcd60e51b81526004016101cb90613c1a565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b15801561100957600080fd5b505afa15801561101d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110419190613864565b1561105e5760405162461bcd60e51b81526004016101cb90613e6f565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561108c57fe5b14905090565b6001546001600160a01b031681565b60008060045460ff1660028111156110b557fe5b146110d25760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf9061110c908a90600401613ac9565b60206040518083038186803b15801561112457600080fd5b505afa158015611138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115c919061384a565b1580156111e657506001546040516307a1294560e01b81526001600160a01b03909116906307a1294590611194908a90600401613ac9565b60206040518083038186803b1580156111ac57600080fd5b505afa1580156111c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e4919061384a565b155b6112025760405162461bcd60e51b81526004016101cb90613bd4565b600080611231896040516020016112199190613a34565b604051602081830303815290604052886002546115e4565b90925090506001821515141561135257600061124c8261164f565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701415611285575060006112b0565b8160600151611293826116e1565b146112b05760405162461bcd60e51b81526004016101cb90613cd5565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b964791611319918f91600401613b17565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505050611382565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610e7c908c90600401613ac9565b505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60035490565b6060806000805b6020811085821a1516156113e257600191820191016113c8565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b60608082516001148015611432575060808360008151811061142857fe5b016020015160f81c105b1561143e575081611456565b61145361144d845160806116e5565b84611835565b90505b92915050565b600080611468866118b2565b9050611476818686866118e2565b9150505b949350505050565b61148a613669565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816114de5750508351909150611504906103bd906113c1565b8160008151811061151157fe5b602002602001018190525061152f6103bd846020015160001b6113c1565b8160018151811061153c57fe5b6020026020010181905250611573836040015160405160200161155f9190613a51565b60405160208183030381529060405261140a565b8160028151811061158057fe5b60200260200101819052506115a3836060015160405160200161155f9190613a51565b816003815181106115b057fe5b60200260200101819052506115c48161197d565b9392505050565b60006115d6826119a1565b805190602001209050919050565b6000606060006115f3866118b2565b90506116008186866119dc565b9250925050935093915050565b606061145661161b83611aaf565b611ad4565b6000806000602084511115611636576020611639565b83515b6020858101519190036008021c92505050919050565b611657613669565b600061166283611b63565b9050604051806080016040528061168c8360008151811061167f57fe5b6020026020010151611b76565b81526020016116a18360018151811061167f57fe5b81526020016116c3836002815181106116b657fe5b6020026020010151611b7d565b81526020016116d8836003815181106116b657fe5b90529392505050565b3f90565b606080603884101561173f576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061172357fe5b60200101906001600160f81b031916908160001a905350611453565b600060015b80868161174d57fe5b04156117625760019091019061010002611744565b816001016001600160401b038111801561177b57600080fd5b506040519080825280601f01601f1916602001820160405280156117a6576020820181803683370190505b50925084820160370160f81b836000815181106117bf57fe5b60200101906001600160f81b031916908160001a905350600190505b81811161182b576101008183036101000a87816117f457fe5b04816117fc57fe5b0660f81b83828151811061180c57fe5b60200101906001600160f81b031916908160001a9053506001016117db565b5050905092915050565b6060806040519050835180825260208201818101602087015b8183101561186657805183526020928301920161184e565b50855184518101855292509050808201602086015b8183101561189357805183526020928301920161187b565b508651929092011591909101601f01601f191660405250905092915050565b606081805190602001206040516020016118cc9190613a51565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218214156119365761192f8585611c77565b905061147a565b600061194184611c9b565b9050600080611951838987611d71565b509150915060006119648484848b612114565b9050611970818a61242c565b9998505050505050505050565b6060600061198a83612585565b90506115c461199b825160c06116e5565b82611835565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016118cc9796959493929190613a5a565b6000606060006119eb85611c9b565b905060008060006119fd848a89611d71565b81519295509093509150158080611a115750815b611a62576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611a7e5760405180602001604052806000815250611a9d565b611a9d866001870381518110611a9057fe5b602002602001015161268e565b919b919a509098505050505050505050565b611ab7613690565b506040805180820190915281518152602082810190820152919050565b60606000806000611ae4856126aa565b919450925090506000816001811115611af957fe5b14611b4b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611b5a856020015184846129d3565b95945050505050565b6060611456611b7183611aaf565b612a80565b6000611456825b6000602182600001511115611bd9576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611be7856126aa565b919450925090506000816001811115611bfc57fe5b14611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611c6d5760208490036101000a90045b9695505050505050565b6000611c8b611c8584612bf6565b83612cf2565b5180516020909101209392505050565b60606000611ca883611b63565b9050600081516001600160401b0381118015611cc357600080fd5b50604051908082528060200260200182016040528015611cfd57816020015b611cea6136aa565b815260200190600190039081611ce25790505b50905060005b8251811015611d69576000611d2a848381518110611d1d57fe5b6020026020010151611ad4565b90506040518060400160405280828152602001611d4683611b63565b815250838381518110611d5557fe5b602090810291909101015250600101611d03565b509392505050565b60006060818080611d8187612bf6565b905085600080611d8f6136aa565b60005b8c518110156120ec578c8181518110611da757fe5b6020026020010151915082840193506001870196508360001415611e1b57815180516020909101208514611e16576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611ee2565b815151602011611e8257815180516020909101208514611e16576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611e908360000151612d86565b14611ee2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611f51578551841415611efe576120ec565b6000868581518110611f0c57fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611f3157fe5b60200260200101519050611f4481612db2565b96506001945050506120e4565b60028260200151511415612097576000611f6a83612de8565b9050600081600081518110611f7b57fe5b016020015160f81c9050600181166002036000611f9b8460ff8416612e06565b90506000611fa98b8a612e06565b90506000611fb78383612e37565b905060ff851660021480611fce575060ff85166003145b1561200057808351148015611fe35750808251145b15611fed57988901985b50600160ff1b99506120ec945050505050565b60ff85161580612013575060ff85166001145b1561206057806120305750600160ff1b99506120ec945050505050565b612051886020015160018151811061204457fe5b6020026020010151612db2565b9a5097506120e4945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806140cf6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611d92565b50600160ff1b8414866120ff8786612e06565b909e909d50909b509950505050505050505050565b60606000839050600086600187038151811061212c57fe5b60200260200101519050600061214182612e9d565b6040805160038082526080820190925291925060009190816020015b6121656136aa565b81526020019060019003908161215d5790505090506000845160001480156121985750600283600281111561219657fe5b145b156121ce576121af6121a985612f73565b88612cf2565b8282815181106121bb57fe5b602090810291909101015260010161240f565b60008360028111156121dc57fe5b1415612242578451612211576121f28488612f86565b8282815181106121fe57fe5b602090810291909101015260010161223d565b8382828151811061221e57fe5b60200260200101819052506001810190506121af6121a9866001612e06565b61240f565b600061224d85612f73565b9050600061225b8288612e37565b905080156122bc57600061227183600084612fd1565b9050612285816122808c613121565b613162565b85858151811061229157fe5b60200260200101819052506001840193506122ac8383612e06565b92506122b88883612e06565b9750505b60006122c66131a6565b90508251600014156122eb576122e4816122df8961268e565b612f86565b9050612383565b6000836000815181106122fa57fe5b016020015160f81c905061230f846001612e06565b9350600287600281111561231f57fe5b141561235a576000612339856123348b61268e565b612cf2565b9050612352838361234d8460000151613121565b613233565b925050612381565b835115612370576000612339856122808b61268e565b61237e828261234d8b61268e565b91505b505b87516123b857612393818b612f86565b9050808585815181106123a257fe5b602002602001018190525060018401935061240b565b6123c3886001612e06565b9750808585815181106123d257fe5b60200260200101819052506001840193506123ed888b612cf2565b8585815181106123f957fe5b60200260200101819052506001840193505b5050505b61241e8a60018b03848461328c565b9a9950505050505050505050565b60008061243883612bf6565b90506124426136aa565b84516000906060905b80156125705787600182038151811061246057fe5b6020026020010151935061247384612e9d565b9250600283600281111561248357fe5b14156124ae57600061249485612f73565b90506124a68660008351895103612fd1565b95505061255a565b60018360028111156124bc57fe5b14156124fc5760006124cd85612f73565b90506124df8660008351895103612fd1565b8351909650156124f6576124f38184613162565b94505b5061255a565b600083600281111561250a57fe5b141561255a5781511561255a5760008560018751038151811061252957fe5b602001015160f81c60f81b60f81c90506125498660006001895103612fd1565b9550612556858285613233565b9450505b835161256590613121565b91506000190161244b565b50509051805160209091012095945050505050565b60608151600014156125a65750604080516000815260208101909152610948565b6000805b83518110156125d9578381815181106125bf57fe5b6020026020010151518201915080806001019150506125aa565b6000826001600160401b03811180156125f157600080fd5b506040519080825280601f01601f19166020018201604052801561261c576020820181803683370190505b50600092509050602081015b855183101561268557600086848151811061263f57fe5b60200260200101519050600060208201905061265d8382845161336e565b87858151811061266957fe5b6020026020010151518301925050508280600101935050612628565b50949350505050565b60208101518051606091611456916000198101908110611d1d57fe5b600080600080846000015111612707576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161272c5760006001600094509450945050506129cc565b60b781116127a1578551607f19820190811061278f576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506129cc915050565b60bf811161288557855160b6198201908110612804576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612870576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506129cc915050565b60f781116128f957855160bf1982019081106128e8576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506129cc915050565b855160f6198201908110612954576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129b9576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506129cc915050565b9193909250565b60606000826001600160401b03811180156129ed57600080fd5b506040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b509050805160001415612a2c5790506115c4565b8484016020820160005b60208604811015612a57578251825260209283019290910190600101612a36565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612a8e846126aa565b91935090915060019050816001811115612aa457fe5b14612af6576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b17613690565b815260200190600190039081612b0f5790505090506000835b8651811015612beb5760208210612b785760405162461bcd60e51b815260040180806020018281038252602a8152602001806140a5602a913960400191505060405180910390fd5b600080612ba46040518060400160405280858c60000151038152602001858c60200151018152506126aa565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612bd257fe5b6020908102919091010152600193909301920101612b30565b508152949350505050565b6060600082516002026001600160401b0381118015612c1457600080fd5b506040519080825280601f01601f191660200182016040528015612c3f576020820181803683370190505b50905060005b8351811015612ceb576004848281518110612c5c57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612c8257fe5b60200101906001600160f81b031916908160001a9053506010848281518110612ca757fe5b016020015160f81c81612cb657fe5b0660f81b828260020260010181518110612ccc57fe5b60200101906001600160f81b031916908160001a905350600101612c45565b5092915050565b612cfa6136aa565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d125790505090506000612d368560016133b2565b9050612d446103bd82613457565b82600081518110612d5157fe5b6020026020010181905250612d658461140a565b82600181518110612d7257fe5b6020026020010181905250611b5a82613527565b6000602082511015612d9d57506020810151610948565b81806020019051602081101561094357600080fd5b60006060602083600001511015612dd357612dcc83613556565b9050612ddf565b612ddc83611ad4565b90505b6115c481612d86565b6060611456612e018360200151600081518110611d1d57fe5b612bf6565b60608183510360001415612e295750604080516020810190915260008152611456565b611453838384865103612fd1565b6000805b808451118015612e4b5750808351115b8015612e905750828181518110612e5e57fe5b602001015160f81c60f81b6001600160f81b031916848281518110612e7f57fe5b01602001516001600160f81b031916145b1561145357600101612e3b565b60208101515160009060111415612eb657506000610948565b60028260200151511415612f32576000612ecf83612de8565b9050600081600081518110612ee057fe5b016020015160f81c90506002811480612efc575060ff81166003145b15612f0c57600292505050610948565b60ff81161580612f1f575060ff81166001145b15612f2f57600192505050610948565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611456612f8183612de8565b613561565b612f8e6136aa565b6000612f998361140a565b9050612fa481611aaf565b602085015180516000198101908110612fb957fe5b602002602001018190525061147a84602001516135aa565b60608182601f01101561301c576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015613064576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156130b0576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156130cf5760405191506000825260208201604052612685565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156131085780518352602092830192016130f0565b5050858452601f01601f19166040525050949350505050565b6060602082511015613134575080610948565b8180519060200120604051602001808281526020019150506040516020818303038152906040529050610948565b61316a6136aa565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131825790505090506000612d368560006133b2565b6131ae6136aa565b6040805160118082526102408201909252600091816020015b60608152602001906001900390816131c757905050905060005b815181101561322357604051806040016040528060018152602001600160ff1b81525082828151811061321057fe5b60209081029190910101526001016131e1565b5061322d81613527565b91505090565b61323b6136aa565b600060208351106132545761324f8361140a565b613256565b825b905061326181611aaf565b85602001518560ff168151811061327457fe5b6020026020010181905250611b5a85602001516135aa565b606060008285016001600160401b03811180156132a857600080fd5b506040519080825280602002602001820160405280156132e257816020015b6132cf6136aa565b8152602001906001900390816132c75790505b50905060005b85811015613323578681815181106132fc57fe5b602002602001015182828151811061331057fe5b60209081029190910101526001016132e8565b5060005b838110156133645784818151811061333b57fe5b6020026020010151828783018151811061335157fe5b6020908102919091010152600101613327565b5095945050505050565b8282825b60208110613391578151835260209283019290910190601f1901613372565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826133c25760006133c5565b60025b9050600060028551816133d457fe5b06905060008160020360ff166001600160401b03811180156133f557600080fd5b506040519080825280601f01601f191660200182016040528015613420576020820181803683370190505b50905081830160f81b8160008151811061343657fe5b60200101906001600160f81b031916908160001a905350611c6d8187611835565b60606000600283518161346657fe5b046001600160401b038111801561347c57600080fd5b506040519080825280601f01601f1916602001820160405280156134a7576020820181803683370190505b50905060005b8151811015612ceb578381600202600101815181106134c857fe5b602001015160f81c60f81b60048583600202815181106134e457fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061350857fe5b60200101906001600160f81b031916908160001a9053506001016134ad565b61352f6136aa565b600061353a8361197d565b905060405180604001604052808281526020016116d883611b63565b606061145682613653565b606060028260008151811061357257fe5b016020015160f81c8161358157fe5b0660ff166000141561359f57613598826002612e06565b9050610948565b613598826001612e06565b6135b26136aa565b600082516001600160401b03811180156135cb57600080fd5b506040519080825280602002602001820160405280156135ff57816020015b60608152602001906001900390816135ea5790505b50905060005b83518110156136495761362a84828151811061361d57fe5b6020026020010151613556565b82828151811061363657fe5b6020908102919091010152600101613605565b506115c481613527565b60606114568260200151600084600001516129d3565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006001600160401b038311156136d757fe5b6136ea601f8401601f1916602001614039565b90508281528383830111156136fe57600080fd5b828260208301376000602084830101529392505050565b80356109488161408c565b8051801515811461094857600080fd5b600082601f830112613740578081fd5b611453838335602085016136c4565b80356002811061094857600080fd5b600080600060608486031215613772578283fd5b833561377d8161408c565b9250602084013561378d8161408c565b915060408401356001600160401b038111156137a7578182fd5b6137b386828701613730565b9150509250925092565b6000806000606084860312156137d1578283fd5b83356137dc8161408c565b92506020840135915060408401356001600160401b038111156137a7578182fd5b6000806040838503121561380f578182fd5b823561381a8161408c565b915060208301356001600160401b03811115613834578182fd5b61384085828601613730565b9150509250929050565b60006020828403121561385b578081fd5b61145382613720565b600060208284031215613875578081fd5b5051919050565b60006020828403121561388d578081fd5b81356001600160401b038111156138a2578182fd5b8201601f810184136138b2578182fd5b61147a848235602084016136c4565b600060c082840312156138d2578081fd5b60405160c081018181106001600160401b03821117156138ee57fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516139238161408c565b608082015261393460a08401613720565b60a08201529392505050565b600060208284031215613951578081fd5b81356001600160401b0380821115613967578283fd5b9083019060e0828603121561397a578283fd5b61398460e0614039565b823581526020830135602082015261399e6040840161374f565b60408201526139af60608401613715565b60608201526139c060808401613715565b608082015260a083013560a082015260c0830135828111156139e0578485fd5b6139ec87828601613730565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613a2081602086016020860161405c565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b600088825287602083015260028710613a6f57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613ab681608985016020870161405c565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613b8957fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b6000604082528351604083015260208401516060830152604084015160028110613fd757fe5b60808381019190915260608501516001600160a01b031660a084015284015161400360c08401826139fb565b5060a084015160e083015260c084015160e0610100840152614029610120840182613a08565b9150506115c460208301846139fb565b6040518181016001600160401b038111828210171561405457fe5b604052919050565b60005b8381101561407757818101518382015260200161405f565b83811115614086576000848401525b50505050565b6001600160a01b03811681146140a157600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220585b3731ad3984ef3b77187738a1026bd3e69375837d244bb63400abe835349664736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212206be2efd743bb636f4d53c9776948c26451e831f9d5ad5bab4cd233ff773bfc0b64736f6c63430007060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806322d147021461003b578063461a44781461008f575b600080fd5b6100736004803603608081101561005157600080fd5b506001600160a01b038135169060208101359060408101359060600135610135565b604080516001600160a01b039092168252519081900360200190f35b610073600480360360208110156100a557600080fd5b8101906020810181356401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610216945050505050565b60006101696040518060400160405280601181526020017027ab26afa33930bab22b32b934b334b2b960791b815250610216565b6001600160a01b0316336001600160a01b0316146101b85760405162461bcd60e51b81526004018080602001828103825260318152602001806147006031913960400191505060405180910390fd5b848484846040516101c8906102f2565b80856001600160a01b03168152602001848152602001838152602001828152602001945050505050604051809103906000f08015801561020c573d6000803e3d6000fd5b5095945050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b8381101561027657818101518382015260200161025e565b50505050905090810190601f1680156102a35780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b1580156102c057600080fd5b505afa1580156102d4573d6000803e3d6000fd5b505050506040513d60208110156102ea57600080fd5b505192915050565b614400806103008339019056fe60806040523480156200001157600080fd5b506040516200440038038062004400833981016040819052620000349162000232565b600080546001600160a01b0319166001600160a01b038616179055600583905560028290556003829055600681905560408051808201909152601781527f4f564d5f53746174654d616e61676572466163746f72790000000000000000006020820152620000a29062000150565b6001600160a01b0316639ed93318306040518263ffffffff1660e01b8152600401620000cf919062000299565b602060405180830381600087803b158015620000ea57600080fd5b505af1158015620000ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000125919062000273565b600180546001600160a01b0319166001600160a01b039290921691909117905550620002c692505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b83811015620001b257818101518382015260200162000198565b50505050905090810190601f168015620001e05780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b158015620001fe57600080fd5b505afa15801562000213573d6000803e3d6000fd5b505050506040513d60208110156200022a57600080fd5b505192915050565b6000806000806080858703121562000248578384fd5b84516200025581620002ad565b60208601516040870151606090970151919890975090945092505050565b60006020828403121562000285578081fd5b81516200029281620002ad565b9392505050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114620002c357600080fd5b50565b61412a80620002d66000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a244316a11610071578063a244316a14610145578063b1c9fe6e1461014d578063b2fa1c9e14610162578063b528057114610177578063b91943101461017f578063c1c618b814610192576100b4565b80632e1ac36c146100b95780632eb13758146100ce578063461a4478146100e1578063732f960b1461010a578063805e9d301461011d578063845fe7a314610132575b600080fd5b6100cc6100c73660046137bd565b61019a565b005b6100cc6100dc3660046137fd565b610533565b6100f46100ef36600461387c565b61086f565b6040516101019190613ac9565b60405180910390f35b6100cc610118366004613940565b61094d565b610125610bb5565b6040516101019190613a51565b6100cc6101403660046137bd565b610bbb565b6100cc610ee7565b61015561106e565b6040516101019190613b7b565b61016a611077565b6040516101019190613b70565b6100f4611092565b6100cc61018d36600461375e565b6110a1565b6101256113bb565b60018060045460ff1660028111156101ae57fe5b146101d45760405162461bcd60e51b81526004016101cb90613ecc565b60405180910390fd5b60025460065460005a6001546040516363b285f960e11b81529192506001600160a01b03169063c7650bf290610210908a908a90600401613add565b602060405180830381600087803b15801561022a57600080fd5b505af115801561023e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610262919061384a565b15156001146102835760405162461bcd60e51b81526004016101cb90613c77565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906102b4908b90600401613ac9565b60c06040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906138c1565b600154604051631aaf392f60e01b81529192506000916001600160a01b0390911690631aaf392f9061033c908c908c90600401613add565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c9190613864565b90506103cd886040516020016103a29190613a51565b6040516020818303038152906040526103c26103bd846113c1565b61140a565b89856040015161145c565b6040808401919091526001549051638f3b964760e01b81526001600160a01b0390911690638f3b964790610407908c908690600401613b17565b600060405180830381600087803b15801561042157600080fd5b505af1158015610435573d6000803e3d6000fd5b505050507f3e3ed1a676a2754a041b49bf752e0f167c8753495e36c320fe01d1ef7476253c898960405161046a929190613add565b60405180910390a1505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561051157600080fd5b505af1158015610525573d6000803e3d6000fd5b505050505050505050505050565b60018060045460ff16600281111561054757fe5b146105645760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156105bd57600080fd5b505afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190613864565b156106125760405162461bcd60e51b81526004016101cb90613d58565b600154604051630b38106960e11b81526001600160a01b039091169063167020d290610642908990600401613ac9565b602060405180830381600087803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610694919061384a565b15156001146106b55760405162461bcd60e51b81526004016101cb90613e12565b60015460405163fbcbc0f160e01b81526000916001600160a01b03169063fbcbc0f1906106e6908a90600401613ac9565b60c06040518083038186803b1580156106fe57600080fd5b505afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073691906138c1565b90506107758760405160200161074c9190613a34565b60405160208183030381529060405261076c61076784611482565b6114c2565b8860035461145c565b6003556040517fcec9ef675d775706a02b43afe48af52c5019bc50f99582e3208c6ff55d59c008906107a8908990613ac9565b60405180910390a15060005a820390506107e86040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b5050505050505050505050565b6000805460405163bf40fac160e01b81526020600482018181528551602484015285516001600160a01b039094169363bf40fac19387938392604490920191908501908083838b5b838110156108cf5781810151838201526020016108b7565b50505050905090810190601f1680156108fc5780820380516001836020036101000a031916815260200191505b509250505060206040518083038186803b15801561091957600080fd5b505afa15801561092d573d6000803e3d6000fd5b505050506040513d602081101561094357600080fd5b505190505b919050565b60008060045460ff16600281111561096157fe5b1461097e5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a9050600654610995866115cb565b146109b25760405162461bcd60e51b81526004016101cb90613f1d565b6103e88560a0015161040802816109c557fe5b04620186a0015a10156109ea5760405162461bcd60e51b81526004016101cb90613db5565b6000610a216040518060400160405280601481526020017327ab26afa2bc32b1baba34b7b726b0b730b3b2b960611b81525061086f565b600154604051631381ba4d60e01b81529192506001600160a01b031690631381ba4d90610a52908490600401613ac9565b600060405180830381600087803b158015610a6c57600080fd5b505af1158015610a80573d6000803e3d6000fd5b5050600154604051639be3ad6760e01b81526001600160a01b038086169450639be3ad679350610ab7928b92911690600401613fb1565b600060405180830381600087803b158015610ad157600080fd5b505af1158015610ae5573d6000803e3d6000fd5b50506004805460ff191660011790555060009150505a82039050610b2f6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b6001600160a01b0316631e16e92f858533856040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b50505050505050505050565b60025490565b60008060045460ff166002811115610bcf57fe5b14610bec5760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a600154604051630ad2267960e01b81529192506001600160a01b031690630ad2267990610c28908a908a90600401613add565b60206040518083038186803b158015610c4057600080fd5b505afa158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c78919061384a565b15610c955760405162461bcd60e51b81526004016101cb90613b8f565b60015460405163c8e40fbf60e01b81526001600160a01b039091169063c8e40fbf90610cc5908a90600401613ac9565b60206040518083038186803b158015610cdd57600080fd5b505afa158015610cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d15919061384a565b1515600114610d365760405162461bcd60e51b81526004016101cb90613f54565b60015460405163136e2d8960e11b81526000916001600160a01b0316906326dc5b1290610d67908b90600401613ac9565b60206040518083038186803b158015610d7f57600080fd5b505afa158015610d93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db79190613864565b905060007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421821415610deb57506000610e48565b600080610e188a604051602001610e029190613a51565b6040516020818303038152906040528a866115e4565b909250905060018215151415610e4057610e39610e348261160d565b611620565b9250610e45565b600092505b50505b600154604051635c17d62960e01b81526001600160a01b0390911690635c17d62990610e7c908c908c908690600401613af6565b600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60018060045460ff166002811115610efb57fe5b14610f185760405162461bcd60e51b81526004016101cb90613ecc565b600160009054906101000a90046001600160a01b03166001600160a01b031663d7bd4a2a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6657600080fd5b505afa158015610f7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9e9190613864565b15610fbb5760405162461bcd60e51b81526004016101cb90613c1a565b600160009054906101000a90046001600160a01b03166001600160a01b03166399056ba96040518163ffffffff1660e01b815260040160206040518083038186803b15801561100957600080fd5b505afa15801561101d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110419190613864565b1561105e5760405162461bcd60e51b81526004016101cb90613e6f565b506004805460ff19166002179055565b60045460ff1681565b6000600260045460ff16600281111561108c57fe5b14905090565b6001546001600160a01b031681565b60008060045460ff1660028111156110b557fe5b146110d25760405162461bcd60e51b81526004016101cb90613ecc565b60025460065460005a60015460405163c8e40fbf60e01b81529192506001600160a01b03169063c8e40fbf9061110c908a90600401613ac9565b60206040518083038186803b15801561112457600080fd5b505afa158015611138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115c919061384a565b1580156111e657506001546040516307a1294560e01b81526001600160a01b03909116906307a1294590611194908a90600401613ac9565b60206040518083038186803b1580156111ac57600080fd5b505afa1580156111c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e4919061384a565b155b6112025760405162461bcd60e51b81526004016101cb90613bd4565b600080611231896040516020016112199190613a34565b604051602081830303815290604052886002546115e4565b90925090506001821515141561135257600061124c8261164f565b606081015190915089907fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4701415611285575060006112b0565b8160600151611293826116e1565b146112b05760405162461bcd60e51b81526004016101cb90613cd5565b6001546040805160c08101825284518152602080860151908201528482015181830152606080860151908201526001600160a01b038481166080830152600060a08301529151638f3b964760e01b81529190921691638f3b964791611319918f91600401613b17565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505050611382565b600154604051630d631c9d60e31b81526001600160a01b0390911690636b18e4e890610e7c908c90600401613ac9565b505060005a820390506104ab6040518060400160405280600f81526020016e27ab26afa137b73226b0b730b3b2b960891b81525061086f565b60035490565b6060806000805b6020811085821a1516156113e257600191820191016113c8565b5060405191506040820160405283600882021b60208301528060200382525080915050919050565b60608082516001148015611432575060808360008151811061142857fe5b016020015160f81c105b1561143e575081611456565b61145361144d845160806116e5565b84611835565b90505b92915050565b600080611468866118b2565b9050611476818686866118e2565b9150505b949350505050565b61148a613669565b604051806080016040528083600001518152602001836020015181526020018360400151815260200183606001518152509050919050565b60408051600480825260a0820190925260609160009190816020015b60608152602001906001900390816114de5750508351909150611504906103bd906113c1565b8160008151811061151157fe5b602002602001018190525061152f6103bd846020015160001b6113c1565b8160018151811061153c57fe5b6020026020010181905250611573836040015160405160200161155f9190613a51565b60405160208183030381529060405261140a565b8160028151811061158057fe5b60200260200101819052506115a3836060015160405160200161155f9190613a51565b816003815181106115b057fe5b60200260200101819052506115c48161197d565b9392505050565b60006115d6826119a1565b805190602001209050919050565b6000606060006115f3866118b2565b90506116008186866119dc565b9250925050935093915050565b606061145661161b83611aaf565b611ad4565b6000806000602084511115611636576020611639565b83515b6020858101519190036008021c92505050919050565b611657613669565b600061166283611b63565b9050604051806080016040528061168c8360008151811061167f57fe5b6020026020010151611b76565b81526020016116a18360018151811061167f57fe5b81526020016116c3836002815181106116b657fe5b6020026020010151611b7d565b81526020016116d8836003815181106116b657fe5b90529392505050565b3f90565b606080603884101561173f576040805160018082528183019092529060208201818036833701905050905082840160f81b8160008151811061172357fe5b60200101906001600160f81b031916908160001a905350611453565b600060015b80868161174d57fe5b04156117625760019091019061010002611744565b816001016001600160401b038111801561177b57600080fd5b506040519080825280601f01601f1916602001820160405280156117a6576020820181803683370190505b50925084820160370160f81b836000815181106117bf57fe5b60200101906001600160f81b031916908160001a905350600190505b81811161182b576101008183036101000a87816117f457fe5b04816117fc57fe5b0660f81b83828151811061180c57fe5b60200101906001600160f81b031916908160001a9053506001016117db565b5050905092915050565b6060806040519050835180825260208201818101602087015b8183101561186657805183526020928301920161184e565b50855184518101855292509050808201602086015b8183101561189357805183526020928301920161187b565b508651929092011591909101601f01601f191660405250905092915050565b606081805190602001206040516020016118cc9190613a51565b6040516020818303038152906040529050919050565b6040805180820190915260018152600160ff1b60209091015260007f56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218214156119365761192f8585611c77565b905061147a565b600061194184611c9b565b9050600080611951838987611d71565b509150915060006119648484848b612114565b9050611970818a61242c565b9998505050505050505050565b6060600061198a83612585565b90506115c461199b825160c06116e5565b82611835565b6060816000015182602001518360400151846060015185608001518660a001518760c001516040516020016118cc9796959493929190613a5a565b6000606060006119eb85611c9b565b905060008060006119fd848a89611d71565b81519295509093509150158080611a115750815b611a62576040805162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e000000000000604482015290519081900360640190fd5b600081611a7e5760405180602001604052806000815250611a9d565b611a9d866001870381518110611a9057fe5b602002602001015161268e565b919b919a509098505050505050505050565b611ab7613690565b506040805180820190915281518152602082810190820152919050565b60606000806000611ae4856126aa565b919450925090506000816001811115611af957fe5b14611b4b576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e0000000000000000604482015290519081900360640190fd5b611b5a856020015184846129d3565b95945050505050565b6060611456611b7183611aaf565b612a80565b6000611456825b6000602182600001511115611bd9576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b6000806000611be7856126aa565b919450925090506000816001811115611bfc57fe5b14611c4e576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e000000000000604482015290519081900360640190fd5b602080860151840180519091841015611c6d5760208490036101000a90045b9695505050505050565b6000611c8b611c8584612bf6565b83612cf2565b5180516020909101209392505050565b60606000611ca883611b63565b9050600081516001600160401b0381118015611cc357600080fd5b50604051908082528060200260200182016040528015611cfd57816020015b611cea6136aa565b815260200190600190039081611ce25790505b50905060005b8251811015611d69576000611d2a848381518110611d1d57fe5b6020026020010151611ad4565b90506040518060400160405280828152602001611d4683611b63565b815250838381518110611d5557fe5b602090810291909101015250600101611d03565b509392505050565b60006060818080611d8187612bf6565b905085600080611d8f6136aa565b60005b8c518110156120ec578c8181518110611da757fe5b6020026020010151915082840193506001870196508360001415611e1b57815180516020909101208514611e16576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e4dedee840d0c2e6d607b1b604482015290519081900360640190fd5b611ee2565b815151602011611e8257815180516020909101208514611e16576040805162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c20686173680000000000604482015290519081900360640190fd5b84611e908360000151612d86565b14611ee2576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f64652068617368000000000000604482015290519081900360640190fd5b60208201515160111415611f51578551841415611efe576120ec565b6000868581518110611f0c57fe5b602001015160f81c60f81b60f81c9050600083602001518260ff1681518110611f3157fe5b60200260200101519050611f4481612db2565b96506001945050506120e4565b60028260200151511415612097576000611f6a83612de8565b9050600081600081518110611f7b57fe5b016020015160f81c9050600181166002036000611f9b8460ff8416612e06565b90506000611fa98b8a612e06565b90506000611fb78383612e37565b905060ff851660021480611fce575060ff85166003145b1561200057808351148015611fe35750808251145b15611fed57988901985b50600160ff1b99506120ec945050505050565b60ff85161580612013575060ff85166001145b1561206057806120305750600160ff1b99506120ec945050505050565b612051886020015160018151811061204457fe5b6020026020010151612db2565b9a5097506120e4945050505050565b60405162461bcd60e51b81526004018080602001828103825260268152602001806140cf6026913960400191505060405180910390fd5b6040805162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e000000604482015290519081900360640190fd5b600101611d92565b50600160ff1b8414866120ff8786612e06565b909e909d50909b509950505050505050505050565b60606000839050600086600187038151811061212c57fe5b60200260200101519050600061214182612e9d565b6040805160038082526080820190925291925060009190816020015b6121656136aa565b81526020019060019003908161215d5790505090506000845160001480156121985750600283600281111561219657fe5b145b156121ce576121af6121a985612f73565b88612cf2565b8282815181106121bb57fe5b602090810291909101015260010161240f565b60008360028111156121dc57fe5b1415612242578451612211576121f28488612f86565b8282815181106121fe57fe5b602090810291909101015260010161223d565b8382828151811061221e57fe5b60200260200101819052506001810190506121af6121a9866001612e06565b61240f565b600061224d85612f73565b9050600061225b8288612e37565b905080156122bc57600061227183600084612fd1565b9050612285816122808c613121565b613162565b85858151811061229157fe5b60200260200101819052506001840193506122ac8383612e06565b92506122b88883612e06565b9750505b60006122c66131a6565b90508251600014156122eb576122e4816122df8961268e565b612f86565b9050612383565b6000836000815181106122fa57fe5b016020015160f81c905061230f846001612e06565b9350600287600281111561231f57fe5b141561235a576000612339856123348b61268e565b612cf2565b9050612352838361234d8460000151613121565b613233565b925050612381565b835115612370576000612339856122808b61268e565b61237e828261234d8b61268e565b91505b505b87516123b857612393818b612f86565b9050808585815181106123a257fe5b602002602001018190525060018401935061240b565b6123c3886001612e06565b9750808585815181106123d257fe5b60200260200101819052506001840193506123ed888b612cf2565b8585815181106123f957fe5b60200260200101819052506001840193505b5050505b61241e8a60018b03848461328c565b9a9950505050505050505050565b60008061243883612bf6565b90506124426136aa565b84516000906060905b80156125705787600182038151811061246057fe5b6020026020010151935061247384612e9d565b9250600283600281111561248357fe5b14156124ae57600061249485612f73565b90506124a68660008351895103612fd1565b95505061255a565b60018360028111156124bc57fe5b14156124fc5760006124cd85612f73565b90506124df8660008351895103612fd1565b8351909650156124f6576124f38184613162565b94505b5061255a565b600083600281111561250a57fe5b141561255a5781511561255a5760008560018751038151811061252957fe5b602001015160f81c60f81b60f81c90506125498660006001895103612fd1565b9550612556858285613233565b9450505b835161256590613121565b91506000190161244b565b50509051805160209091012095945050505050565b60608151600014156125a65750604080516000815260208101909152610948565b6000805b83518110156125d9578381815181106125bf57fe5b6020026020010151518201915080806001019150506125aa565b6000826001600160401b03811180156125f157600080fd5b506040519080825280601f01601f19166020018201604052801561261c576020820181803683370190505b50600092509050602081015b855183101561268557600086848151811061263f57fe5b60200260200101519050600060208201905061265d8382845161336e565b87858151811061266957fe5b6020026020010151518301925050508280600101935050612628565b50949350505050565b60208101518051606091611456916000198101908110611d1d57fe5b600080600080846000015111612707576040805162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e0000000000000000604482015290519081900360640190fd5b6020840151805160001a607f811161272c5760006001600094509450945050506129cc565b60b781116127a1578551607f19820190811061278f576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e00000000000000604482015290519081900360640190fd5b600195509350600092506129cc915050565b60bf811161288557855160b6198201908110612804576040805162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e00604482015290519081900360640190fd5b6000816020036101000a6001850151049050808201886000015111612870576040805162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e0000000000000000604482015290519081900360640190fd5b600190910195509350600092506129cc915050565b60f781116128f957855160bf1982019081106128e8576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e000000000000000000604482015290519081900360640190fd5b6001955093508492506129cc915050565b855160f6198201908110612954576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e000000604482015290519081900360640190fd5b6000816020036101000a60018501510490508082018860000151116129b9576040805162461bcd60e51b815260206004820152601660248201527524b73b30b634b210292628103637b733903634b9ba1760511b604482015290519081900360640190fd5b60019182019650945092506129cc915050565b9193909250565b60606000826001600160401b03811180156129ed57600080fd5b506040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b509050805160001415612a2c5790506115c4565b8484016020820160005b60208604811015612a57578251825260209283019290910190600101612a36565b5080519151601f959095166020036101000a600019019182169119909416179092525092915050565b6060600080612a8e846126aa565b91935090915060019050816001811115612aa457fe5b14612af6576040805162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e000000000000000000604482015290519081900360640190fd5b6040805160208082526104208201909252600091816020015b612b17613690565b815260200190600190039081612b0f5790505090506000835b8651811015612beb5760208210612b785760405162461bcd60e51b815260040180806020018281038252602a8152602001806140a5602a913960400191505060405180910390fd5b600080612ba46040518060400160405280858c60000151038152602001858c60200151018152506126aa565b509150915060405180604001604052808383018152602001848b6020015101815250858581518110612bd257fe5b6020908102919091010152600193909301920101612b30565b508152949350505050565b6060600082516002026001600160401b0381118015612c1457600080fd5b506040519080825280601f01601f191660200182016040528015612c3f576020820181803683370190505b50905060005b8351811015612ceb576004848281518110612c5c57fe5b602001015160f81c60f81b6001600160f81b031916901c828260020281518110612c8257fe5b60200101906001600160f81b031916908160001a9053506010848281518110612ca757fe5b016020015160f81c81612cb657fe5b0660f81b828260020260010181518110612ccc57fe5b60200101906001600160f81b031916908160001a905350600101612c45565b5092915050565b612cfa6136aa565b60408051600280825260608201909252600091816020015b6060815260200190600190039081612d125790505090506000612d368560016133b2565b9050612d446103bd82613457565b82600081518110612d5157fe5b6020026020010181905250612d658461140a565b82600181518110612d7257fe5b6020026020010181905250611b5a82613527565b6000602082511015612d9d57506020810151610948565b81806020019051602081101561094357600080fd5b60006060602083600001511015612dd357612dcc83613556565b9050612ddf565b612ddc83611ad4565b90505b6115c481612d86565b6060611456612e018360200151600081518110611d1d57fe5b612bf6565b60608183510360001415612e295750604080516020810190915260008152611456565b611453838384865103612fd1565b6000805b808451118015612e4b5750808351115b8015612e905750828181518110612e5e57fe5b602001015160f81c60f81b6001600160f81b031916848281518110612e7f57fe5b01602001516001600160f81b031916145b1561145357600101612e3b565b60208101515160009060111415612eb657506000610948565b60028260200151511415612f32576000612ecf83612de8565b9050600081600081518110612ee057fe5b016020015160f81c90506002811480612efc575060ff81166003145b15612f0c57600292505050610948565b60ff81161580612f1f575060ff81166001145b15612f2f57600192505050610948565b50505b6040805162461bcd60e51b8152602060048201526011602482015270496e76616c6964206e6f6465207479706560781b604482015290519081900360640190fd5b6060611456612f8183612de8565b613561565b612f8e6136aa565b6000612f998361140a565b9050612fa481611aaf565b602085015180516000198101908110612fb957fe5b602002602001018190525061147a84602001516135aa565b60608182601f01101561301c576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015613064576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b818301845110156130b0576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b6060821580156130cf5760405191506000825260208201604052612685565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156131085780518352602092830192016130f0565b5050858452601f01601f19166040525050949350505050565b6060602082511015613134575080610948565b8180519060200120604051602001808281526020019150506040516020818303038152906040529050610948565b61316a6136aa565b60408051600280825260608201909252600091816020015b60608152602001906001900390816131825790505090506000612d368560006133b2565b6131ae6136aa565b6040805160118082526102408201909252600091816020015b60608152602001906001900390816131c757905050905060005b815181101561322357604051806040016040528060018152602001600160ff1b81525082828151811061321057fe5b60209081029190910101526001016131e1565b5061322d81613527565b91505090565b61323b6136aa565b600060208351106132545761324f8361140a565b613256565b825b905061326181611aaf565b85602001518560ff168151811061327457fe5b6020026020010181905250611b5a85602001516135aa565b606060008285016001600160401b03811180156132a857600080fd5b506040519080825280602002602001820160405280156132e257816020015b6132cf6136aa565b8152602001906001900390816132c75790505b50905060005b85811015613323578681815181106132fc57fe5b602002602001015182828151811061331057fe5b60209081029190910101526001016132e8565b5060005b838110156133645784818151811061333b57fe5b6020026020010151828783018151811061335157fe5b6020908102919091010152600101613327565b5095945050505050565b8282825b60208110613391578151835260209283019290910190601f1901613372565b905182516020929092036101000a6000190180199091169116179052505050565b60606000826133c25760006133c5565b60025b9050600060028551816133d457fe5b06905060008160020360ff166001600160401b03811180156133f557600080fd5b506040519080825280601f01601f191660200182016040528015613420576020820181803683370190505b50905081830160f81b8160008151811061343657fe5b60200101906001600160f81b031916908160001a905350611c6d8187611835565b60606000600283518161346657fe5b046001600160401b038111801561347c57600080fd5b506040519080825280601f01601f1916602001820160405280156134a7576020820181803683370190505b50905060005b8151811015612ceb578381600202600101815181106134c857fe5b602001015160f81c60f81b60048583600202815181106134e457fe5b602001015160f81c60f81b6001600160f81b031916901b1782828151811061350857fe5b60200101906001600160f81b031916908160001a9053506001016134ad565b61352f6136aa565b600061353a8361197d565b905060405180604001604052808281526020016116d883611b63565b606061145682613653565b606060028260008151811061357257fe5b016020015160f81c8161358157fe5b0660ff166000141561359f57613598826002612e06565b9050610948565b613598826001612e06565b6135b26136aa565b600082516001600160401b03811180156135cb57600080fd5b506040519080825280602002602001820160405280156135ff57816020015b60608152602001906001900390816135ea5790505b50905060005b83518110156136495761362a84828151811061361d57fe5b6020026020010151613556565b82828151811061363657fe5b6020908102919091010152600101613605565b506115c481613527565b60606114568260200151600084600001516129d3565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604051806040016040528060008152602001600081525090565b604051806040016040528060608152602001606081525090565b60006001600160401b038311156136d757fe5b6136ea601f8401601f1916602001614039565b90508281528383830111156136fe57600080fd5b828260208301376000602084830101529392505050565b80356109488161408c565b8051801515811461094857600080fd5b600082601f830112613740578081fd5b611453838335602085016136c4565b80356002811061094857600080fd5b600080600060608486031215613772578283fd5b833561377d8161408c565b9250602084013561378d8161408c565b915060408401356001600160401b038111156137a7578182fd5b6137b386828701613730565b9150509250925092565b6000806000606084860312156137d1578283fd5b83356137dc8161408c565b92506020840135915060408401356001600160401b038111156137a7578182fd5b6000806040838503121561380f578182fd5b823561381a8161408c565b915060208301356001600160401b03811115613834578182fd5b61384085828601613730565b9150509250929050565b60006020828403121561385b578081fd5b61145382613720565b600060208284031215613875578081fd5b5051919050565b60006020828403121561388d578081fd5b81356001600160401b038111156138a2578182fd5b8201601f810184136138b2578182fd5b61147a848235602084016136c4565b600060c082840312156138d2578081fd5b60405160c081018181106001600160401b03821117156138ee57fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516139238161408c565b608082015261393460a08401613720565b60a08201529392505050565b600060208284031215613951578081fd5b81356001600160401b0380821115613967578283fd5b9083019060e0828603121561397a578283fd5b61398460e0614039565b823581526020830135602082015261399e6040840161374f565b60408201526139af60608401613715565b60608201526139c060808401613715565b608082015260a083013560a082015260c0830135828111156139e0578485fd5b6139ec87828601613730565b60c08301525095945050505050565b6001600160a01b03169052565b60008151808452613a2081602086016020860161405c565b601f01601f19169290920160200192915050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b90815260200190565b600088825287602083015260028710613a6f57fe5b8660f81b60408301526bffffffffffffffffffffffff19808760601b166041840152808660601b166055840152508360698301528251613ab681608985016020870161405c565b9190910160890198975050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b600060e08201905060018060a01b038085168352835160208401526020840151604084015260408401516060840152606084015160808401528060808501511660a08401525060a0830151151560c08301529392505050565b901515815260200190565b6020810160038310613b8957fe5b91905290565b60208082526025908201527f53746f7261676520736c6f742068617320616c7265616479206265656e20707260408201526437bb32b71760d91b606082015260800190565b60208082526026908201527f4163636f756e742073746174652068617320616c7265616479206265656e20706040820152653937bb32b71760d11b606082015260800190565b6020808252603e908201527f416c6c206163636f756e7473206d75737420626520636f6d6d6974746564206260408201527f65666f726520636f6d706c6574696e672061207472616e736974696f6e2e0000606082015260800190565b602080825260409082018190527f53746f7261676520736c6f742076616c7565207761736e2774206368616e6765908201527f64206f722068617320616c7265616479206265656e20636f6d6d69747465642e606082015260800190565b6020808252605b908201527f4f564d5f53746174655472616e736974696f6e65723a2050726f76696465642060408201527f4c3120636f6e747261637420636f6465206861736820646f6573206e6f74206d60608201527f61746368204c3220636f6e747261637420636f646520686173682e0000000000608082015260a00190565b6020808252603f908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d6d697474696e67206163636f756e74207374617465732e00606082015260800190565b60208082526038908201527f4e6f7420656e6f7567682067617320746f2065786563757465207472616e736160408201527f6374696f6e2064657465726d696e6973746963616c6c792e0000000000000000606082015260800190565b6020808252603b908201527f4163636f756e74207374617465207761736e2774206368616e676564206f722060408201527f68617320616c7265616479206265656e20636f6d6d69747465642e0000000000606082015260800190565b6020808252603d908201527f416c6c2073746f72616765206d75737420626520636f6d6d697474656420626560408201527f666f726520636f6d706c6574696e672061207472616e736974696f6e2e000000606082015260800190565b60208082526031908201527f46756e6374696f6e206d7573742062652063616c6c656420647572696e67207460408201527034329031b7b93932b1ba10383430b9b29760791b606082015260800190565b6020808252601d908201527f496e76616c6964207472616e73616374696f6e2070726f76696465642e000000604082015260600190565b60208082526038908201527f436f6e7472616374206d757374206265207665726966696564206265666f726560408201527f2070726f76696e6720612073746f7261676520736c6f742e0000000000000000606082015260800190565b6000604082528351604083015260208401516060830152604084015160028110613fd757fe5b60808381019190915260608501516001600160a01b031660a084015284015161400360c08401826139fb565b5060a084015160e083015260c084015160e0610100840152614029610120840182613a08565b9150506115c460208301846139fb565b6040518181016001600160401b038111828210171561405457fe5b604052919050565b60005b8381101561407757818101518382015260200161405f565b83811115614086576000848401525b50505050565b6001600160a01b03811681146140a157600080fd5b5056fe50726f766964656420524c50206c6973742065786365656473206d6178206c697374206c656e6774682e52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e20707265666978a2646970667358221220585b3731ad3984ef3b77187738a1026bd3e69375837d244bb63400abe835349664736f6c634300070600334372656174652063616e206f6e6c7920626520646f6e6520627920746865204f564d5f467261756456657269666965722ea26469706673582212206be2efd743bb636f4d53c9776948c26451e831f9d5ad5bab4cd233ff773bfc0b64736f6c63430007060033", - "devdoc": { - "details": "The State Transitioner Factory is used by the Fraud Verifier to create a new State Transitioner during the initialization of a fraud proof. Compiler used: solc Runtime target: EVM", - "kind": "dev", - "methods": { - "create(address,uint256,bytes32,bytes32)": { - "params": { - "_libAddressManager": "Address of the Address Manager.", - "_preStateRoot": "State root before the transition was executed.", - "_stateTransitionIndex": "Index of the state transition being verified.", - "_transactionHash": "Hash of the executed transaction." - }, - "returns": { - "_ovmStateTransitioner": "New OVM_StateTransitioner instance." - } - } - }, - "title": "OVM_StateTransitionerFactory", - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "create(address,uint256,bytes32,bytes32)": { - "notice": "Creates a new OVM_StateTransitioner" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 12337, - "contract": "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol:OVM_StateTransitionerFactory", - "label": "libAddressManager", - "offset": 0, - "slot": "0", - "type": "t_contract(Lib_AddressManager)12330" - } - ], - "types": { - "t_contract(Lib_AddressManager)12330": { - "encoding": "inplace", - "label": "contract Lib_AddressManager", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json b/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json deleted file mode 100644 index 563d59527..000000000 --- a/deployments/kovan/solcInputs/167e1592944606d9f946a16ee2ddffd3.json +++ /dev/null @@ -1,399 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/optimistic-ethereum/iOVM/accounts/iOVM_ECDSAContractAccount.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_ECDSAContractAccount\n */\ninterface iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external returns (bool _success, bytes memory _returndata);\n}\n" - }, - "contracts/optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../rlp/Lib_RLPReader.sol\";\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\nimport { Lib_Bytes32Utils } from \"../utils/Lib_Bytes32Utils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title Lib_OVMCodec\n */\nlibrary Lib_OVMCodec {\n\n /*************\n * Constants *\n *************/\n\n bytes constant internal RLP_NULL_BYTES = hex'80';\n bytes constant internal NULL_BYTES = bytes('');\n\n // Ring buffer IDs\n bytes32 constant internal RING_BUFFER_SCC_BATCHES = keccak256(\"RING_BUFFER_SCC_BATCHES\");\n bytes32 constant internal RING_BUFFER_CTC_BATCHES = keccak256(\"RING_BUFFER_CTC_BATCHES\");\n bytes32 constant internal RING_BUFFER_CTC_QUEUE = keccak256(\"RING_BUFFER_CTC_QUEUE\");\n\n\n /*********\n * Enums *\n *********/\n\n enum EOASignatureType {\n EIP155_TRANSACTON,\n ETH_SIGNED_MESSAGE\n }\n\n enum QueueOrigin {\n SEQUENCER_QUEUE,\n L1TOL2_QUEUE\n }\n\n\n /***********\n * Structs *\n ***********/\n\n struct Account {\n uint256 nonce;\n uint256 balance;\n bytes32 storageRoot;\n bytes32 codeHash;\n address ethAddress;\n bool isFresh;\n }\n\n struct EVMAccount {\n uint256 nonce;\n uint256 balance;\n bytes32 storageRoot;\n bytes32 codeHash;\n }\n\n struct ChainBatchHeader {\n uint256 batchIndex;\n bytes32 batchRoot;\n uint256 batchSize;\n uint256 prevTotalElements;\n bytes extraData;\n }\n\n struct ChainInclusionProof {\n uint256 index;\n bytes32[] siblings;\n }\n\n struct Transaction {\n uint256 timestamp;\n uint256 blockNumber;\n QueueOrigin l1QueueOrigin;\n address l1TxOrigin;\n address entrypoint;\n uint256 gasLimit;\n bytes data;\n }\n\n struct TransactionChainElement {\n bool isSequenced;\n uint256 queueIndex; // QUEUED TX ONLY\n uint256 timestamp; // SEQUENCER TX ONLY\n uint256 blockNumber; // SEQUENCER TX ONLY\n bytes txData; // SEQUENCER TX ONLY\n }\n\n struct QueueElement {\n bytes32 queueRoot;\n uint40 timestamp;\n uint40 blockNumber;\n }\n\n struct EIP155Transaction {\n uint256 nonce;\n uint256 gasPrice;\n uint256 gasLimit;\n address to;\n uint256 value;\n bytes data;\n uint256 chainId;\n }\n\n\n /*********************************************\n * Internal Functions: Encoding and Decoding *\n *********************************************/\n\n /**\n * Decodes an EOA transaction (i.e., native Ethereum RLP encoding).\n * @param _transaction Encoded EOA transaction.\n * @return _decoded Transaction decoded into a struct.\n */\n function decodeEIP155Transaction(\n bytes memory _transaction,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (\n EIP155Transaction memory _decoded\n )\n {\n if (_isEthSignedMessage) {\n (\n uint256 _nonce,\n uint256 _gasLimit,\n uint256 _gasPrice,\n uint256 _chainId,\n address _to,\n bytes memory _data\n ) = abi.decode(\n _transaction,\n (uint256, uint256, uint256, uint256, address ,bytes)\n );\n return EIP155Transaction({\n nonce: _nonce,\n gasPrice: _gasPrice,\n gasLimit: _gasLimit,\n to: _to,\n value: 0,\n data: _data,\n chainId: _chainId\n });\n } else {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_transaction);\n\n return EIP155Transaction({\n nonce: Lib_RLPReader.readUint256(decoded[0]),\n gasPrice: Lib_RLPReader.readUint256(decoded[1]),\n gasLimit: Lib_RLPReader.readUint256(decoded[2]),\n to: Lib_RLPReader.readAddress(decoded[3]),\n value: Lib_RLPReader.readUint256(decoded[4]),\n data: Lib_RLPReader.readBytes(decoded[5]),\n chainId: Lib_RLPReader.readUint256(decoded[6])\n });\n }\n }\n\n function decompressEIP155Transaction(\n bytes memory _transaction\n )\n internal\n returns (\n EIP155Transaction memory _decompressed\n )\n {\n return EIP155Transaction({\n gasLimit: Lib_BytesUtils.toUint24(_transaction, 0),\n gasPrice: uint256(Lib_BytesUtils.toUint24(_transaction, 3)) * 1000000,\n nonce: Lib_BytesUtils.toUint24(_transaction, 6),\n to: Lib_BytesUtils.toAddress(_transaction, 9),\n data: Lib_BytesUtils.slice(_transaction, 29),\n chainId: Lib_SafeExecutionManagerWrapper.safeCHAINID(),\n value: 0\n });\n }\n\n /**\n * Encodes an EOA transaction back into the original transaction.\n * @param _transaction EIP155transaction to encode.\n * @param _isEthSignedMessage Whether or not this was an eth signed message.\n * @return Encoded transaction.\n */\n function encodeEIP155Transaction(\n EIP155Transaction memory _transaction,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n if (_isEthSignedMessage) {\n return abi.encode(\n _transaction.nonce,\n _transaction.gasLimit,\n _transaction.gasPrice,\n _transaction.chainId,\n _transaction.to,\n _transaction.data\n );\n } else {\n bytes[] memory raw = new bytes[](9);\n\n raw[0] = Lib_RLPWriter.writeUint(_transaction.nonce);\n raw[1] = Lib_RLPWriter.writeUint(_transaction.gasPrice);\n raw[2] = Lib_RLPWriter.writeUint(_transaction.gasLimit);\n if (_transaction.to == address(0)) {\n raw[3] = Lib_RLPWriter.writeBytes('');\n } else {\n raw[3] = Lib_RLPWriter.writeAddress(_transaction.to);\n }\n raw[4] = Lib_RLPWriter.writeUint(0);\n raw[5] = Lib_RLPWriter.writeBytes(_transaction.data);\n raw[6] = Lib_RLPWriter.writeUint(_transaction.chainId);\n raw[7] = Lib_RLPWriter.writeBytes(bytes(''));\n raw[8] = Lib_RLPWriter.writeBytes(bytes(''));\n\n return Lib_RLPWriter.writeList(raw);\n }\n }\n\n /**\n * Encodes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return _encoded Encoded transaction bytes.\n */\n function encodeTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes memory _encoded\n )\n {\n return abi.encodePacked(\n _transaction.timestamp,\n _transaction.blockNumber,\n _transaction.l1QueueOrigin,\n _transaction.l1TxOrigin,\n _transaction.entrypoint,\n _transaction.gasLimit,\n _transaction.data\n );\n }\n\n /**\n * Hashes a standard OVM transaction.\n * @param _transaction OVM transaction to encode.\n * @return _hash Hashed transaction\n */\n function hashTransaction(\n Transaction memory _transaction\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(encodeTransaction(_transaction));\n }\n\n /**\n * Converts an OVM account to an EVM account.\n * @param _in OVM account to convert.\n * @return _out Converted EVM account.\n */\n function toEVMAccount(\n Account memory _in\n )\n internal\n pure\n returns (\n EVMAccount memory _out\n )\n {\n return EVMAccount({\n nonce: _in.nonce,\n balance: _in.balance,\n storageRoot: _in.storageRoot,\n codeHash: _in.codeHash\n });\n }\n\n /**\n * @notice RLP-encodes an account state struct.\n * @param _account Account state struct.\n * @return _encoded RLP-encoded account state.\n */\n function encodeEVMAccount(\n EVMAccount memory _account\n )\n internal\n pure\n returns (\n bytes memory _encoded\n )\n {\n bytes[] memory raw = new bytes[](4);\n\n // Unfortunately we can't create this array outright because\n // Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning\n // index-by-index circumvents this issue.\n raw[0] = Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(\n bytes32(_account.nonce)\n )\n );\n raw[1] = Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(\n bytes32(_account.balance)\n )\n );\n raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));\n raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));\n\n return Lib_RLPWriter.writeList(raw);\n }\n\n /**\n * @notice Decodes an RLP-encoded account state into a useful struct.\n * @param _encoded RLP-encoded account state.\n * @return _account Account state struct.\n */\n function decodeEVMAccount(\n bytes memory _encoded\n )\n internal\n pure\n returns (\n EVMAccount memory _account\n )\n {\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\n\n return EVMAccount({\n nonce: Lib_RLPReader.readUint256(accountState[0]),\n balance: Lib_RLPReader.readUint256(accountState[1]),\n storageRoot: Lib_RLPReader.readBytes32(accountState[2]),\n codeHash: Lib_RLPReader.readBytes32(accountState[3])\n });\n }\n\n /**\n * Calculates a hash for a given batch header.\n * @param _batchHeader Header to hash.\n * @return _hash Hash of the header.\n */\n function hashBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(\n abi.encode(\n _batchHeader.batchRoot,\n _batchHeader.batchSize,\n _batchHeader.prevTotalElements,\n _batchHeader.extraData\n )\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_RLPReader\n * @dev Adapted from \"RLPReader\" by Hamdi Allam (hamdi.allam97@gmail.com).\n */\nlibrary Lib_RLPReader {\n\n /*************\n * Constants *\n *************/\n\n uint256 constant internal MAX_LIST_LENGTH = 32;\n\n\n /*********\n * Enums *\n *********/\n\n enum RLPItemType {\n DATA_ITEM,\n LIST_ITEM\n }\n\n \n /***********\n * Structs *\n ***********/\n\n struct RLPItem {\n uint256 length;\n uint256 ptr;\n }\n \n\n /**********************\n * Internal Functions *\n **********************/\n \n /**\n * Converts bytes to a reference to memory position and length.\n * @param _in Input bytes to convert.\n * @return Output memory reference.\n */\n function toRLPItem(\n bytes memory _in\n )\n internal\n pure\n returns (\n RLPItem memory\n )\n {\n uint256 ptr;\n assembly {\n ptr := add(_in, 32)\n }\n\n return RLPItem({\n length: _in.length,\n ptr: ptr\n });\n }\n\n /**\n * Reads an RLP list value into a list of RLP items.\n * @param _in RLP list value.\n * @return Decoded RLP list items.\n */\n function readList(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n RLPItem[] memory\n )\n {\n (\n uint256 listOffset,\n ,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.LIST_ITEM,\n \"Invalid RLP list value.\"\n );\n\n // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by\n // writing to the length. Since we can't know the number of RLP items without looping over\n // the entire input, we'd have to loop twice to accurately size this array. It's easier to\n // simply set a reasonable maximum list length and decrease the size before we finish.\n RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH);\n\n uint256 itemCount = 0;\n uint256 offset = listOffset;\n while (offset < _in.length) {\n require(\n itemCount < MAX_LIST_LENGTH,\n \"Provided RLP list exceeds max list length.\"\n );\n\n (\n uint256 itemOffset,\n uint256 itemLength,\n ) = _decodeLength(RLPItem({\n length: _in.length - offset,\n ptr: _in.ptr + offset\n }));\n\n out[itemCount] = RLPItem({\n length: itemLength + itemOffset,\n ptr: _in.ptr + offset\n });\n\n itemCount += 1;\n offset += itemOffset + itemLength;\n }\n\n // Decrease the array size to match the actual item count.\n assembly {\n mstore(out, itemCount)\n }\n\n return out;\n }\n\n /**\n * Reads an RLP list value into a list of RLP items.\n * @param _in RLP list value.\n * @return Decoded RLP list items.\n */\n function readList(\n bytes memory _in\n )\n internal\n pure\n returns (\n RLPItem[] memory\n )\n {\n return readList(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bytes value into bytes.\n * @param _in RLP bytes value.\n * @return Decoded bytes.\n */\n function readBytes(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n (\n uint256 itemOffset,\n uint256 itemLength,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.DATA_ITEM,\n \"Invalid RLP bytes value.\"\n );\n\n return _copy(_in.ptr, itemOffset, itemLength);\n }\n\n /**\n * Reads an RLP bytes value into bytes.\n * @param _in RLP bytes value.\n * @return Decoded bytes.\n */\n function readBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return readBytes(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP string value into a string.\n * @param _in RLP string value.\n * @return Decoded string.\n */\n function readString(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n string memory\n )\n {\n return string(readBytes(_in));\n }\n\n /**\n * Reads an RLP string value into a string.\n * @param _in RLP string value.\n * @return Decoded string.\n */\n function readString(\n bytes memory _in\n )\n internal\n pure\n returns (\n string memory\n )\n {\n return readString(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bytes32 value into a bytes32.\n * @param _in RLP bytes32 value.\n * @return Decoded bytes32.\n */\n function readBytes32(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n require(\n _in.length <= 33,\n \"Invalid RLP bytes32 value.\"\n );\n\n (\n uint256 itemOffset,\n uint256 itemLength,\n RLPItemType itemType\n ) = _decodeLength(_in);\n\n require(\n itemType == RLPItemType.DATA_ITEM,\n \"Invalid RLP bytes32 value.\"\n );\n\n uint256 ptr = _in.ptr + itemOffset;\n bytes32 out;\n assembly {\n out := mload(ptr)\n\n // Shift the bytes over to match the item size.\n if lt(itemLength, 32) {\n out := div(out, exp(256, sub(32, itemLength)))\n }\n }\n\n return out;\n }\n\n /**\n * Reads an RLP bytes32 value into a bytes32.\n * @param _in RLP bytes32 value.\n * @return Decoded bytes32.\n */\n function readBytes32(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return readBytes32(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP uint256 value into a uint256.\n * @param _in RLP uint256 value.\n * @return Decoded uint256.\n */\n function readUint256(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n uint256\n )\n {\n return uint256(readBytes32(_in));\n }\n\n /**\n * Reads an RLP uint256 value into a uint256.\n * @param _in RLP uint256 value.\n * @return Decoded uint256.\n */\n function readUint256(\n bytes memory _in\n )\n internal\n pure\n returns (\n uint256\n )\n {\n return readUint256(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP bool value into a bool.\n * @param _in RLP bool value.\n * @return Decoded bool.\n */\n function readBool(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n require(\n _in.length == 1,\n \"Invalid RLP boolean value.\"\n );\n\n uint256 ptr = _in.ptr;\n uint256 out;\n assembly {\n out := byte(0, mload(ptr))\n }\n\n return out != 0;\n }\n\n /**\n * Reads an RLP bool value into a bool.\n * @param _in RLP bool value.\n * @return Decoded bool.\n */\n function readBool(\n bytes memory _in\n )\n internal\n pure\n returns (\n bool\n )\n {\n return readBool(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads an RLP address value into a address.\n * @param _in RLP address value.\n * @return Decoded address.\n */\n function readAddress(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n address\n )\n {\n if (_in.length == 1) {\n return address(0);\n }\n\n require(\n _in.length == 21,\n \"Invalid RLP address value.\"\n );\n\n return address(readUint256(_in));\n }\n\n /**\n * Reads an RLP address value into a address.\n * @param _in RLP address value.\n * @return Decoded address.\n */\n function readAddress(\n bytes memory _in\n )\n internal\n pure\n returns (\n address\n )\n {\n return readAddress(\n toRLPItem(_in)\n );\n }\n\n /**\n * Reads the raw bytes of an RLP item.\n * @param _in RLP item to read.\n * @return Raw RLP bytes.\n */\n function readRawBytes(\n RLPItem memory _in\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return _copy(_in);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Decodes the length of an RLP item.\n * @param _in RLP item to decode.\n * @return Offset of the encoded data.\n * @return Length of the encoded data.\n * @return RLP item type (LIST_ITEM or DATA_ITEM).\n */\n function _decodeLength(\n RLPItem memory _in\n )\n private\n pure\n returns (\n uint256,\n uint256,\n RLPItemType\n )\n {\n require(\n _in.length > 0,\n \"RLP item cannot be null.\"\n );\n\n uint256 ptr = _in.ptr;\n uint256 prefix;\n assembly {\n prefix := byte(0, mload(ptr))\n }\n\n if (prefix <= 0x7f) {\n // Single byte.\n\n return (0, 1, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xb7) {\n // Short string.\n\n uint256 strLen = prefix - 0x80;\n \n require(\n _in.length > strLen,\n \"Invalid RLP short string.\"\n );\n\n return (1, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xbf) {\n // Long string.\n uint256 lenOfStrLen = prefix - 0xb7;\n\n require(\n _in.length > lenOfStrLen,\n \"Invalid RLP long string length.\"\n );\n\n uint256 strLen;\n assembly {\n // Pick out the string length.\n strLen := div(\n mload(add(ptr, 1)),\n exp(256, sub(32, lenOfStrLen))\n )\n }\n\n require(\n _in.length > lenOfStrLen + strLen,\n \"Invalid RLP long string.\"\n );\n\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xf7) {\n // Short list.\n uint256 listLen = prefix - 0xc0;\n\n require(\n _in.length > listLen,\n \"Invalid RLP short list.\"\n );\n\n return (1, listLen, RLPItemType.LIST_ITEM);\n } else {\n // Long list.\n uint256 lenOfListLen = prefix - 0xf7;\n\n require(\n _in.length > lenOfListLen,\n \"Invalid RLP long list length.\"\n );\n\n uint256 listLen;\n assembly {\n // Pick out the list length.\n listLen := div(\n mload(add(ptr, 1)),\n exp(256, sub(32, lenOfListLen))\n )\n }\n\n require(\n _in.length > lenOfListLen + listLen,\n \"Invalid RLP long list.\"\n );\n\n return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM);\n }\n }\n\n /**\n * Copies the bytes from a memory location.\n * @param _src Pointer to the location to read from.\n * @param _offset Offset to start reading from.\n * @param _length Number of bytes to read.\n * @return Copied bytes.\n */\n function _copy(\n uint256 _src,\n uint256 _offset,\n uint256 _length\n )\n private\n pure\n returns (\n bytes memory\n )\n {\n bytes memory out = new bytes(_length);\n if (out.length == 0) {\n return out;\n }\n\n uint256 src = _src + _offset;\n uint256 dest;\n assembly {\n dest := add(out, 32)\n }\n\n // Copy over as many complete words as we can.\n for (uint256 i = 0; i < _length / 32; i++) {\n assembly {\n mstore(dest, mload(src))\n }\n\n src += 32;\n dest += 32;\n }\n\n // Pick out the remaining bytes.\n uint256 mask = 256 ** (32 - (_length % 32)) - 1;\n assembly {\n mstore(\n dest,\n or(\n and(mload(src), not(mask)),\n and(mload(dest), mask)\n )\n )\n }\n\n return out;\n }\n\n /**\n * Copies an RLP item into bytes.\n * @param _in RLP item to copy.\n * @return Copied bytes.\n */\n function _copy(\n RLPItem memory _in\n )\n private\n pure\n returns (\n bytes memory\n )\n {\n return _copy(_in.ptr, 0, _in.length);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\n\n/**\n * @title Lib_RLPWriter\n * @author Bakaoh (with modifications)\n */\nlibrary Lib_RLPWriter {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * RLP encodes a byte string.\n * @param _in The byte string to encode.\n * @return _out The RLP encoded string in bytes.\n */\n function writeBytes(\n bytes memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory encoded;\n\n if (_in.length == 1 && uint8(_in[0]) < 128) {\n encoded = _in;\n } else {\n encoded = Lib_BytesUtils.concat(_writeLength(_in.length, 128), _in);\n }\n\n return encoded;\n }\n\n /**\n * RLP encodes a list of RLP encoded byte byte strings.\n * @param _in The list of RLP encoded byte strings.\n * @return _out The RLP encoded list of items in bytes.\n */\n function writeList(\n bytes[] memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory list = _flatten(_in);\n return Lib_BytesUtils.concat(_writeLength(list.length, 192), list);\n }\n\n /**\n * RLP encodes a string.\n * @param _in The string to encode.\n * @return _out The RLP encoded string in bytes.\n */\n function writeString(\n string memory _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(bytes(_in));\n }\n\n /**\n * RLP encodes an address.\n * @param _in The address to encode.\n * @return _out The RLP encoded address in bytes.\n */\n function writeAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(abi.encodePacked(_in));\n }\n\n /**\n * RLP encodes a uint.\n * @param _in The uint256 to encode.\n * @return _out The RLP encoded uint256 in bytes.\n */\n function writeUint(\n uint256 _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n return writeBytes(_toBinary(_in));\n }\n\n /**\n * RLP encodes a bool.\n * @param _in The bool to encode.\n * @return _out The RLP encoded bool in bytes.\n */\n function writeBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory encoded = new bytes(1);\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\n return encoded;\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Encode the first byte, followed by the `len` in binary form if `length` is more than 55.\n * @param _len The length of the string or the payload.\n * @param _offset 128 if item is string, 192 if item is list.\n * @return _encoded RLP encoded bytes.\n */\n function _writeLength(\n uint256 _len,\n uint256 _offset\n )\n private\n pure\n returns (\n bytes memory _encoded\n )\n {\n bytes memory encoded;\n\n if (_len < 56) {\n encoded = new bytes(1);\n encoded[0] = byte(uint8(_len) + uint8(_offset));\n } else {\n uint256 lenLen;\n uint256 i = 1;\n while (_len / i != 0) {\n lenLen++;\n i *= 256;\n }\n\n encoded = new bytes(lenLen + 1);\n encoded[0] = byte(uint8(lenLen) + uint8(_offset) + 55);\n for(i = 1; i <= lenLen; i++) {\n encoded[i] = byte(uint8((_len / (256**(lenLen-i))) % 256));\n }\n }\n\n return encoded;\n }\n\n /**\n * Encode integer in big endian binary form with no leading zeroes.\n * @notice TODO: This should be optimized with assembly to save gas costs.\n * @param _x The integer to encode.\n * @return _binary RLP encoded bytes.\n */\n function _toBinary(\n uint256 _x\n )\n private\n pure\n returns (\n bytes memory _binary\n )\n {\n bytes memory b = abi.encodePacked(_x);\n\n uint256 i = 0;\n for (; i < 32; i++) {\n if (b[i] != 0) {\n break;\n }\n }\n\n bytes memory res = new bytes(32 - i);\n for (uint256 j = 0; j < res.length; j++) {\n res[j] = b[i++];\n }\n\n return res;\n }\n\n /**\n * Copies a piece of memory to another location.\n * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol.\n * @param _dest Destination location.\n * @param _src Source location.\n * @param _len Length of memory to copy.\n */\n function _memcpy(\n uint256 _dest,\n uint256 _src,\n uint256 _len\n )\n private\n pure\n {\n uint256 dest = _dest;\n uint256 src = _src;\n uint256 len = _len;\n\n for(; len >= 32; len -= 32) {\n assembly {\n mstore(dest, mload(src))\n }\n dest += 32;\n src += 32;\n }\n\n uint256 mask = 256 ** (32 - len) - 1;\n assembly {\n let srcpart := and(mload(src), not(mask))\n let destpart := and(mload(dest), mask)\n mstore(dest, or(destpart, srcpart))\n }\n }\n\n /**\n * Flattens a list of byte strings into one byte string.\n * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol.\n * @param _list List of byte strings to flatten.\n * @return _flattened The flattened byte string.\n */\n function _flatten(\n bytes[] memory _list\n )\n private\n pure\n returns (\n bytes memory _flattened\n )\n {\n if (_list.length == 0) {\n return new bytes(0);\n }\n\n uint256 len;\n uint256 i = 0;\n for (; i < _list.length; i++) {\n len += _list[i].length;\n }\n\n bytes memory flattened = new bytes(len);\n uint256 flattenedPtr;\n assembly { flattenedPtr := add(flattened, 0x20) }\n\n for(i = 0; i < _list.length; i++) {\n bytes memory item = _list[i];\n\n uint256 listPtr;\n assembly { listPtr := add(item, 0x20)}\n\n _memcpy(flattenedPtr, listPtr, item.length);\n flattenedPtr += _list[i].length;\n }\n\n return flattened;\n }\n}" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_BytesUtils\n */\nlibrary Lib_BytesUtils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n function concat(\n bytes memory _preBytes,\n bytes memory _postBytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory tempBytes;\n\n assembly {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // Store the length of the first bytes array at the beginning of\n // the memory for tempBytes.\n let length := mload(_preBytes)\n mstore(tempBytes, length)\n\n // Maintain a memory counter for the current write location in the\n // temp bytes array by adding the 32 bytes for the array length to\n // the starting location.\n let mc := add(tempBytes, 0x20)\n // Stop copying when the memory counter reaches the length of the\n // first bytes array.\n let end := add(mc, length)\n\n for {\n // Initialize a copy counter to the start of the _preBytes data,\n // 32 bytes into its memory.\n let cc := add(_preBytes, 0x20)\n } lt(mc, end) {\n // Increase both counters by 32 bytes each iteration.\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n // Write the _preBytes data into the tempBytes memory 32 bytes\n // at a time.\n mstore(mc, mload(cc))\n }\n\n // Add the length of _postBytes to the current length of tempBytes\n // and store it as the new length in the first 32 bytes of the\n // tempBytes memory.\n length := mload(_postBytes)\n mstore(tempBytes, add(length, mload(tempBytes)))\n\n // Move the memory counter back from a multiple of 0x20 to the\n // actual end of the _preBytes data.\n mc := end\n // Stop copying when the memory counter reaches the new combined\n // length of the arrays.\n end := add(mc, length)\n\n for {\n let cc := add(_postBytes, 0x20)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n // Update the free-memory pointer by padding our last write location\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\n // next 32 byte block, then round down to the nearest multiple of\n // 32. If the sum of the length of the two arrays is zero then add\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\n mstore(0x40, and(\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\n not(31) // Round down to the nearest 32 bytes.\n ))\n }\n\n return tempBytes;\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n internal\n pure\n returns (bytes memory)\n {\n require(_length + 31 >= _length, \"slice_overflow\");\n require(_start + _length >= _start, \"slice_overflow\");\n require(_bytes.length >= _start + _length, \"slice_outOfBounds\");\n\n bytes memory tempBytes;\n\n assembly {\n switch iszero(_length)\n case 0 {\n // Get a location of some free memory and store it in tempBytes as\n // Solidity does for memory variables.\n tempBytes := mload(0x40)\n\n // The first word of the slice result is potentially a partial\n // word read from the original array. To read it, we calculate\n // the length of that partial word and start copying that many\n // bytes into the array. The first word we copy will start with\n // data we don't care about, but the last `lengthmod` bytes will\n // land at the beginning of the contents of the new array. When\n // we're done copying, we overwrite the full first word with\n // the actual length of the slice.\n let lengthmod := and(_length, 31)\n\n // The multiplication in the next line is necessary\n // because when slicing multiples of 32 bytes (lengthmod == 0)\n // the following copy loop was copying the origin's length\n // and then ending prematurely not copying everything it should.\n let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))\n let end := add(mc, _length)\n\n for {\n // The multiplication in the next line has the same exact purpose\n // as the one above.\n let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)\n } lt(mc, end) {\n mc := add(mc, 0x20)\n cc := add(cc, 0x20)\n } {\n mstore(mc, mload(cc))\n }\n\n mstore(tempBytes, _length)\n\n //update free-memory pointer\n //allocating the array padded to 32 bytes like the compiler does now\n mstore(0x40, and(add(mc, 31), not(31)))\n }\n //if we want a zero-length slice let's just return a zero-length array\n default {\n tempBytes := mload(0x40)\n\n //zero out the 32 bytes slice we are about to return\n //we need to do it because Solidity does not garbage collect\n mstore(tempBytes, 0)\n\n mstore(0x40, add(tempBytes, 0x20))\n }\n }\n\n return tempBytes;\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start\n )\n internal\n pure\n returns (bytes memory)\n {\n if (_bytes.length - _start == 0) {\n return bytes('');\n }\n\n return slice(_bytes, _start, _bytes.length - _start);\n }\n\n function toBytes32PadLeft(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes32)\n {\n bytes32 ret;\n uint256 len = _bytes.length <= 32 ? _bytes.length : 32;\n assembly {\n ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))\n }\n return ret;\n }\n\n function toBytes32(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes32)\n {\n if (_bytes.length < 32) {\n bytes32 ret;\n assembly {\n ret := mload(add(_bytes, 32))\n }\n return ret;\n }\n\n return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes\n }\n\n function toUint256(\n bytes memory _bytes\n )\n internal\n pure\n returns (uint256)\n {\n return uint256(toBytes32(_bytes));\n }\n\n function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {\n require(_start + 3 >= _start, \"toUint24_overflow\");\n require(_bytes.length >= _start + 3 , \"toUint24_outOfBounds\");\n uint24 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x3), _start))\n }\n\n return tempUint;\n }\n\n function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {\n require(_start + 1 >= _start, \"toUint8_overflow\");\n require(_bytes.length >= _start + 1 , \"toUint8_outOfBounds\");\n uint8 tempUint;\n\n assembly {\n tempUint := mload(add(add(_bytes, 0x1), _start))\n }\n\n return tempUint;\n }\n\n function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {\n require(_start + 20 >= _start, \"toAddress_overflow\");\n require(_bytes.length >= _start + 20, \"toAddress_outOfBounds\");\n address tempAddress;\n\n assembly {\n tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)\n }\n\n return tempAddress;\n }\n\n function toNibbles(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory nibbles = new bytes(_bytes.length * 2);\n\n for (uint256 i = 0; i < _bytes.length; i++) {\n nibbles[i * 2] = _bytes[i] >> 4;\n nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);\n }\n\n return nibbles;\n }\n\n function fromNibbles(\n bytes memory _bytes\n )\n internal\n pure\n returns (bytes memory)\n {\n bytes memory ret = new bytes(_bytes.length / 2);\n\n for (uint256 i = 0; i < ret.length; i++) {\n ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]);\n }\n\n return ret;\n }\n\n function equal(\n bytes memory _bytes,\n bytes memory _other\n )\n internal\n pure\n returns (bool)\n {\n return keccak256(_bytes) == keccak256(_other);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Byte32Utils\n */\nlibrary Lib_Bytes32Utils {\n\n /**********************\n * Internal Functions *\n **********************/\n\n function toBool(\n bytes32 _in\n )\n internal\n pure\n returns (\n bool _out\n )\n {\n return _in != 0;\n }\n\n function fromBool(\n bool _in\n )\n internal\n pure\n returns (\n bytes32 _out\n )\n {\n return bytes32(uint256(_in ? 1 : 0));\n }\n\n function toAddress(\n bytes32 _in\n )\n internal\n pure\n returns (\n address _out\n )\n {\n return address(uint160(uint256(_in)));\n }\n\n function fromAddress(\n address _in\n )\n internal\n pure\n returns (\n bytes32 _out\n )\n {\n return bytes32(uint256(_in));\n }\n\n function removeLeadingZeros(\n bytes32 _in\n )\n internal\n pure\n returns (\n bytes memory _out\n )\n {\n bytes memory out;\n\n assembly {\n // Figure out how many leading zero bytes to remove.\n let shift := 0\n for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {\n shift := add(shift, 1)\n }\n\n // Reserve some space for our output and fix the free memory pointer.\n out := mload(0x40)\n mstore(0x40, add(out, 0x40))\n\n // Shift the value and store it into the output bytes.\n mstore(add(out, 0x20), shl(mul(shift, 8), _in))\n\n // Store the new size (with leading zero bytes removed) in the output byte size.\n mstore(out, sub(32, shift))\n }\n\n return out;\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_SafeExecutionManagerWrapper\n * @dev The Safe Execution Manager Wrapper provides functions which facilitate writing OVM safe \n * code using the standard solidity compiler, by routing all its operations through the Execution \n * Manager.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\nlibrary Lib_SafeExecutionManagerWrapper {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Performs a safe ovmCALL.\n * @param _gasLimit Gas limit for the call.\n * @param _target Address to call.\n * @param _calldata Data to send to the call.\n * @return _success Whether or not the call reverted.\n * @return _returndata Data returned by the call.\n */\n function safeCALL(\n uint256 _gasLimit,\n address _target,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCALL(uint256,address,bytes)\",\n _gasLimit,\n _target,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Performs a safe ovmDELEGATECALL.\n * @param _gasLimit Gas limit for the call.\n * @param _target Address to call.\n * @param _calldata Data to send to the call.\n * @return _success Whether or not the call reverted.\n * @return _returndata Data returned by the call.\n */\n function safeDELEGATECALL(\n uint256 _gasLimit,\n address _target,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmDELEGATECALL(uint256,address,bytes)\",\n _gasLimit,\n _target,\n _calldata\n )\n );\n\n return abi.decode(returndata, (bool, bytes));\n }\n\n /**\n * Performs a safe ovmCREATE call.\n * @param _gasLimit Gas limit for the creation.\n * @param _bytecode Code for the new contract.\n * @return _contract Address of the created contract.\n */\n function safeCREATE(\n uint256 _gasLimit,\n bytes memory _bytecode\n )\n internal\n returns (\n address _contract\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n _gasLimit,\n abi.encodeWithSignature(\n \"ovmCREATE(bytes)\",\n _bytecode\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmEXTCODESIZE call.\n * @param _contract Address of the contract to query the size of.\n * @return _EXTCODESIZE Size of the requested contract in bytes.\n */\n function safeEXTCODESIZE(\n address _contract\n )\n internal\n returns (\n uint256 _EXTCODESIZE\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmEXTCODESIZE(address)\",\n _contract\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmCHAINID call.\n * @return _CHAINID Result of calling ovmCHAINID.\n */\n function safeCHAINID()\n internal\n returns (\n uint256 _CHAINID\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCHAINID()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmCALLER call.\n * @return _CALLER Result of calling ovmCALLER.\n */\n function safeCALLER()\n internal\n returns (\n address _CALLER\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCALLER()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmADDRESS call.\n * @return _ADDRESS Result of calling ovmADDRESS.\n */\n function safeADDRESS()\n internal\n returns (\n address _ADDRESS\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmADDRESS()\"\n )\n );\n\n return abi.decode(returndata, (address));\n }\n\n /**\n * Performs a safe ovmGETNONCE call.\n * @return _nonce Result of calling ovmGETNONCE.\n */\n function safeGETNONCE()\n internal\n returns (\n uint256 _nonce\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmGETNONCE()\"\n )\n );\n\n return abi.decode(returndata, (uint256));\n }\n\n /**\n * Performs a safe ovmSETNONCE call.\n * @param _nonce New account nonce.\n */\n function safeSETNONCE(\n uint256 _nonce\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSETNONCE(uint256)\",\n _nonce\n )\n );\n }\n\n /**\n * Performs a safe ovmCREATEEOA call.\n * @param _messageHash Message hash which was signed by EOA\n * @param _v v value of signature (0 or 1)\n * @param _r r value of signature\n * @param _s s value of signature\n */\n function safeCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmCREATEEOA(bytes32,uint8,bytes32,bytes32)\",\n _messageHash,\n _v,\n _r,\n _s\n )\n );\n }\n\n /**\n * Performs a safe REVERT.\n * @param _reason String revert reason to pass along with the REVERT.\n */\n function safeREVERT(\n string memory _reason\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmREVERT(bytes)\",\n bytes(_reason)\n )\n );\n }\n\n /**\n * Performs a safe \"require\".\n * @param _condition Boolean condition that must be true or will revert.\n * @param _reason String revert reason to pass along with the REVERT.\n */\n function safeREQUIRE(\n bool _condition,\n string memory _reason\n )\n internal\n {\n if (!_condition) {\n safeREVERT(\n _reason\n );\n }\n }\n\n /**\n * Performs a safe ovmSLOAD call.\n */\n function safeSLOAD(\n bytes32 _key\n )\n internal\n returns (\n bytes32\n )\n {\n bytes memory returndata = _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSLOAD(bytes32)\",\n _key\n )\n );\n\n return abi.decode(returndata, (bytes32));\n }\n\n /**\n * Performs a safe ovmSSTORE call.\n */\n function safeSSTORE(\n bytes32 _key,\n bytes32 _value\n )\n internal\n {\n _safeExecutionManagerInteraction(\n abi.encodeWithSignature(\n \"ovmSSTORE(bytes32,bytes32)\",\n _key,\n _value\n )\n );\n }\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Performs an ovm interaction and the necessary safety checks.\n * @param _gasLimit Gas limit for the interaction.\n * @param _calldata Data to send to the OVM_ExecutionManager (encoded with sighash).\n * @return _returndata Data sent back by the OVM_ExecutionManager.\n */\n function _safeExecutionManagerInteraction(\n uint256 _gasLimit,\n bytes memory _calldata\n )\n private\n returns (\n bytes memory _returndata\n )\n {\n address ovmExecutionManager = msg.sender;\n (\n bool success,\n bytes memory returndata\n ) = ovmExecutionManager.call{gas: _gasLimit}(_calldata);\n\n if (success == false) {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n } else if (returndata.length == 1) {\n assembly {\n return(0, 1)\n }\n } else {\n return returndata;\n }\n }\n\n function _safeExecutionManagerInteraction(\n bytes memory _calldata\n )\n private\n returns (\n bytes memory _returndata\n )\n {\n return _safeExecutionManagerInteraction(\n gasleft(),\n _calldata\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\nimport { Lib_SafeMathWrapper } from \"../../libraries/wrappers/Lib_SafeMathWrapper.sol\";\n\n/**\n * @title OVM_ECDSAContractAccount\n * @dev The ECDSA Contract Account can be used as the implementation for a ProxyEOA deployed by the\n * ovmCREATEEOA operation. It enables backwards compatibility with Ethereum's Layer 1, by \n * providing eth_sign and EIP155 formatted transaction encodings.\n *\n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n address constant ETH_ERC20_ADDRESS = 0x4200000000000000000000000000000000000006;\n uint256 constant EXECUTION_VALIDATION_GAS_OVERHEAD = 25000; // TODO: should be the amount sufficient to cover the gas costs of all of the transactions up to and including the CALL/CREATE which forms the entrypoint of the transaction.\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EOA transaction.\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\n\n // Address of this contract within the ovm (ovmADDRESS) should be the same as the\n // recovered address of the user who signed this message. This is how we manage to shim\n // account abstraction even though the user isn't a contract.\n // Need to make sure that the transaction nonce is right and bump it if so.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_ECDSAUtils.recover(\n _transaction,\n isEthSign,\n _v,\n _r,\n _s\n ) == Lib_SafeExecutionManagerWrapper.safeADDRESS(),\n \"Signature provided for EOA transaction execution is invalid.\"\n );\n\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\n\n // Need to make sure that the transaction chainId is correct.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.chainId == Lib_SafeExecutionManagerWrapper.safeCHAINID(),\n \"Transaction chainId does not match expected OVM chainId.\"\n );\n\n // Need to make sure that the transaction nonce is right.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // TEMPORARY: Disable gas checks for minnet.\n // // Need to make sure that the gas is sufficient to execute the transaction.\n // Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n // gasleft() >= Lib_SafeMathWrapper.add(decodedTx.gasLimit, EXECUTION_VALIDATION_GAS_OVERHEAD),\n // \"Gas is not sufficient to execute the transaction.\"\n // );\n\n // Transfer fee to relayer.\n address relayer = Lib_SafeExecutionManagerWrapper.safeCALLER();\n uint256 fee = Lib_SafeMathWrapper.mul(decodedTx.gasLimit, decodedTx.gasPrice);\n (bool success, ) = Lib_SafeExecutionManagerWrapper.safeCALL(\n gasleft(),\n ETH_ERC20_ADDRESS,\n abi.encodeWithSignature(\"transfer(address,uint256)\", relayer, fee)\n );\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n success == true,\n \"Fee was not transferred to relayer.\"\n );\n\n // Contract creations are signalled by sending a transaction to the zero address.\n if (decodedTx.to == address(0)) {\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\n decodedTx.gasLimit,\n decodedTx.data\n );\n\n // EVM doesn't tell us whether a contract creation failed, even if it reverted during\n // initialization. Always return `true` for our success value here.\n return (true, abi.encode(created));\n } else {\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\n // cases, but since this is a contract we'd end up bumping the nonce twice.\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\n\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n decodedTx.gasLimit,\n decodedTx.to,\n decodedTx.data\n );\n }\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_ECDSAUtils\n */\nlibrary Lib_ECDSAUtils {\n\n /**************************************\n * Internal Functions: ECDSA Recovery *\n **************************************/\n\n /**\n * Recovers a signed address given a message and signature.\n * @param _message Message that was originally signed.\n * @param _isEthSignedMessage Whether or not the user used the `Ethereum Signed Message` prefix.\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _sender Signer address.\n */\n function recover(\n bytes memory _message,\n bool _isEthSignedMessage,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n internal\n pure\n returns (\n address _sender\n )\n {\n bytes32 messageHash = getMessageHash(_message, _isEthSignedMessage);\n\n return ecrecover(\n messageHash,\n _v + 27,\n _r,\n _s\n );\n }\n\n function getMessageHash(\n bytes memory _message,\n bool _isEthSignedMessage\n )\n internal\n pure\n returns (bytes32) {\n if (_isEthSignedMessage) {\n return getEthSignedMessageHash(_message);\n }\n return getNativeMessageHash(_message);\n }\n\n\n /*************************************\n * Private Functions: ECDSA Recovery *\n *************************************/\n\n /**\n * Gets the native message hash (simple keccak256) for a message.\n * @param _message Message to hash.\n * @return _messageHash Native message hash.\n */\n function getNativeMessageHash(\n bytes memory _message\n )\n private\n pure\n returns (\n bytes32 _messageHash\n )\n {\n return keccak256(_message);\n }\n\n /**\n * Gets the hash of a message with the `Ethereum Signed Message` prefix.\n * @param _message Message to hash.\n * @return _messageHash Prefixed message hash.\n */\n function getEthSignedMessageHash(\n bytes memory _message\n )\n private\n pure\n returns (\n bytes32 _messageHash\n )\n {\n bytes memory prefix = \"\\x19Ethereum Signed Message:\\n32\";\n bytes32 messageHash = keccak256(_message);\n return keccak256(abi.encodePacked(prefix, messageHash));\n }\n}" - }, - "contracts/optimistic-ethereum/libraries/wrappers/Lib_SafeMathWrapper.sol": { - "content": "// SPDX-License-Identifier: MIT\n// Pulled from @openzeppelin/contracts/math/SafeMath.sol\n// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_SafeExecutionManagerWrapper } from \"./Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title Lib_SafeMathWrapper\n */\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\n\nlibrary Lib_SafeMathWrapper {\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal returns (uint256) {\n uint256 c = a + b;\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c >= a, \"Lib_SafeMathWrapper: addition overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal returns (uint256) {\n return sub(a, b, \"Lib_SafeMathWrapper: subtraction overflow\");\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b <= a, errorMessage);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(c / a == b, \"Lib_SafeMathWrapper: multiplication overflow\");\n\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal returns (uint256) {\n return div(a, b, \"Lib_SafeMathWrapper: division by zero\");\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b > 0, errorMessage);\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n return c;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal returns (uint256) {\n return mod(a, b, \"Lib_SafeMathWrapper: modulo by zero\");\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * Reverts with custom message when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal returns (uint256) {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(b != 0, errorMessage);\n return a % b;\n }\n}" - }, - "contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\n\n/* Interface Imports */\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_SafetyChecker } from \"../../iOVM/execution/iOVM_SafetyChecker.sol\";\n\n/* Contract Imports */\nimport { OVM_ECDSAContractAccount } from \"../accounts/OVM_ECDSAContractAccount.sol\";\nimport { OVM_ProxyEOA } from \"../accounts/OVM_ProxyEOA.sol\";\nimport { OVM_DeployerWhitelist } from \"../precompiles/OVM_DeployerWhitelist.sol\";\n\n/**\n * @title OVM_ExecutionManager\n * @dev The Execution Manager (EM) is the core of our OVM implementation, and provides a sandboxed\n * environment allowing us to execute OVM transactions deterministically on either Layer 1 or\n * Layer 2.\n * The EM's run() function is the first function called during the execution of any\n * transaction on L2.\n * For each context-dependent EVM operation the EM has a function which implements a corresponding\n * OVM operation, which will read state from the State Manager contract.\n * The EM relies on the Safety Checker to verify that code deployed to Layer 2 does not contain any\n * context-dependent operations.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_SafetyChecker internal ovmSafetyChecker;\n iOVM_StateManager internal ovmStateManager;\n\n\n /*******************************\n * Execution Context Variables *\n *******************************/\n\n GasMeterConfig internal gasMeterConfig;\n GlobalContext internal globalContext;\n TransactionContext internal transactionContext;\n MessageContext internal messageContext;\n TransactionRecord internal transactionRecord;\n MessageRecord internal messageRecord;\n\n\n /**************************\n * Gas Metering Constants *\n **************************/\n\n address constant GAS_METADATA_ADDRESS = 0x06a506A506a506A506a506a506A506A506A506A5;\n uint256 constant NUISANCE_GAS_SLOAD = 20000;\n uint256 constant NUISANCE_GAS_SSTORE = 20000;\n uint256 constant MIN_NUISANCE_GAS_PER_CONTRACT = 30000;\n uint256 constant NUISANCE_GAS_PER_CONTRACT_BYTE = 100;\n uint256 constant MIN_GAS_FOR_INVALID_STATE_ACCESS = 30000;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager,\n GasMeterConfig memory _gasMeterConfig,\n GlobalContext memory _globalContext\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n ovmSafetyChecker = iOVM_SafetyChecker(resolve(\"OVM_SafetyChecker\"));\n gasMeterConfig = _gasMeterConfig;\n globalContext = _globalContext;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Applies dynamically-sized refund to a transaction to account for the difference in execution\n * between L1 and L2, so that the overall cost of the ovmOPCODE is fixed.\n * @param _cost Desired gas cost for the function after the refund.\n */\n modifier netGasCost(\n uint256 _cost\n ) {\n uint256 gasProvided = gasleft();\n _;\n uint256 gasUsed = gasProvided - gasleft();\n\n // We want to refund everything *except* the specified cost.\n if (_cost < gasUsed) {\n transactionRecord.ovmGasRefund += gasUsed - _cost;\n }\n }\n\n /**\n * Applies a fixed-size gas refund to a transaction to account for the difference in execution\n * between L1 and L2, so that the overall cost of an ovmOPCODE can be lowered.\n * @param _discount Amount of gas cost to refund for the ovmOPCODE.\n */\n modifier fixedGasDiscount(\n uint256 _discount\n ) {\n uint256 gasProvided = gasleft();\n _;\n uint256 gasUsed = gasProvided - gasleft();\n\n // We want to refund the specified _discount, unless this risks underflow.\n if (_discount < gasUsed) {\n transactionRecord.ovmGasRefund += _discount;\n } else {\n // refund all we can without risking underflow.\n transactionRecord.ovmGasRefund += gasUsed;\n }\n }\n\n /**\n * Makes sure we're not inside a static context.\n */\n modifier notStatic() {\n if (messageContext.isStatic == true) {\n _revertWithFlag(RevertFlag.STATIC_VIOLATION);\n }\n _;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n /**\n * Starts the execution of a transaction via the OVM_ExecutionManager.\n * @param _transaction Transaction data to be executed.\n * @param _ovmStateManager iOVM_StateManager implementation providing account state.\n */\n function run(\n Lib_OVMCodec.Transaction memory _transaction,\n address _ovmStateManager\n )\n override\n public\n {\n require(transactionContext.ovmNUMBER == 0, \"Only be callable at the start of a transaction\");\n // Store our OVM_StateManager instance (significantly easier than attempting to pass the\n // address around in calldata).\n ovmStateManager = iOVM_StateManager(_ovmStateManager);\n\n // Make sure this function can't be called by anyone except the owner of the\n // OVM_StateManager (expected to be an OVM_StateTransitioner). We can revert here because\n // this would make the `run` itself invalid.\n require(\n // This method may return false during fraud proofs, but always returns true in L2 nodes' State Manager precompile.\n ovmStateManager.isAuthenticated(msg.sender),\n \"Only authenticated addresses in ovmStateManager can call this function\"\n );\n\n // Initialize the execution context, must be initialized before we perform any gas metering\n // or we'll throw a nuisance gas error.\n _initContext(_transaction);\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Check whether we need to start a new epoch, do so if necessary.\n // _checkNeedsNewEpoch(_transaction.timestamp);\n\n // Make sure the transaction's gas limit is valid. We don't revert here because we reserve\n // reverts for INVALID_STATE_ACCESS.\n if (_isValidGasLimit(_transaction.gasLimit, _transaction.l1QueueOrigin) == false) {\n return;\n }\n\n // Check gas right before the call to get total gas consumed by OVM transaction.\n uint256 gasProvided = gasleft();\n\n // Run the transaction, make sure to meter the gas usage.\n ovmCALL(\n _transaction.gasLimit - gasMeterConfig.minTransactionGasLimit,\n _transaction.entrypoint,\n _transaction.data\n );\n uint256 gasUsed = gasProvided - gasleft();\n\n // TEMPORARY: Gas metering is disabled for minnet.\n // // Update the cumulative gas based on the amount of gas used.\n // _updateCumulativeGas(gasUsed, _transaction.l1QueueOrigin);\n\n // Wipe the execution context.\n _resetContext();\n\n // Reset the ovmStateManager.\n ovmStateManager = iOVM_StateManager(address(0));\n }\n\n\n /******************************\n * Opcodes: Execution Context *\n ******************************/\n\n /**\n * @notice Overrides CALLER.\n * @return _CALLER Address of the CALLER within the current message context.\n */\n function ovmCALLER()\n override\n public\n view\n returns (\n address _CALLER\n )\n {\n return messageContext.ovmCALLER;\n }\n\n /**\n * @notice Overrides ADDRESS.\n * @return _ADDRESS Active ADDRESS within the current message context.\n */\n function ovmADDRESS()\n override\n public\n view\n returns (\n address _ADDRESS\n )\n {\n return messageContext.ovmADDRESS;\n }\n\n /**\n * @notice Overrides TIMESTAMP.\n * @return _TIMESTAMP Value of the TIMESTAMP within the transaction context.\n */\n function ovmTIMESTAMP()\n override\n public\n view\n returns (\n uint256 _TIMESTAMP\n )\n {\n return transactionContext.ovmTIMESTAMP;\n }\n\n /**\n * @notice Overrides NUMBER.\n * @return _NUMBER Value of the NUMBER within the transaction context.\n */\n function ovmNUMBER()\n override\n public\n view\n returns (\n uint256 _NUMBER\n )\n {\n return transactionContext.ovmNUMBER;\n }\n\n /**\n * @notice Overrides GASLIMIT.\n * @return _GASLIMIT Value of the block's GASLIMIT within the transaction context.\n */\n function ovmGASLIMIT()\n override\n public\n view\n returns (\n uint256 _GASLIMIT\n )\n {\n return transactionContext.ovmGASLIMIT;\n }\n\n /**\n * @notice Overrides CHAINID.\n * @return _CHAINID Value of the chain's CHAINID within the global context.\n */\n function ovmCHAINID()\n override\n public\n view\n returns (\n uint256 _CHAINID\n )\n {\n return globalContext.ovmCHAINID;\n }\n\n /*********************************\n * Opcodes: L2 Execution Context *\n *********************************/\n\n /**\n * @notice Specifies from which L1 rollup queue this transaction originated from.\n * @return _queueOrigin Address of the ovmL1QUEUEORIGIN within the current message context.\n */\n function ovmL1QUEUEORIGIN()\n override\n public\n view\n returns (\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n {\n return transactionContext.ovmL1QUEUEORIGIN;\n }\n\n /**\n * @notice Specifies which L1 account, if any, sent this transaction by calling enqueue().\n * @return _l1TxOrigin Address of the account which sent the tx into L2 from L1.\n */\n function ovmL1TXORIGIN()\n override\n public\n view\n returns (\n address _l1TxOrigin\n )\n {\n return transactionContext.ovmL1TXORIGIN;\n }\n\n /********************\n * Opcodes: Halting *\n ********************/\n\n /**\n * @notice Overrides REVERT.\n * @param _data Bytes data to pass along with the REVERT.\n */\n function ovmREVERT(\n bytes memory _data\n )\n override\n public\n {\n _revertWithFlag(RevertFlag.INTENTIONAL_REVERT, _data);\n }\n\n\n /******************************\n * Opcodes: Contract Creation *\n ******************************/\n\n /**\n * @notice Overrides CREATE.\n * @param _bytecode Code to be used to CREATE a new contract.\n * @return _contract Address of the created contract.\n */\n function ovmCREATE(\n bytes memory _bytecode\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address _contract\n )\n {\n // Creator is always the current ADDRESS.\n address creator = ovmADDRESS();\n\n // Check that the deployer is whitelisted, or\n // that arbitrary contract deployment has been enabled.\n _checkDeployerAllowed(creator);\n\n // Generate the correct CREATE address.\n address contractAddress = Lib_EthUtils.getAddressForCREATE(\n creator,\n _getAccountNonce(creator)\n );\n\n return _createContract(\n contractAddress,\n _bytecode\n );\n }\n\n /**\n * @notice Overrides CREATE2.\n * @param _bytecode Code to be used to CREATE2 a new contract.\n * @param _salt Value used to determine the contract's address.\n * @return _contract Address of the created contract.\n */\n function ovmCREATE2(\n bytes memory _bytecode,\n bytes32 _salt\n )\n override\n public\n notStatic\n fixedGasDiscount(40000)\n returns (\n address _contract\n )\n {\n // Creator is always the current ADDRESS.\n address creator = ovmADDRESS();\n\n // Check that the deployer is whitelisted, or\n // that arbitrary contract deployment has been enabled.\n _checkDeployerAllowed(creator);\n\n // Generate the correct CREATE2 address.\n address contractAddress = Lib_EthUtils.getAddressForCREATE2(\n creator,\n _bytecode,\n _salt\n );\n\n return _createContract(\n contractAddress,\n _bytecode\n );\n }\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n /**\n * Retrieves the nonce of the current ovmADDRESS.\n * @return _nonce Nonce of the current contract.\n */\n function ovmGETNONCE()\n override\n public\n returns (\n uint256 _nonce\n )\n {\n return _getAccountNonce(ovmADDRESS());\n }\n\n /**\n * Sets the nonce of the current ovmADDRESS.\n * @param _nonce New nonce for the current contract.\n */\n function ovmSETNONCE(\n uint256 _nonce\n )\n override\n public\n notStatic\n {\n _setAccountNonce(ovmADDRESS(), _nonce);\n }\n\n /**\n * Creates a new EOA contract account, for account abstraction.\n * @dev Essentially functions like ovmCREATE or ovmCREATE2, but we can bypass a lot of checks\n * because the contract we're creating is trusted (no need to do safety checking or to\n * handle unexpected reverts). Doesn't need to return an address because the address is\n * assumed to be the user's actual address.\n * @param _messageHash Hash of a message signed by some user, for verification.\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n */\n function ovmCREATEEOA(\n bytes32 _messageHash,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n notStatic\n {\n // Recover the EOA address from the message hash and signature parameters. Since we do the\n // hashing in advance, we don't have handle different message hashing schemes. Even if this\n // function were to return the wrong address (rather than explicitly returning the zero\n // address), the rest of the transaction would simply fail (since there's no EOA account to\n // actually execute the transaction).\n address eoa = ecrecover(\n _messageHash,\n _v + 27,\n _r,\n _s\n );\n\n // Invalid signature is a case we proactively handle with a revert. We could alternatively\n // have this function return a `success` boolean, but this is just easier.\n if (eoa == address(0)) {\n ovmREVERT(bytes(\"Signature provided for EOA contract creation is invalid.\"));\n }\n\n // If the user already has an EOA account, then there's no need to perform this operation.\n if (_hasEmptyAccount(eoa) == false) {\n return;\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(eoa);\n\n // Temporarily set the current address so it's easier to access on L2.\n address prevADDRESS = messageContext.ovmADDRESS;\n messageContext.ovmADDRESS = eoa;\n\n // Now actually create the account and get its bytecode. We're not worried about reverts\n // (other than out of gas, which we can't capture anyway) because this contract is trusted.\n OVM_ProxyEOA proxyEOA = new OVM_ProxyEOA(0x4200000000000000000000000000000000000003);\n\n // Reset the address now that we're done deploying.\n messageContext.ovmADDRESS = prevADDRESS;\n\n // Commit the account with its final values.\n _commitPendingAccount(\n eoa,\n address(proxyEOA),\n keccak256(Lib_EthUtils.getCode(address(proxyEOA)))\n );\n\n _setAccountNonce(eoa, 0);\n }\n\n\n /*********************************\n * Opcodes: Contract Interaction *\n *********************************/\n\n /**\n * @notice Overrides CALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmCALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(100000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // CALL updates the CALLER and ADDRESS.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n /**\n * @notice Overrides STATICCALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmSTATICCALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(80000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // STATICCALL updates the CALLER, updates the ADDRESS, and runs in a static context.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = nextMessageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _address;\n nextMessageContext.isStatic = true;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n /**\n * @notice Overrides DELEGATECALL.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _address Address of the contract to call.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function ovmDELEGATECALL(\n uint256 _gasLimit,\n address _address,\n bytes memory _calldata\n )\n override\n public\n fixedGasDiscount(40000)\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // DELEGATECALL does not change anything about the message context.\n MessageContext memory nextMessageContext = messageContext;\n bool isStaticEntrypoint = false;\n\n return _callContract(\n nextMessageContext,\n _gasLimit,\n _address,\n _calldata\n );\n }\n\n\n /************************************\n * Opcodes: Contract Storage Access *\n ************************************/\n\n /**\n * @notice Overrides SLOAD.\n * @param _key 32 byte key of the storage slot to load.\n * @return _value 32 byte value of the requested storage slot.\n */\n function ovmSLOAD(\n bytes32 _key\n )\n override\n public\n netGasCost(40000)\n returns (\n bytes32 _value\n )\n {\n // We always SLOAD from the storage of ADDRESS.\n address contractAddress = ovmADDRESS();\n\n return _getContractStorage(\n contractAddress,\n _key\n );\n }\n\n /**\n * @notice Overrides SSTORE.\n * @param _key 32 byte key of the storage slot to set.\n * @param _value 32 byte value for the storage slot.\n */\n function ovmSSTORE(\n bytes32 _key,\n bytes32 _value\n )\n override\n public\n notStatic\n netGasCost(60000)\n {\n // We always SSTORE to the storage of ADDRESS.\n address contractAddress = ovmADDRESS();\n\n _putContractStorage(\n contractAddress,\n _key,\n _value\n );\n }\n\n\n /*********************************\n * Opcodes: Contract Code Access *\n *********************************/\n\n /**\n * @notice Overrides EXTCODECOPY.\n * @param _contract Address of the contract to copy code from.\n * @param _offset Offset in bytes from the start of contract code to copy beyond.\n * @param _length Total number of bytes to copy from the contract's code.\n * @return _code Bytes of code copied from the requested contract.\n */\n function ovmEXTCODECOPY(\n address _contract,\n uint256 _offset,\n uint256 _length\n )\n override\n public\n returns (\n bytes memory _code\n )\n {\n // `ovmEXTCODECOPY` is the only overridden opcode capable of producing exactly one byte of\n // return data. By blocking reads of one byte, we're able to use the condition that an\n // OVM_ExecutionManager function return value having a length of exactly one byte indicates\n // an error without an explicit revert. If users were able to read a single byte, they\n // could forcibly trigger behavior that should only be available to this contract.\n uint256 length = _length == 1 ? 2 : _length;\n\n return Lib_EthUtils.getCode(\n _getAccountEthAddress(_contract),\n _offset,\n length\n );\n }\n\n /**\n * @notice Overrides EXTCODESIZE.\n * @param _contract Address of the contract to query the size of.\n * @return _EXTCODESIZE Size of the requested contract in bytes.\n */\n function ovmEXTCODESIZE(\n address _contract\n )\n override\n public\n returns (\n uint256 _EXTCODESIZE\n )\n {\n return Lib_EthUtils.getCodeSize(\n _getAccountEthAddress(_contract)\n );\n }\n\n /**\n * @notice Overrides EXTCODEHASH.\n * @param _contract Address of the contract to query the hash of.\n * @return _EXTCODEHASH Hash of the requested contract.\n */\n function ovmEXTCODEHASH(\n address _contract\n )\n override\n public\n returns (\n bytes32 _EXTCODEHASH\n )\n {\n return Lib_EthUtils.getCodeHash(\n _getAccountEthAddress(_contract)\n );\n }\n\n\n /**************************************\n * Public Functions: Execution Safety *\n **************************************/\n\n /**\n * Performs the logic to create a contract and revert under various potential conditions.\n * @dev This function is implemented as `public` because we need to be able to revert a\n * contract creation without losing information about exactly *why* the contract reverted.\n * In particular, we want to be sure that contracts cannot trigger an INVALID_STATE_ACCESS\n * flag and then revert to reset the flag. We're able to do this by making an external\n * call from `ovmCREATE` and `ovmCREATE2` to `safeCREATE`, which can capture and relay\n * information before reverting.\n * @param _address Address of the contract to associate with the one being created.\n * @param _bytecode Code to be used to create the new contract.\n */\n function safeCREATE(\n address _address,\n bytes memory _bytecode\n )\n override\n public\n {\n // Since this function is public, anyone can attempt to directly call it. We need to make\n // sure that the OVM_ExecutionManager itself is the only party that can actually try to\n // call this function.\n if (msg.sender != address(this)) {\n return;\n }\n\n // We need to be sure that the user isn't trying to use a contract creation to overwrite\n // some existing contract. On L1, users will prove that no contract exists at the address\n // and the OVM_FraudVerifier will populate the code hash of this address with a special\n // value that represents \"known to be an empty account.\"\n if (_hasEmptyAccount(_address) == false) {\n _revertWithFlag(RevertFlag.CREATE_COLLISION);\n }\n\n // Check the creation bytecode against the OVM_SafetyChecker.\n if (ovmSafetyChecker.isBytecodeSafe(_bytecode) == false) {\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\n }\n\n // We always need to initialize the contract with the default account values.\n _initPendingAccount(_address);\n\n // Actually deploy the contract and retrieve its address. This step is hiding a lot of\n // complexity because we need to ensure that contract creation *never* reverts by itself.\n // We cover this partially by storing a revert flag and returning (instead of reverting)\n // when we know that we're inside a contract's creation code.\n address ethAddress = Lib_EthUtils.createContract(_bytecode);\n\n // Contract creation returns the zero address when it fails, which should only be possible\n // if the user intentionally runs out of gas. However, we might still have a bit of gas\n // left over since contract calls can only be passed 63/64ths of total gas, so we need to\n // explicitly handle this case here.\n if (ethAddress == address(0)) {\n _revertWithFlag(RevertFlag.CREATE_EXCEPTION);\n }\n\n // Here we pull out the revert flag that would've been set during creation code. Now that\n // we're out of creation code again, we can just revert normally while passing the flag\n // through the revert data.\n if (messageRecord.revertFlag != RevertFlag.DID_NOT_REVERT) {\n _revertWithFlag(messageRecord.revertFlag);\n }\n\n // Again simply checking that the deployed code is safe too. Contracts can generate\n // arbitrary deployment code, so there's no easy way to analyze this beforehand.\n bytes memory deployedCode = Lib_EthUtils.getCode(ethAddress);\n if (ovmSafetyChecker.isBytecodeSafe(deployedCode) == false) {\n _revertWithFlag(RevertFlag.UNSAFE_BYTECODE);\n }\n\n // Contract creation didn't need to be reverted and the bytecode is safe. We finish up by\n // associating the desired address with the newly created contract's code hash and address.\n _commitPendingAccount(\n _address,\n ethAddress,\n Lib_EthUtils.getCodeHash(ethAddress)\n );\n }\n\n\n /***************************************\n * Public Functions: Execution Context *\n ***************************************/\n\n function getMaxTransactionGasLimit()\n external\n view\n override\n returns (\n uint256 _maxTransactionGasLimit\n )\n {\n return gasMeterConfig.maxTransactionGasLimit;\n }\n\n /********************************************\n * Public Functions: Deployment Witelisting *\n ********************************************/\n\n /**\n * Checks whether the given address is on the whitelst to ovmCREATE/ovmCREATE2, and reverts if not.\n * @param _deployerAddress Address attempting to deploy a contract.\n */\n function _checkDeployerAllowed(\n address _deployerAddress\n )\n internal\n {\n // From an OVM semanitcs perspectibe, this will appear the identical to\n // the deployer ovmCALLing the whitelist. This is fine--in a sense, we are forcing them to.\n (bool success, bytes memory data) = ovmCALL(\n gasleft(),\n 0x4200000000000000000000000000000000000002,\n abi.encodeWithSignature(\"isDeployerAllowed(address)\", _deployerAddress)\n );\n bool isAllowed = abi.decode(data, (bool));\n\n if (!isAllowed || !success) {\n _revertWithFlag(RevertFlag.CREATOR_NOT_ALLOWED);\n }\n }\n\n /********************************************\n * Internal Functions: Contract Interaction *\n ********************************************/\n\n /**\n * Creates a new contract and associates it with some contract address.\n * @param _contractAddress Address to associate the created contract with.\n * @param _bytecode Bytecode to be used to create the contract.\n * @return _created Final OVM contract address.\n */\n function _createContract(\n address _contractAddress,\n bytes memory _bytecode\n )\n internal\n returns (\n address _created\n )\n {\n // We always update the nonce of the creating account, even if the creation fails.\n _setAccountNonce(ovmADDRESS(), _getAccountNonce(ovmADDRESS()) + 1);\n\n // We're stepping into a CREATE or CREATE2, so we need to update ADDRESS to point\n // to the contract's associated address and CALLER to point to the previous ADDRESS.\n MessageContext memory nextMessageContext = messageContext;\n nextMessageContext.ovmCALLER = messageContext.ovmADDRESS;\n nextMessageContext.ovmADDRESS = _contractAddress;\n\n // Run `safeCREATE` in a new EVM message so that our changes can be reflected even if\n // `safeCREATE` reverts.\n (bool _success, ) = _handleExternalInteraction(\n nextMessageContext,\n gasleft(),\n address(this),\n abi.encodeWithSignature(\n \"safeCREATE(address,bytes)\",\n _contractAddress,\n _bytecode\n )\n );\n\n // Need to make sure that this flag is reset so that it isn't propagated to creations in\n // some parent EVM message.\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\n\n // Yellow paper requires that address returned is zero if the contract deployment fails.\n return _success ? _contractAddress : address(0);\n }\n\n /**\n * Calls the deployed contract associated with a given address.\n * @param _nextMessageContext Message context to be used for the call.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _contract OVM address to be called.\n * @param _calldata Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function _callContract(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _contract,\n bytes memory _calldata\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.\n // So, we block calls to these addresses since they are not safe to run as an OVM contract itself.\n if (\n (uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))\n == uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)\n ) {\n return (true, hex'');\n }\n\n // Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.\n address codeContractAddress =\n uint(_contract) < 100\n ? _contract\n : _getAccountEthAddress(_contract);\n\n return _handleExternalInteraction(\n _nextMessageContext,\n _gasLimit,\n codeContractAddress,\n _calldata\n );\n }\n\n /**\n * Handles the logic of making an external call and parsing revert information.\n * @param _nextMessageContext Message context to be used for the call.\n * @param _gasLimit Amount of gas to be passed into this call.\n * @param _target Address of the contract to call.\n * @param _data Data to send along with the call.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function _handleExternalInteraction(\n MessageContext memory _nextMessageContext,\n uint256 _gasLimit,\n address _target,\n bytes memory _data\n )\n internal\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n // We need to switch over to our next message context for the duration of this call.\n MessageContext memory prevMessageContext = messageContext;\n _switchMessageContext(prevMessageContext, _nextMessageContext);\n\n // Nuisance gas is a system used to bound the ability for an attacker to make fraud proofs\n // expensive by touching a lot of different accounts or storage slots. Since most contracts\n // only use a few storage slots during any given transaction, this shouldn't be a limiting\n // factor.\n uint256 prevNuisanceGasLeft = messageRecord.nuisanceGasLeft;\n uint256 nuisanceGasLimit = _getNuisanceGasLimit(_gasLimit);\n messageRecord.nuisanceGasLeft = nuisanceGasLimit;\n\n // Make the call and make sure to pass in the gas limit. Another instance of hidden\n // complexity. `_target` is guaranteed to be a safe contract, meaning its return/revert\n // behavior can be controlled. In particular, we enforce that flags are passed through\n // revert data as to retrieve execution metadata that would normally be reverted out of\n // existence.\n (bool success, bytes memory returndata) = _target.call{gas: _gasLimit}(_data);\n\n // Switch back to the original message context now that we're out of the call.\n _switchMessageContext(_nextMessageContext, prevMessageContext);\n\n // Assuming there were no reverts, the message record should be accurate here. We'll update\n // this value in the case of a revert.\n uint256 nuisanceGasLeft = messageRecord.nuisanceGasLeft;\n\n // Reverts at this point are completely OK, but we need to make a few updates based on the\n // information passed through the revert.\n if (success == false) {\n (\n RevertFlag flag,\n uint256 nuisanceGasLeftPostRevert,\n uint256 ovmGasRefund,\n bytes memory returndataFromFlag\n ) = _decodeRevertData(returndata);\n\n // INVALID_STATE_ACCESS is the only flag that triggers an immediate abort of the\n // parent EVM message. This behavior is necessary because INVALID_STATE_ACCESS must\n // halt any further transaction execution that could impact the execution result.\n if (flag == RevertFlag.INVALID_STATE_ACCESS) {\n _revertWithFlag(flag);\n }\n\n // INTENTIONAL_REVERT, UNSAFE_BYTECODE, STATIC_VIOLATION, and CREATOR_NOT_ALLOWED aren't\n // dependent on the input state, so we can just handle them like standard reverts. Our only change here\n // is to record the gas refund reported by the call (enforced by safety checking).\n if (\n flag == RevertFlag.INTENTIONAL_REVERT\n || flag == RevertFlag.UNSAFE_BYTECODE\n || flag == RevertFlag.STATIC_VIOLATION\n || flag == RevertFlag.CREATOR_NOT_ALLOWED\n ) {\n transactionRecord.ovmGasRefund = ovmGasRefund;\n }\n\n // INTENTIONAL_REVERT needs to pass up the user-provided return data encoded into the\n // flag, *not* the full encoded flag. All other revert types return no data.\n if (flag == RevertFlag.INTENTIONAL_REVERT) {\n returndata = returndataFromFlag;\n } else {\n returndata = hex'';\n }\n\n // Reverts mean we need to use up whatever \"nuisance gas\" was used by the call.\n // EXCEEDS_NUISANCE_GAS explicitly reduces the remaining nuisance gas for this message\n // to zero. OUT_OF_GAS is a \"pseudo\" flag given that messages return no data when they\n // run out of gas, so we have to treat this like EXCEEDS_NUISANCE_GAS. All other flags\n // will simply pass up the remaining nuisance gas.\n nuisanceGasLeft = nuisanceGasLeftPostRevert;\n }\n\n // We need to reset the nuisance gas back to its original value minus the amount used here.\n messageRecord.nuisanceGasLeft = prevNuisanceGasLeft - (nuisanceGasLimit - nuisanceGasLeft);\n\n return (\n success,\n returndata\n );\n }\n\n\n /******************************************\n * Internal Functions: State Manipulation *\n ******************************************/\n\n /**\n * Checks whether an account exists within the OVM_StateManager.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the account exists.\n */\n function _hasAccount(\n address _address\n )\n internal\n returns (\n bool _exists\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.hasAccount(_address);\n }\n\n /**\n * Checks whether a known empty account exists within the OVM_StateManager.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the account empty exists.\n */\n function _hasEmptyAccount(\n address _address\n )\n internal\n returns (\n bool _exists\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.hasEmptyAccount(_address);\n }\n\n /**\n * Sets the nonce of an account.\n * @param _address Address of the account to modify.\n * @param _nonce New account nonce.\n */\n function _setAccountNonce(\n address _address,\n uint256 _nonce\n )\n internal\n {\n _checkAccountChange(_address);\n ovmStateManager.setAccountNonce(_address, _nonce);\n }\n\n /**\n * Gets the nonce of an account.\n * @param _address Address of the account to access.\n * @return _nonce Nonce of the account.\n */\n function _getAccountNonce(\n address _address\n )\n internal\n returns (\n uint256 _nonce\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.getAccountNonce(_address);\n }\n\n /**\n * Retrieves the Ethereum address of an account.\n * @param _address Address of the account to access.\n * @return _ethAddress Corresponding Ethereum address.\n */\n function _getAccountEthAddress(\n address _address\n )\n internal\n returns (\n address _ethAddress\n )\n {\n _checkAccountLoad(_address);\n return ovmStateManager.getAccountEthAddress(_address);\n }\n\n /**\n * Creates the default account object for the given address.\n * @param _address Address of the account create.\n */\n function _initPendingAccount(\n address _address\n )\n internal\n {\n // Although it seems like `_checkAccountChange` would be more appropriate here, we don't\n // actually consider an account \"changed\" until it's inserted into the state (in this case\n // by `_commitPendingAccount`).\n _checkAccountLoad(_address);\n ovmStateManager.initPendingAccount(_address);\n }\n\n /**\n * Stores additional relevant data for a new account, thereby \"committing\" it to the state.\n * This function is only called during `ovmCREATE` and `ovmCREATE2` after a successful contract\n * creation.\n * @param _address Address of the account to commit.\n * @param _ethAddress Address of the associated deployed contract.\n * @param _codeHash Hash of the code stored at the address.\n */\n function _commitPendingAccount(\n address _address,\n address _ethAddress,\n bytes32 _codeHash\n )\n internal\n {\n _checkAccountChange(_address);\n ovmStateManager.commitPendingAccount(\n _address,\n _ethAddress,\n _codeHash\n );\n }\n\n /**\n * Retrieves the value of a storage slot.\n * @param _contract Address of the contract to query.\n * @param _key 32 byte key of the storage slot.\n * @return _value 32 byte storage slot value.\n */\n function _getContractStorage(\n address _contract,\n bytes32 _key\n )\n internal\n returns (\n bytes32 _value\n )\n {\n _checkContractStorageLoad(_contract, _key);\n return ovmStateManager.getContractStorage(_contract, _key);\n }\n\n /**\n * Sets the value of a storage slot.\n * @param _contract Address of the contract to modify.\n * @param _key 32 byte key of the storage slot.\n * @param _value 32 byte storage slot value.\n */\n function _putContractStorage(\n address _contract,\n bytes32 _key,\n bytes32 _value\n )\n internal\n {\n // We don't set storage if the value didn't change. Although this acts as a convenient\n // optimization, it's also necessary to avoid the case in which a contract with no storage\n // attempts to store the value \"0\" at any key. Putting this value (and therefore requiring\n // that the value be committed into the storage trie after execution) would incorrectly\n // modify the storage root.\n if (_getContractStorage(_contract, _key) == _value) {\n return;\n }\n\n _checkContractStorageChange(_contract, _key);\n ovmStateManager.putContractStorage(_contract, _key, _value);\n }\n\n /**\n * Validation whenever a contract needs to be loaded. Checks that the account exists, charges\n * nuisance gas if the account hasn't been loaded before.\n * @param _address Address of the account to load.\n */\n function _checkAccountLoad(\n address _address\n )\n internal\n {\n // See `_checkContractStorageLoad` for more information.\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // See `_checkContractStorageLoad` for more information.\n if (ovmStateManager.hasAccount(_address) == false) {\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\n }\n\n // Check whether the account has been loaded before and mark it as loaded if not. We need\n // this because \"nuisance gas\" only applies to the first time that an account is loaded.\n (\n bool _wasAccountAlreadyLoaded\n ) = ovmStateManager.testAndSetAccountLoaded(_address);\n\n // If we hadn't already loaded the account, then we'll need to charge \"nuisance gas\" based\n // on the size of the contract code.\n if (_wasAccountAlreadyLoaded == false) {\n _useNuisanceGas(\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\n );\n }\n }\n\n /**\n * Validation whenever a contract needs to be changed. Checks that the account exists, charges\n * nuisance gas if the account hasn't been changed before.\n * @param _address Address of the account to change.\n */\n function _checkAccountChange(\n address _address\n )\n internal\n {\n // Start by checking for a load as we only want to charge nuisance gas proportional to\n // contract size once.\n _checkAccountLoad(_address);\n\n // Check whether the account has been changed before and mark it as changed if not. We need\n // this because \"nuisance gas\" only applies to the first time that an account is changed.\n (\n bool _wasAccountAlreadyChanged\n ) = ovmStateManager.testAndSetAccountChanged(_address);\n\n // If we hadn't already loaded the account, then we'll need to charge \"nuisance gas\" based\n // on the size of the contract code.\n if (_wasAccountAlreadyChanged == false) {\n ovmStateManager.incrementTotalUncommittedAccounts();\n _useNuisanceGas(\n (Lib_EthUtils.getCodeSize(_getAccountEthAddress(_address)) * NUISANCE_GAS_PER_CONTRACT_BYTE) + MIN_NUISANCE_GAS_PER_CONTRACT\n );\n }\n }\n\n /**\n * Validation whenever a slot needs to be loaded. Checks that the account exists, charges\n * nuisance gas if the slot hasn't been loaded before.\n * @param _contract Address of the account to load from.\n * @param _key 32 byte key to load.\n */\n function _checkContractStorageLoad(\n address _contract,\n bytes32 _key\n )\n internal\n {\n // Another case of hidden complexity. If we didn't enforce this requirement, then a\n // contract could pass in just enough gas to cause the INVALID_STATE_ACCESS check to fail\n // on L1 but not on L2. A contract could use this behavior to prevent the\n // OVM_ExecutionManager from detecting an invalid state access. Reverting with OUT_OF_GAS\n // allows us to also charge for the full message nuisance gas, because you deserve that for\n // trying to break the contract in this way.\n if (gasleft() < MIN_GAS_FOR_INVALID_STATE_ACCESS) {\n _revertWithFlag(RevertFlag.OUT_OF_GAS);\n }\n\n // We need to make sure that the transaction isn't trying to access storage that hasn't\n // been provided to the OVM_StateManager. We'll immediately abort if this is the case.\n // We know that we have enough gas to do this check because of the above test.\n if (ovmStateManager.hasContractStorage(_contract, _key) == false) {\n _revertWithFlag(RevertFlag.INVALID_STATE_ACCESS);\n }\n\n // Check whether the slot has been loaded before and mark it as loaded if not. We need\n // this because \"nuisance gas\" only applies to the first time that a slot is loaded.\n (\n bool _wasContractStorageAlreadyLoaded\n ) = ovmStateManager.testAndSetContractStorageLoaded(_contract, _key);\n\n // If we hadn't already loaded the account, then we'll need to charge some fixed amount of\n // \"nuisance gas\".\n if (_wasContractStorageAlreadyLoaded == false) {\n _useNuisanceGas(NUISANCE_GAS_SLOAD);\n }\n }\n\n /**\n * Validation whenever a slot needs to be changed. Checks that the account exists, charges\n * nuisance gas if the slot hasn't been changed before.\n * @param _contract Address of the account to change.\n * @param _key 32 byte key to change.\n */\n function _checkContractStorageChange(\n address _contract,\n bytes32 _key\n )\n internal\n {\n // Start by checking for load to make sure we have the storage slot and that we charge the\n // \"nuisance gas\" necessary to prove the storage slot state.\n _checkContractStorageLoad(_contract, _key);\n\n // Check whether the slot has been changed before and mark it as changed if not. We need\n // this because \"nuisance gas\" only applies to the first time that a slot is changed.\n (\n bool _wasContractStorageAlreadyChanged\n ) = ovmStateManager.testAndSetContractStorageChanged(_contract, _key);\n\n // If we hadn't already changed the account, then we'll need to charge some fixed amount of\n // \"nuisance gas\".\n if (_wasContractStorageAlreadyChanged == false) {\n // Changing a storage slot means that we're also going to have to change the\n // corresponding account, so do an account change check.\n _checkAccountChange(_contract);\n\n ovmStateManager.incrementTotalUncommittedContractStorage();\n _useNuisanceGas(NUISANCE_GAS_SSTORE);\n }\n }\n\n\n /************************************\n * Internal Functions: Revert Logic *\n ************************************/\n\n /**\n * Simple encoding for revert data.\n * @param _flag Flag to revert with.\n * @param _data Additional user-provided revert data.\n * @return _revertdata Encoded revert data.\n */\n function _encodeRevertData(\n RevertFlag _flag,\n bytes memory _data\n )\n internal\n view\n returns (\n bytes memory _revertdata\n )\n {\n // Out of gas and create exceptions will fundamentally return no data, so simulating it shouldn't either.\n if (\n _flag == RevertFlag.OUT_OF_GAS\n || _flag == RevertFlag.CREATE_EXCEPTION\n ) {\n return bytes('');\n }\n\n // INVALID_STATE_ACCESS doesn't need to return any data other than the flag.\n if (_flag == RevertFlag.INVALID_STATE_ACCESS) {\n return abi.encode(\n _flag,\n 0,\n 0,\n bytes('')\n );\n }\n\n // Just ABI encode the rest of the parameters.\n return abi.encode(\n _flag,\n messageRecord.nuisanceGasLeft,\n transactionRecord.ovmGasRefund,\n _data\n );\n }\n\n /**\n * Simple decoding for revert data.\n * @param _revertdata Revert data to decode.\n * @return _flag Flag used to revert.\n * @return _nuisanceGasLeft Amount of nuisance gas unused by the message.\n * @return _ovmGasRefund Amount of gas refunded during the message.\n * @return _data Additional user-provided revert data.\n */\n function _decodeRevertData(\n bytes memory _revertdata\n )\n internal\n pure\n returns (\n RevertFlag _flag,\n uint256 _nuisanceGasLeft,\n uint256 _ovmGasRefund,\n bytes memory _data\n )\n {\n // A length of zero means the call ran out of gas, just return empty data.\n if (_revertdata.length == 0) {\n return (\n RevertFlag.OUT_OF_GAS,\n 0,\n 0,\n bytes('')\n );\n }\n\n // ABI decode the incoming data.\n return abi.decode(_revertdata, (RevertFlag, uint256, uint256, bytes));\n }\n\n /**\n * Causes a message to revert or abort.\n * @param _flag Flag to revert with.\n * @param _data Additional user-provided data.\n */\n function _revertWithFlag(\n RevertFlag _flag,\n bytes memory _data\n )\n internal\n {\n // We don't want to revert when we're inside a CREATE or CREATE2, because those opcodes\n // fail silently (we can't pass any data upwards). Instead, we set a flag and return a\n // *single* byte, something the OVM_ExecutionManager will not return in any other case.\n // We're thereby allowed to communicate failure without allowing contracts to trick us into\n // thinking there was a failure.\n bool isCreation;\n assembly {\n isCreation := eq(extcodesize(caller()), 0)\n }\n\n if (isCreation) {\n messageRecord.revertFlag = _flag;\n\n assembly {\n return(0, 1)\n }\n }\n\n // If we're not inside a CREATE or CREATE2, we can simply encode the necessary data and\n // revert normally.\n bytes memory revertdata = _encodeRevertData(\n _flag,\n _data\n );\n\n assembly {\n revert(add(revertdata, 0x20), mload(revertdata))\n }\n }\n\n /**\n * Causes a message to revert or abort.\n * @param _flag Flag to revert with.\n */\n function _revertWithFlag(\n RevertFlag _flag\n )\n internal\n {\n _revertWithFlag(_flag, bytes(''));\n }\n\n\n /******************************************\n * Internal Functions: Nuisance Gas Logic *\n ******************************************/\n\n /**\n * Computes the nuisance gas limit from the gas limit.\n * @dev This function is currently using a naive implementation whereby the nuisance gas limit\n * is set to exactly equal the lesser of the gas limit or remaining gas. It's likely that\n * this implementation is perfectly fine, but we may change this formula later.\n * @param _gasLimit Gas limit to compute from.\n * @return _nuisanceGasLimit Computed nuisance gas limit.\n */\n function _getNuisanceGasLimit(\n uint256 _gasLimit\n )\n internal\n view\n returns (\n uint256 _nuisanceGasLimit\n )\n {\n return _gasLimit < gasleft() ? _gasLimit : gasleft();\n }\n\n /**\n * Uses a certain amount of nuisance gas.\n * @param _amount Amount of nuisance gas to use.\n */\n function _useNuisanceGas(\n uint256 _amount\n )\n internal\n {\n // Essentially the same as a standard OUT_OF_GAS, except we also retain a record of the gas\n // refund to be given at the end of the transaction.\n if (messageRecord.nuisanceGasLeft < _amount) {\n _revertWithFlag(RevertFlag.EXCEEDS_NUISANCE_GAS);\n }\n\n messageRecord.nuisanceGasLeft -= _amount;\n }\n\n\n /************************************\n * Internal Functions: Gas Metering *\n ************************************/\n\n /**\n * Checks whether a transaction needs to start a new epoch and does so if necessary.\n * @param _timestamp Transaction timestamp.\n */\n function _checkNeedsNewEpoch(\n uint256 _timestamp\n )\n internal\n {\n if (\n _timestamp >= (\n _getGasMetadata(GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP)\n + gasMeterConfig.secondsPerEpoch\n )\n ) {\n _putGasMetadata(\n GasMetadataKey.CURRENT_EPOCH_START_TIMESTAMP,\n _timestamp\n );\n\n _putGasMetadata(\n GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS,\n _getGasMetadata(\n GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS\n )\n );\n\n _putGasMetadata(\n GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS,\n _getGasMetadata(\n GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS\n )\n );\n }\n }\n\n /**\n * Validates the gas limit for a given transaction.\n * @param _gasLimit Gas limit provided by the transaction.\n * @param _queueOrigin Queue from which the transaction originated.\n * @return _valid Whether or not the gas limit is valid.\n */\n function _isValidGasLimit(\n uint256 _gasLimit,\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n internal\n returns (\n bool _valid\n )\n {\n // Always have to be below the maximum gas limit.\n if (_gasLimit > gasMeterConfig.maxTransactionGasLimit) {\n return false;\n }\n\n // Always have to be above the minimum gas limit.\n if (_gasLimit < gasMeterConfig.minTransactionGasLimit) {\n return false;\n }\n\n // TEMPORARY: Gas metering is disabled for minnet.\n return true;\n // GasMetadataKey cumulativeGasKey;\n // GasMetadataKey prevEpochGasKey;\n // if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_SEQUENCER_QUEUE_GAS;\n // } else {\n // cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\n // prevEpochGasKey = GasMetadataKey.PREV_EPOCH_L1TOL2_QUEUE_GAS;\n // }\n\n // return (\n // (\n // _getGasMetadata(cumulativeGasKey)\n // - _getGasMetadata(prevEpochGasKey)\n // + _gasLimit\n // ) < gasMeterConfig.maxGasPerQueuePerEpoch\n // );\n }\n\n /**\n * Updates the cumulative gas after a transaction.\n * @param _gasUsed Gas used by the transaction.\n * @param _queueOrigin Queue from which the transaction originated.\n */\n function _updateCumulativeGas(\n uint256 _gasUsed,\n Lib_OVMCodec.QueueOrigin _queueOrigin\n )\n internal\n {\n GasMetadataKey cumulativeGasKey;\n if (_queueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE) {\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_SEQUENCER_QUEUE_GAS;\n } else {\n cumulativeGasKey = GasMetadataKey.CUMULATIVE_L1TOL2_QUEUE_GAS;\n }\n\n _putGasMetadata(\n cumulativeGasKey,\n (\n _getGasMetadata(cumulativeGasKey)\n + gasMeterConfig.minTransactionGasLimit\n + _gasUsed\n - transactionRecord.ovmGasRefund\n )\n );\n }\n\n /**\n * Retrieves the value of a gas metadata key.\n * @param _key Gas metadata key to retrieve.\n * @return _value Value stored at the given key.\n */\n function _getGasMetadata(\n GasMetadataKey _key\n )\n internal\n returns (\n uint256 _value\n )\n {\n return uint256(_getContractStorage(\n GAS_METADATA_ADDRESS,\n bytes32(uint256(_key))\n ));\n }\n\n /**\n * Sets the value of a gas metadata key.\n * @param _key Gas metadata key to set.\n * @param _value Value to store at the given key.\n */\n function _putGasMetadata(\n GasMetadataKey _key,\n uint256 _value\n )\n internal\n {\n _putContractStorage(\n GAS_METADATA_ADDRESS,\n bytes32(uint256(_key)),\n bytes32(uint256(_value))\n );\n }\n\n\n /*****************************************\n * Internal Functions: Execution Context *\n *****************************************/\n\n /**\n * Swaps over to a new message context.\n * @param _prevMessageContext Context we're switching from.\n * @param _nextMessageContext Context we're switching to.\n */\n function _switchMessageContext(\n MessageContext memory _prevMessageContext,\n MessageContext memory _nextMessageContext\n )\n internal\n {\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.ovmCALLER != _nextMessageContext.ovmCALLER) {\n messageContext.ovmCALLER = _nextMessageContext.ovmCALLER;\n }\n\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.ovmADDRESS != _nextMessageContext.ovmADDRESS) {\n messageContext.ovmADDRESS = _nextMessageContext.ovmADDRESS;\n }\n\n // Avoid unnecessary the SSTORE.\n if (_prevMessageContext.isStatic != _nextMessageContext.isStatic) {\n messageContext.isStatic = _nextMessageContext.isStatic;\n }\n }\n\n /**\n * Initializes the execution context.\n * @param _transaction OVM transaction being executed.\n */\n function _initContext(\n Lib_OVMCodec.Transaction memory _transaction\n )\n internal\n {\n transactionContext.ovmTIMESTAMP = _transaction.timestamp;\n transactionContext.ovmNUMBER = _transaction.blockNumber;\n transactionContext.ovmTXGASLIMIT = _transaction.gasLimit;\n transactionContext.ovmL1QUEUEORIGIN = _transaction.l1QueueOrigin;\n transactionContext.ovmL1TXORIGIN = _transaction.l1TxOrigin;\n transactionContext.ovmGASLIMIT = gasMeterConfig.maxGasPerQueuePerEpoch;\n\n messageRecord.nuisanceGasLeft = _getNuisanceGasLimit(_transaction.gasLimit);\n }\n\n /**\n * Resets the transaction and message context.\n */\n function _resetContext()\n internal\n {\n transactionContext.ovmL1TXORIGIN = address(0);\n transactionContext.ovmTIMESTAMP = 0;\n transactionContext.ovmNUMBER = 0;\n transactionContext.ovmGASLIMIT = 0;\n transactionContext.ovmTXGASLIMIT = 0;\n transactionContext.ovmL1QUEUEORIGIN = Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE;\n\n transactionRecord.ovmGasRefund = 0;\n\n messageContext.ovmCALLER = address(0);\n messageContext.ovmADDRESS = address(0);\n messageContext.isStatic = false;\n\n messageRecord.nuisanceGasLeft = 0;\n messageRecord.revertFlag = RevertFlag.DID_NOT_REVERT;\n }\n\n /*****************************\n * L2-only Helper Functions *\n *****************************/\n\n /**\n * Unreachable helper function for simulating eth_calls with an OVM message context.\n * This function will throw an exception in all cases other than when used as a custom entrypoint in L2 Geth to simulate eth_call.\n * @param _transaction the message transaction to simulate.\n * @param _from the OVM account the simulated call should be from.\n */\n function simulateMessage(\n Lib_OVMCodec.Transaction memory _transaction,\n address _from,\n iOVM_StateManager _ovmStateManager\n )\n external\n returns (\n bool,\n bytes memory\n )\n {\n // Prevent this call from having any effect unless in a custom-set VM frame\n require(msg.sender == address(0));\n\n ovmStateManager = _ovmStateManager;\n _initContext(_transaction);\n\n messageRecord.nuisanceGasLeft = uint(-1);\n messageContext.ovmADDRESS = _transaction.entrypoint;\n messageContext.ovmCALLER = _from;\n\n return _transaction.entrypoint.call{gas: _transaction.gasLimit}(_transaction.data);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_AddressResolver\n */\ncontract Lib_AddressResolver {\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n Lib_AddressManager internal libAddressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(\n address _libAddressManager\n ) public {\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function resolve(\n string memory _name\n )\n public\n view\n returns (\n address _contract\n )\n {\n return libAddressManager.getAddress(_name);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_EthUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\nimport { Lib_Bytes32Utils } from \"./Lib_Bytes32Utils.sol\";\n\n/**\n * @title Lib_EthUtils\n */\nlibrary Lib_EthUtils {\n\n /***********************************\n * Internal Functions: Code Access *\n ***********************************/\n\n /**\n * Gets the code for a given address.\n * @param _address Address to get code for.\n * @param _offset Offset to start reading from.\n * @param _length Number of bytes to read.\n * @return _code Code read from the contract.\n */\n function getCode(\n address _address,\n uint256 _offset,\n uint256 _length\n )\n internal\n view\n returns (\n bytes memory _code\n )\n {\n assembly {\n _code := mload(0x40)\n mstore(0x40, add(_code, add(_length, 0x20)))\n mstore(_code, _length)\n extcodecopy(_address, add(_code, 0x20), _offset, _length)\n }\n\n return _code;\n }\n\n /**\n * Gets the full code for a given address.\n * @param _address Address to get code for.\n * @return _code Full code of the contract.\n */\n function getCode(\n address _address\n )\n internal\n view\n returns (\n bytes memory _code\n )\n {\n return getCode(\n _address,\n 0,\n getCodeSize(_address)\n );\n }\n\n /**\n * Gets the size of a contract's code in bytes.\n * @param _address Address to get code size for.\n * @return _codeSize Size of the contract's code in bytes.\n */\n function getCodeSize(\n address _address\n )\n internal\n view\n returns (\n uint256 _codeSize\n )\n {\n assembly {\n _codeSize := extcodesize(_address)\n }\n\n return _codeSize;\n }\n\n /**\n * Gets the hash of a contract's code.\n * @param _address Address to get a code hash for.\n * @return _codeHash Hash of the contract's code.\n */\n function getCodeHash(\n address _address\n )\n internal\n view\n returns (\n bytes32 _codeHash\n )\n {\n assembly {\n _codeHash := extcodehash(_address)\n }\n\n return _codeHash;\n }\n\n\n /*****************************************\n * Internal Functions: Contract Creation *\n *****************************************/\n\n /**\n * Creates a contract with some given initialization code.\n * @param _code Contract initialization code.\n * @return _created Address of the created contract.\n */\n function createContract(\n bytes memory _code\n )\n internal\n returns (\n address _created\n )\n {\n assembly {\n _created := create(\n 0,\n add(_code, 0x20),\n mload(_code)\n )\n }\n\n return _created;\n }\n\n /**\n * Computes the address that would be generated by CREATE.\n * @param _creator Address creating the contract.\n * @param _nonce Creator's nonce.\n * @return _address Address to be generated by CREATE.\n */\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n internal\n pure\n returns (\n address _address\n )\n {\n bytes[] memory encoded = new bytes[](2);\n encoded[0] = Lib_RLPWriter.writeAddress(_creator);\n encoded[1] = Lib_RLPWriter.writeUint(_nonce);\n\n bytes memory encodedList = Lib_RLPWriter.writeList(encoded);\n return Lib_Bytes32Utils.toAddress(keccak256(encodedList));\n }\n\n /**\n * Computes the address that would be generated by CREATE2.\n * @param _creator Address creating the contract.\n * @param _bytecode Bytecode of the contract to be created.\n * @param _salt 32 byte salt value mixed into the hash.\n * @return _address Address to be generated by CREATE2.\n */\n function getAddressForCREATE2(\n address _creator,\n bytes memory _bytecode,\n bytes32 _salt\n )\n internal\n pure\n returns (address _address)\n {\n bytes32 hashedData = keccak256(abi.encodePacked(\n byte(0xff),\n _creator,\n _salt,\n keccak256(_bytecode)\n ));\n\n return Lib_Bytes32Utils.toAddress(hashedData);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/execution/iOVM_ExecutionManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\ninterface iOVM_ExecutionManager {\n /**********\n * Enums *\n *********/\n\n enum RevertFlag {\n DID_NOT_REVERT,\n OUT_OF_GAS,\n INTENTIONAL_REVERT,\n EXCEEDS_NUISANCE_GAS,\n INVALID_STATE_ACCESS,\n UNSAFE_BYTECODE,\n CREATE_COLLISION,\n STATIC_VIOLATION,\n CREATE_EXCEPTION,\n CREATOR_NOT_ALLOWED\n }\n\n enum GasMetadataKey {\n CURRENT_EPOCH_START_TIMESTAMP,\n CUMULATIVE_SEQUENCER_QUEUE_GAS,\n CUMULATIVE_L1TOL2_QUEUE_GAS,\n PREV_EPOCH_SEQUENCER_QUEUE_GAS,\n PREV_EPOCH_L1TOL2_QUEUE_GAS\n }\n\n /***********\n * Structs *\n ***********/\n\n struct GasMeterConfig {\n uint256 minTransactionGasLimit;\n uint256 maxTransactionGasLimit;\n uint256 maxGasPerQueuePerEpoch;\n uint256 secondsPerEpoch;\n }\n\n struct GlobalContext {\n uint256 ovmCHAINID;\n }\n\n struct TransactionContext {\n Lib_OVMCodec.QueueOrigin ovmL1QUEUEORIGIN;\n uint256 ovmTIMESTAMP;\n uint256 ovmNUMBER;\n uint256 ovmGASLIMIT;\n uint256 ovmTXGASLIMIT;\n address ovmL1TXORIGIN;\n }\n\n struct TransactionRecord {\n uint256 ovmGasRefund;\n }\n\n struct MessageContext {\n address ovmCALLER;\n address ovmADDRESS;\n bool isStatic;\n }\n\n struct MessageRecord {\n uint256 nuisanceGasLeft;\n RevertFlag revertFlag;\n }\n\n\n /************************************\n * Transaction Execution Entrypoint *\n ************************************/\n\n function run(\n Lib_OVMCodec.Transaction calldata _transaction,\n address _txStateManager\n ) external;\n\n\n /*******************\n * Context Opcodes *\n *******************/\n\n function ovmCALLER() external view returns (address _caller);\n function ovmADDRESS() external view returns (address _address);\n function ovmTIMESTAMP() external view returns (uint256 _timestamp);\n function ovmNUMBER() external view returns (uint256 _number);\n function ovmGASLIMIT() external view returns (uint256 _gasLimit);\n function ovmCHAINID() external view returns (uint256 _chainId);\n\n\n /**********************\n * L2 Context Opcodes *\n **********************/\n\n function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);\n function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);\n\n\n /*******************\n * Halting Opcodes *\n *******************/\n\n function ovmREVERT(bytes memory _data) external;\n\n\n /*****************************\n * Contract Creation Opcodes *\n *****************************/\n\n function ovmCREATE(bytes memory _bytecode) external returns (address _contract);\n function ovmCREATE2(bytes memory _bytecode, bytes32 _salt) external returns (address _contract);\n\n\n /*******************************\n * Account Abstraction Opcodes *\n ******************************/\n\n function ovmGETNONCE() external returns (uint256 _nonce);\n function ovmSETNONCE(uint256 _nonce) external;\n function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;\n\n\n /****************************\n * Contract Calling Opcodes *\n ****************************/\n\n function ovmCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmSTATICCALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n function ovmDELEGATECALL(uint256 _gasLimit, address _address, bytes memory _calldata) external returns (bool _success, bytes memory _returndata);\n\n\n /****************************\n * Contract Storage Opcodes *\n ****************************/\n\n function ovmSLOAD(bytes32 _key) external returns (bytes32 _value);\n function ovmSSTORE(bytes32 _key, bytes32 _value) external;\n\n\n /*************************\n * Contract Code Opcodes *\n *************************/\n\n function ovmEXTCODECOPY(address _contract, uint256 _offset, uint256 _length) external returns (bytes memory _code);\n function ovmEXTCODESIZE(address _contract) external returns (uint256 _size);\n function ovmEXTCODEHASH(address _contract) external returns (bytes32 _hash);\n\n\n /**************************************\n * Public Functions: Execution Safety *\n **************************************/\n\n function safeCREATE(address _address, bytes memory _bytecode) external;\n\n /***************************************\n * Public Functions: Execution Context *\n ***************************************/\n\n function getMaxTransactionGasLimit() external view returns (uint _maxTransactionGasLimit);\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateManager\n */\ninterface iOVM_StateManager {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum ItemState {\n ITEM_UNTOUCHED,\n ITEM_LOADED,\n ITEM_CHANGED,\n ITEM_COMMITTED\n }\n\n /***************************\n * Public Functions: Misc *\n ***************************/\n\n function isAuthenticated(address _address) external view returns (bool);\n\n /***************************\n * Public Functions: Setup *\n ***************************/\n\n function owner() external view returns (address _owner);\n function ovmExecutionManager() external view returns (address _ovmExecutionManager);\n function setExecutionManager(address _ovmExecutionManager) external;\n\n\n /************************************\n * Public Functions: Account Access *\n ************************************/\n\n function putAccount(address _address, Lib_OVMCodec.Account memory _account) external;\n function putEmptyAccount(address _address) external;\n function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account);\n function hasAccount(address _address) external view returns (bool _exists);\n function hasEmptyAccount(address _address) external view returns (bool _exists);\n function setAccountNonce(address _address, uint256 _nonce) external;\n function getAccountNonce(address _address) external view returns (uint256 _nonce);\n function getAccountEthAddress(address _address) external view returns (address _ethAddress);\n function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot);\n function initPendingAccount(address _address) external;\n function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external;\n function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded);\n function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged);\n function commitAccount(address _address) external returns (bool _wasAccountCommitted);\n function incrementTotalUncommittedAccounts() external;\n function getTotalUncommittedAccounts() external view returns (uint256 _total);\n function wasAccountChanged(address _address) external view returns (bool);\n function wasAccountCommitted(address _address) external view returns (bool);\n\n\n /************************************\n * Public Functions: Storage Access *\n ************************************/\n\n function putContractStorage(address _contract, bytes32 _key, bytes32 _value) external;\n function getContractStorage(address _contract, bytes32 _key) external view returns (bytes32 _value);\n function hasContractStorage(address _contract, bytes32 _key) external view returns (bool _exists);\n function testAndSetContractStorageLoaded(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyLoaded);\n function testAndSetContractStorageChanged(address _contract, bytes32 _key) external returns (bool _wasContractStorageAlreadyChanged);\n function commitContractStorage(address _contract, bytes32 _key) external returns (bool _wasContractStorageCommitted);\n function incrementTotalUncommittedContractStorage() external;\n function getTotalUncommittedContractStorage() external view returns (uint256 _total);\n function wasContractStorageChanged(address _contract, bytes32 _key) external view returns (bool);\n function wasContractStorageCommitted(address _contract, bytes32 _key) external view returns (bool);\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/execution/iOVM_SafetyChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_SafetyChecker\n */\ninterface iOVM_SafetyChecker {\n\n /********************\n * Public Functions *\n ********************/\n\n function isBytecodeSafe(bytes calldata _bytecode) external pure returns (bool);\n}\n" - }, - "contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_ProxyEOA\n * @dev The Proxy EOA contract uses a delegate call to execute the logic in an implementation contract.\n * In combination with the logic implemented in the ECDSA Contract Account, this enables a form of upgradable \n * 'account abstraction' on layer 2. \n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ProxyEOA {\n\n bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _implementation\n )\n public\n {\n _setImplementation(_implementation);\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n (bool success, bytes memory returndata) = Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\n gasleft(),\n getImplementation(),\n msg.data\n );\n\n if (success) {\n assembly {\n return(add(returndata, 0x20), mload(returndata))\n }\n } else {\n Lib_SafeExecutionManagerWrapper.safeREVERT(\n string(returndata)\n );\n }\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function upgrade(\n address _implementation\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_SafeExecutionManagerWrapper.safeADDRESS() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\n \"EOAs can only upgrade their own EOA implementation\"\n );\n\n _setImplementation(_implementation);\n }\n\n function getImplementation()\n public\n returns (\n address _implementation\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n IMPLEMENTATION_KEY\n )\n )));\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n IMPLEMENTATION_KEY,\n bytes32(uint256(uint160(_implementation)))\n );\n }\n}" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_DeployerWhitelist.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\n\n/* Interface Imports */\nimport { iOVM_DeployerWhitelist } from \"../../iOVM/precompiles/iOVM_DeployerWhitelist.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_DeployerWhitelist\n * @dev The Deployer Whitelist is a temporary predeploy used to provide additional safety during the\n * initial phases of our mainnet roll out. It is owned by the Optimism team, and defines accounts\n * which are allowed to deploy contracts on Layer2. The Execution Manager will only allow an \n * ovmCREATE or ovmCREATE2 operation to proceed if the deployer's address whitelisted.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_DeployerWhitelist is iOVM_DeployerWhitelist {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bytes32 internal constant KEY_INITIALIZED = 0x0000000000000000000000000000000000000000000000000000000000000010;\n bytes32 internal constant KEY_OWNER = 0x0000000000000000000000000000000000000000000000000000000000000011;\n bytes32 internal constant KEY_ALLOW_ARBITRARY_DEPLOYMENT = 0x0000000000000000000000000000000000000000000000000000000000000012;\n\n\n /**********************\n * Function Modifiers *\n **********************/\n \n /**\n * Blocks functions to anyone except the contract owner.\n */\n modifier onlyOwner() {\n address owner = Lib_Bytes32Utils.toAddress(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n KEY_OWNER\n )\n );\n\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n Lib_SafeExecutionManagerWrapper.safeCALLER() == owner,\n \"Function can only be called by the owner of this contract.\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n \n /**\n * Initializes the whitelist.\n * @param _owner Address of the owner for this contract.\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\n */\n function initialize(\n address _owner,\n bool _allowArbitraryDeployment\n )\n override\n public\n {\n bool initialized = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\n );\n\n if (initialized == true) {\n return;\n }\n\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_INITIALIZED,\n Lib_Bytes32Utils.fromBool(true)\n );\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_OWNER,\n Lib_Bytes32Utils.fromAddress(_owner)\n );\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\n );\n }\n\n /**\n * Gets the owner of the whitelist.\n */\n function getOwner()\n override\n public\n returns(\n address\n )\n {\n return Lib_Bytes32Utils.toAddress(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n KEY_OWNER\n )\n );\n }\n\n /**\n * Adds or removes an address from the deployment whitelist.\n * @param _deployer Address to update permissions for.\n * @param _isWhitelisted Whether or not the address is whitelisted.\n */\n function setWhitelistedDeployer(\n address _deployer,\n bool _isWhitelisted\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n Lib_Bytes32Utils.fromAddress(_deployer),\n Lib_Bytes32Utils.fromBool(_isWhitelisted)\n );\n }\n\n /**\n * Updates the owner of this contract.\n * @param _owner Address of the new owner.\n */\n function setOwner(\n address _owner\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_OWNER,\n Lib_Bytes32Utils.fromAddress(_owner)\n );\n }\n\n /**\n * Updates the arbitrary deployment flag.\n * @param _allowArbitraryDeployment Whether or not to allow arbitrary contract deployment.\n */\n function setAllowArbitraryDeployment(\n bool _allowArbitraryDeployment\n )\n override\n public\n onlyOwner\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n KEY_ALLOW_ARBITRARY_DEPLOYMENT,\n Lib_Bytes32Utils.fromBool(_allowArbitraryDeployment)\n );\n }\n\n /**\n * Permanently enables arbitrary contract deployment and deletes the owner.\n */\n function enableArbitraryContractDeployment()\n override\n public\n onlyOwner\n {\n setAllowArbitraryDeployment(true);\n setOwner(address(0));\n }\n\n /**\n * Checks whether an address is allowed to deploy contracts.\n * @param _deployer Address to check.\n * @return _allowed Whether or not the address can deploy contracts.\n */\n function isDeployerAllowed(\n address _deployer\n )\n override\n public\n returns (\n bool _allowed\n )\n {\n bool initialized = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_INITIALIZED)\n );\n\n if (initialized == false) {\n return true;\n }\n\n bool allowArbitraryDeployment = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(KEY_ALLOW_ARBITRARY_DEPLOYMENT)\n );\n\n if (allowArbitraryDeployment == true) {\n return true;\n }\n\n bool isWhitelisted = Lib_Bytes32Utils.toBool(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n Lib_Bytes32Utils.fromAddress(_deployer)\n )\n );\n\n return isWhitelisted; \n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/resolver/Lib_AddressManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { Ownable } from \"./Lib_Ownable.sol\";\n\n/**\n * @title Lib_AddressManager\n */\ncontract Lib_AddressManager is Ownable {\n\n /**********\n * Events *\n **********/\n\n event AddressSet(\n string _name,\n address _newAddress\n );\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n mapping (bytes32 => address) private addresses;\n\n\n /********************\n * Public Functions *\n ********************/\n\n function setAddress(\n string memory _name,\n address _address\n )\n public\n onlyOwner\n {\n emit AddressSet(_name, _address);\n addresses[_getNameHash(_name)] = _address;\n }\n\n function getAddress(\n string memory _name\n )\n public\n view\n returns (address)\n {\n return addresses[_getNameHash(_name)];\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _getNameHash(\n string memory _name\n )\n internal\n pure\n returns (\n bytes32 _hash\n )\n {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/resolver/Lib_Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Ownable\n * @dev Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\n */\nabstract contract Ownable {\n\n /*************\n * Variables *\n *************/\n\n address public owner;\n\n\n /**********\n * Events *\n **********/\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n\n /***************\n * Constructor *\n ***************/\n\n constructor() internal {\n owner = msg.sender;\n emit OwnershipTransferred(address(0), owner);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n owner == msg.sender,\n \"Ownable: caller is not the owner\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function renounceOwnership()\n public\n virtual\n onlyOwner\n {\n emit OwnershipTransferred(owner, address(0));\n owner = address(0);\n }\n\n function transferOwnership(address _newOwner)\n public\n virtual\n onlyOwner\n {\n require(\n _newOwner != address(0),\n \"Ownable: new owner cannot be the zero address\"\n );\n\n emit OwnershipTransferred(owner, _newOwner);\n owner = _newOwner;\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_DeployerWhitelist.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_DeployerWhitelist\n */\ninterface iOVM_DeployerWhitelist {\n\n /********************\n * Public Functions *\n ********************/\n\n function initialize(address _owner, bool _allowArbitraryDeployment) external;\n function getOwner() external returns (address _owner);\n function setWhitelistedDeployer(address _deployer, bool _isWhitelisted) external;\n function setOwner(address _newOwner) external;\n function setAllowArbitraryDeployment(bool _allowArbitraryDeployment) external;\n function enableArbitraryContractDeployment() external;\n function isDeployerAllowed(address _deployer) external returns (bool _allowed);\n}\n" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_SequencerEntrypoint.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_SequencerEntrypoint\n * @dev The Sequencer Entrypoint is a predeploy which, despite its name, can in fact be called by \n * any account. It accepts a more efficient compressed calldata format, which it decompresses and \n * encodes to the standard EIP155 transaction format.\n * This contract is the implementation referenced by the Proxy Sequencer Entrypoint, thus enabling\n * the Optimism team to upgrade the decompression of calldata from the Sequencer.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_SequencerEntrypoint {\n\n /*********\n * Enums *\n *********/\n \n enum TransactionType {\n NATIVE_ETH_TRANSACTION,\n ETH_SIGNED_MESSAGE\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n /**\n * Uses a custom \"compressed\" format to save on calldata gas:\n * calldata[00:01]: transaction type (0 == EIP 155, 2 == Eth Sign Message)\n * calldata[01:33]: signature \"r\" parameter\n * calldata[33:65]: signature \"s\" parameter\n * calldata[65:66]: signature \"v\" parameter\n * calldata[66:69]: transaction gas limit\n * calldata[69:72]: transaction gas price\n * calldata[72:75]: transaction nonce\n * calldata[75:95]: transaction target address\n * calldata[95:XX]: transaction data\n */\n fallback()\n external\n {\n TransactionType transactionType = _getTransactionType(Lib_BytesUtils.toUint8(msg.data, 0));\n\n bytes32 r = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 1, 32));\n bytes32 s = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 33, 32));\n uint8 v = Lib_BytesUtils.toUint8(msg.data, 65);\n\n // Remainder is the transaction to execute.\n bytes memory compressedTx = Lib_BytesUtils.slice(msg.data, 66);\n bool isEthSignedMessage = transactionType == TransactionType.ETH_SIGNED_MESSAGE;\n\n // Need to decompress and then re-encode the transaction based on the original encoding.\n bytes memory encodedTx = Lib_OVMCodec.encodeEIP155Transaction(\n Lib_OVMCodec.decompressEIP155Transaction(compressedTx),\n isEthSignedMessage\n );\n\n address target = Lib_ECDSAUtils.recover(\n encodedTx,\n isEthSignedMessage,\n uint8(v),\n r,\n s\n );\n\n if (Lib_SafeExecutionManagerWrapper.safeEXTCODESIZE(target) == 0) {\n // ProxyEOA has not yet been deployed for this EOA.\n bytes32 messageHash = Lib_ECDSAUtils.getMessageHash(encodedTx, isEthSignedMessage);\n Lib_SafeExecutionManagerWrapper.safeCREATEEOA(messageHash, uint8(v), r, s);\n }\n\n // ProxyEOA has been deployed for this EOA, continue to CALL.\n bytes memory callbytes = abi.encodeWithSignature(\n \"execute(bytes,uint8,uint8,bytes32,bytes32)\",\n encodedTx,\n isEthSignedMessage,\n uint8(v),\n r,\n s\n );\n\n Lib_SafeExecutionManagerWrapper.safeCALL(\n gasleft(),\n target,\n callbytes\n );\n }\n \n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Converts a uint256 into a TransactionType enum.\n * @param _transactionType Transaction type index.\n * @return Transaction type enum value.\n */\n function _getTransactionType(\n uint8 _transactionType\n )\n internal\n returns (\n TransactionType\n )\n {\n if (_transactionType == 0) {\n return TransactionType.NATIVE_ETH_TRANSACTION;\n } if (_transactionType == 2) {\n return TransactionType.ETH_SIGNED_MESSAGE;\n } else {\n Lib_SafeExecutionManagerWrapper.safeREVERT(\n \"Transaction type must be 0 or 2\"\n );\n }\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_ECDSAUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_ECDSAUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_ECDSAUtils.sol\";\n\n/**\n * @title TestLib_ECDSAUtils\n */\ncontract TestLib_ECDSAUtils {\n\n function recover(\n bytes memory _message,\n bool _isEthSignedMessage,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n public\n pure\n returns (\n address _sender\n )\n {\n return Lib_ECDSAUtils.recover(\n _message,\n _isEthSignedMessage,\n _v,\n _r,\n _s\n );\n }\n}\n" - }, - "contracts/test-libraries/codec/TestLib_OVMCodec.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../optimistic-ethereum/libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title TestLib_OVMCodec\n */\ncontract TestLib_OVMCodec {\n\n function decodeEIP155Transaction(\n bytes memory _transaction,\n bool _isEthSignedMessage\n )\n public\n pure\n returns (\n Lib_OVMCodec.EIP155Transaction memory _decoded\n )\n {\n return Lib_OVMCodec.decodeEIP155Transaction(_transaction, _isEthSignedMessage);\n }\n\n function encodeTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n public\n pure\n returns (\n bytes memory _encoded\n )\n {\n return Lib_OVMCodec.encodeTransaction(_transaction);\n }\n\n function hashTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n public\n pure\n returns (\n bytes32 _hash\n )\n {\n return Lib_OVMCodec.hashTransaction(_transaction);\n }\n\n function decompressEIP155Transaction(\n bytes memory _transaction\n )\n public\n returns (\n Lib_OVMCodec.EIP155Transaction memory _decompressed\n )\n {\n return Lib_OVMCodec.decompressEIP155Transaction(_transaction);\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitioner.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_EthUtils } from \"../../libraries/utils/Lib_EthUtils.sol\";\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_RLPWriter } from \"../../libraries/rlp/Lib_RLPWriter.sol\";\nimport { Lib_RLPReader } from \"../../libraries/rlp/Lib_RLPReader.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_StateManagerFactory } from \"../../iOVM/execution/iOVM_StateManagerFactory.sol\";\n\n/* Contract Imports */\nimport { Abs_FraudContributor } from \"./Abs_FraudContributor.sol\";\n\n/**\n * @title OVM_StateTransitioner\n * @dev The State Transitioner coordinates the execution of a state transition during the evaluation of a\n * fraud proof. It feeds verified input to the Execution Manager's run(), and controls a State Manager (which is\n * uniquely created for each fraud proof).\n * Once a fraud proof has been initialized, this contract is provided with the pre-state root and verifies\n * that the OVM storage slots committed to the State Mangager are contained in that state\n * This contract controls the State Manager and Execution Manager, and uses them to calculate the\n * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by comparing\n * the calculated post-state root with the proposed post-state root.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum TransitionPhase {\n PRE_EXECUTION,\n POST_EXECUTION,\n COMPLETE\n }\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n iOVM_StateManager public ovmStateManager;\n\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n bytes32 internal preStateRoot;\n bytes32 internal postStateRoot;\n TransitionPhase public phase;\n uint256 internal stateTransitionIndex;\n bytes32 internal transactionHash;\n\n\n /*************\n * Constants *\n *************/\n\n bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n * @param _stateTransitionIndex Index of the state transition being verified.\n * @param _preStateRoot State root before the transition was executed.\n * @param _transactionHash Hash of the executed transaction.\n */\n constructor(\n address _libAddressManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n stateTransitionIndex = _stateTransitionIndex;\n preStateRoot = _preStateRoot;\n postStateRoot = _preStateRoot;\n transactionHash = _transactionHash;\n\n ovmStateManager = iOVM_StateManagerFactory(resolve(\"OVM_StateManagerFactory\")).create(address(this));\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Checks that a function is only run during a specific phase.\n * @param _phase Phase the function must run within.\n */\n modifier onlyDuringPhase(\n TransitionPhase _phase\n ) {\n require(\n phase == _phase,\n \"Function must be called during the correct phase.\"\n );\n _;\n }\n\n\n /**********************************\n * Public Functions: State Access *\n **********************************/\n\n /**\n * Retrieves the state root before execution.\n * @return _preStateRoot State root before execution.\n */\n function getPreStateRoot()\n override\n public\n view\n returns (\n bytes32 _preStateRoot\n )\n {\n return preStateRoot;\n }\n\n /**\n * Retrieves the state root after execution.\n * @return _postStateRoot State root after execution.\n */\n function getPostStateRoot()\n override\n public\n view\n returns (\n bytes32 _postStateRoot\n )\n {\n return postStateRoot;\n }\n\n /**\n * Checks whether the transitioner is complete.\n * @return _complete Whether or not the transition process is finished.\n */\n function isComplete()\n override\n public\n view\n returns (\n bool _complete\n )\n {\n return phase == TransitionPhase.COMPLETE;\n }\n \n\n /***********************************\n * Public Functions: Pre-Execution *\n ***********************************/\n\n /**\n * Allows a user to prove the initial state of a contract.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _ethContractAddress Address of the corresponding contract on L1.\n * @param _stateTrieWitness Proof of the account state.\n */\n function proveContractState(\n address _ovmContractAddress,\n address _ethContractAddress,\n bytes memory _stateTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n // Exit quickly to avoid unnecessary work.\n require(\n (\n ovmStateManager.hasAccount(_ovmContractAddress) == false\n && ovmStateManager.hasEmptyAccount(_ovmContractAddress) == false\n ),\n \"Account state has already been proven.\"\n );\n\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\n (\n bool exists,\n bytes memory encodedAccount\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(_ovmContractAddress),\n _stateTrieWitness,\n preStateRoot\n );\n\n if (exists == true) {\n // Account exists, this was an inclusion proof.\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedAccount\n );\n\n address ethContractAddress = _ethContractAddress;\n if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) {\n // Use a known empty contract to prevent an attack in which a user provides a\n // contract address here and then later deploys code to it.\n ethContractAddress = 0x0000000000000000000000000000000000000000;\n } else {\n // Otherwise, make sure that the code at the provided eth address matches the hash\n // of the code stored on L2.\n require(\n Lib_EthUtils.getCodeHash(ethContractAddress) == account.codeHash,\n \"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash.\"\n );\n }\n\n ovmStateManager.putAccount(\n _ovmContractAddress,\n Lib_OVMCodec.Account({\n nonce: account.nonce,\n balance: account.balance,\n storageRoot: account.storageRoot,\n codeHash: account.codeHash,\n ethAddress: ethContractAddress,\n isFresh: false\n })\n );\n } else {\n // Account does not exist, this was an exclusion proof.\n ovmStateManager.putEmptyAccount(_ovmContractAddress);\n }\n }\n\n /**\n * Allows a user to prove the initial state of a contract storage slot.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _key Claimed account slot key.\n * @param _storageTrieWitness Proof of the storage slot.\n */\n function proveStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes memory _storageTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n // Exit quickly to avoid unnecessary work.\n require(\n ovmStateManager.hasContractStorage(_ovmContractAddress, _key) == false,\n \"Storage slot has already been proven.\"\n );\n\n require(\n ovmStateManager.hasAccount(_ovmContractAddress) == true,\n \"Contract must be verified before proving a storage slot.\"\n );\n\n bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress);\n bytes32 value;\n\n if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) {\n // Storage trie was empty, so the user is always allowed to insert zero-byte values.\n value = bytes32(0);\n } else {\n // Function will fail if the proof is not a valid inclusion or exclusion proof.\n (\n bool exists,\n bytes memory encodedValue\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(_key),\n _storageTrieWitness,\n storageRoot\n );\n\n if (exists == true) {\n // Inclusion proof.\n // Stored values are RLP encoded, with leading zeros removed.\n value = Lib_BytesUtils.toBytes32PadLeft(\n Lib_RLPReader.readBytes(encodedValue)\n );\n } else {\n // Exclusion proof, can only be zero bytes.\n value = bytes32(0);\n }\n }\n\n ovmStateManager.putContractStorage(\n _ovmContractAddress,\n _key,\n value\n );\n }\n\n\n /*******************************\n * Public Functions: Execution *\n *******************************/\n\n /**\n * Executes the state transition.\n * @param _transaction OVM transaction to execute.\n */\n function applyTransaction(\n Lib_OVMCodec.Transaction memory _transaction\n )\n override\n public\n onlyDuringPhase(TransitionPhase.PRE_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n Lib_OVMCodec.hashTransaction(_transaction) == transactionHash,\n \"Invalid transaction provided.\"\n );\n\n // We require gas to complete the logic here in run() before/after execution,\n // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism)\n // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first \n // going into EM, then going into the code contract).\n require(\n gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, // 1032/1000 = 1.032 = (64/63)^2 rounded up\n \"Not enough gas to execute transaction deterministically.\"\n );\n\n iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve(\"OVM_ExecutionManager\"));\n\n // We call `setExecutionManager` right before `run` (and not earlier) just in case the\n // OVM_ExecutionManager address was updated between the time when this contract was created\n // and when `applyTransaction` was called.\n ovmStateManager.setExecutionManager(address(ovmExecutionManager));\n\n // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction`\n // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line\n // if that's the case.\n ovmExecutionManager.run(_transaction, address(ovmStateManager));\n\n phase = TransitionPhase.POST_EXECUTION;\n }\n\n\n /************************************\n * Public Functions: Post-Execution *\n ************************************/\n\n /**\n * Allows a user to commit the final state of a contract.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _stateTrieWitness Proof of the account state.\n */\n function commitContractState(\n address _ovmContractAddress,\n bytes memory _stateTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\n \"All storage must be committed before committing account states.\"\n );\n\n require (\n ovmStateManager.commitAccount(_ovmContractAddress) == true,\n \"Account state wasn't changed or has already been committed.\"\n );\n\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\n\n postStateRoot = Lib_SecureMerkleTrie.update(\n abi.encodePacked(_ovmContractAddress),\n Lib_OVMCodec.encodeEVMAccount(\n Lib_OVMCodec.toEVMAccount(account)\n ),\n _stateTrieWitness,\n postStateRoot\n );\n\n // Emit an event to help clients figure out the proof ordering.\n emit AccountCommitted(\n _ovmContractAddress\n );\n }\n\n /**\n * Allows a user to commit the final state of a contract storage slot.\n * @param _ovmContractAddress Address of the contract on the OVM.\n * @param _key Claimed account slot key.\n * @param _storageTrieWitness Proof of the storage slot.\n */\n function commitStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes memory _storageTrieWitness\n )\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n contributesToFraudProof(preStateRoot, transactionHash)\n {\n require(\n ovmStateManager.commitContractStorage(_ovmContractAddress, _key) == true,\n \"Storage slot value wasn't changed or has already been committed.\"\n );\n\n Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress);\n bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key);\n\n account.storageRoot = Lib_SecureMerkleTrie.update(\n abi.encodePacked(_key),\n Lib_RLPWriter.writeBytes(\n Lib_Bytes32Utils.removeLeadingZeros(value)\n ),\n _storageTrieWitness,\n account.storageRoot\n );\n\n ovmStateManager.putAccount(_ovmContractAddress, account);\n\n // Emit an event to help clients figure out the proof ordering.\n emit ContractStorageCommitted(\n _ovmContractAddress,\n _key\n );\n }\n\n\n /**********************************\n * Public Functions: Finalization *\n **********************************/\n\n /**\n * Finalizes the transition process.\n */\n function completeTransition()\n override\n public\n onlyDuringPhase(TransitionPhase.POST_EXECUTION)\n {\n require(\n ovmStateManager.getTotalUncommittedAccounts() == 0,\n \"All accounts must be committed before completing a transition.\"\n );\n\n require(\n ovmStateManager.getTotalUncommittedContractStorage() == 0,\n \"All storage must be committed before completing a transition.\"\n );\n\n phase = TransitionPhase.COMPLETE;\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"./Lib_MerkleTrie.sol\";\n\n/**\n * @title Lib_SecureMerkleTrie\n */\nlibrary Lib_SecureMerkleTrie {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Verifies a proof that a given key/value pair is present in the\n * Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _value Value of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\n * traditional Merkle trees, this proof is executed top-down and consists\n * of a list of RLP-encoded nodes that make a path down to the target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\n */\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root);\n }\n\n /**\n * @notice Verifies a proof that a given key is *not* present in\n * the Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the key is not present in the trie, `false` otherwise.\n */\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root);\n }\n\n /**\n * @notice Updates a Merkle trie and returns a new root hash.\n * @param _key Key of the node to update, as a hex string.\n * @param _value Value of the node to update, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node. If the key exists, we can simply update the value.\n * Otherwise, we need to modify the trie to handle the new k/v pair.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _updatedRoot Root hash of the newly constructed trie.\n */\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.update(key, _value, _proof, _root);\n }\n\n /**\n * @notice Retrieves the value associated with a given key.\n * @param _key Key to search for, as hex bytes.\n * @param _proof Merkle trie inclusion proof for the key.\n * @param _root Known root of the Merkle trie.\n * @return _exists Whether or not the key exists.\n * @return _value Value of the key if it exists.\n */\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _exists,\n bytes memory _value\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.get(key, _proof, _root);\n }\n\n /**\n * Computes the root hash for a trie with a single node.\n * @param _key Key for the single node.\n * @param _value Value for the single node.\n * @return _updatedRoot Hash of the trie.\n */\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.getSingleNodeRootHash(key, _value);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Computes the secure counterpart to a key.\n * @param _key Key to get a secure key from.\n * @return _secureKey Secure version of the key.\n */\n function _getSecureKey(\n bytes memory _key\n )\n private\n pure\n returns (\n bytes memory _secureKey\n )\n {\n return abi.encodePacked(keccak256(_key));\n }\n}" - }, - "contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitioner.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateTransitioner\n */\ninterface iOVM_StateTransitioner {\n\n /**********\n * Events *\n **********/\n\n event AccountCommitted(\n address _address\n );\n\n event ContractStorageCommitted(\n address _address,\n bytes32 _key\n );\n\n\n /**********************************\n * Public Functions: State Access *\n **********************************/\n\n function getPreStateRoot() external view returns (bytes32 _preStateRoot);\n function getPostStateRoot() external view returns (bytes32 _postStateRoot);\n function isComplete() external view returns (bool _complete);\n\n\n /***********************************\n * Public Functions: Pre-Execution *\n ***********************************/\n\n function proveContractState(\n address _ovmContractAddress,\n address _ethContractAddress,\n bytes calldata _stateTrieWitness\n ) external;\n\n function proveStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes calldata _storageTrieWitness\n ) external;\n\n\n /*******************************\n * Public Functions: Execution *\n *******************************/\n\n function applyTransaction(\n Lib_OVMCodec.Transaction calldata _transaction\n ) external;\n\n\n /************************************\n * Public Functions: Post-Execution *\n ************************************/\n\n function commitContractState(\n address _ovmContractAddress,\n bytes calldata _stateTrieWitness\n ) external;\n\n function commitStorageSlot(\n address _ovmContractAddress,\n bytes32 _key,\n bytes calldata _storageTrieWitness\n ) external;\n\n\n /**********************************\n * Public Functions: Finalization *\n **********************************/\n\n function completeTransition() external;\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/verification/iOVM_BondManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\ninterface ERC20 {\n function transfer(address, uint256) external returns (bool);\n function transferFrom(address, address, uint256) external returns (bool);\n}\n\n/// All the errors which may be encountered on the bond manager\nlibrary Errors {\n string constant ERC20_ERR = \"BondManager: Could not post bond\";\n string constant ALREADY_FINALIZED = \"BondManager: Fraud proof for this pre-state root has already been finalized\";\n string constant SLASHED = \"BondManager: Cannot finalize withdrawal, you probably got slashed\";\n string constant WRONG_STATE = \"BondManager: Wrong bond state for proposer\";\n string constant CANNOT_CLAIM = \"BondManager: Cannot claim yet. Dispute must be finalized first\";\n\n string constant WITHDRAWAL_PENDING = \"BondManager: Withdrawal already pending\";\n string constant TOO_EARLY = \"BondManager: Too early to finalize your withdrawal\";\n\n string constant ONLY_TRANSITIONER = \"BondManager: Only the transitioner for this pre-state root may call this function\";\n string constant ONLY_FRAUD_VERIFIER = \"BondManager: Only the fraud verifier may call this function\";\n string constant ONLY_STATE_COMMITMENT_CHAIN = \"BondManager: Only the state commitment chain may call this function\";\n string constant WAIT_FOR_DISPUTES = \"BondManager: Wait for other potential disputes\";\n}\n\n/**\n * @title iOVM_BondManager\n */\ninterface iOVM_BondManager {\n\n /*******************\n * Data Structures *\n *******************/\n\n /// The lifecycle of a proposer's bond\n enum State {\n // Before depositing or after getting slashed, a user is uncollateralized\n NOT_COLLATERALIZED,\n // After depositing, a user is collateralized\n COLLATERALIZED,\n // After a user has initiated a withdrawal\n WITHDRAWING\n }\n\n /// A bond posted by a proposer\n struct Bond {\n // The user's state\n State state;\n // The timestamp at which a proposer issued their withdrawal request\n uint32 withdrawalTimestamp;\n // The time when the first disputed was initiated for this bond\n uint256 firstDisputeAt;\n // The earliest observed state root for this bond which has had fraud\n bytes32 earliestDisputedStateRoot;\n // The state root's timestamp\n uint256 earliestTimestamp;\n }\n\n // Per pre-state root, store the number of state provisions that were made\n // and how many of these calls were made by each user. Payouts will then be\n // claimed by users proportionally for that dispute.\n struct Rewards {\n // Flag to check if rewards for a fraud proof are claimable\n bool canClaim;\n // Total number of `recordGasSpent` calls made\n uint256 total;\n // The gas spent by each user to provide witness data. The sum of all\n // values inside this map MUST be equal to the value of `total`\n mapping(address => uint256) gasSpent;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function recordGasSpent(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n address _who,\n uint256 _gasSpent\n ) external;\n\n function finalize(\n bytes32 _preStateRoot,\n address _publisher,\n uint256 _timestamp\n ) external;\n\n function deposit() external;\n\n function startWithdrawal() external;\n\n function finalizeWithdrawal() external;\n\n function claim(\n address _who\n ) external;\n\n function isCollateralized(\n address _who\n ) external view returns (bool);\n\n function getGasSpent(\n bytes32 _preStateRoot,\n address _who\n ) external view returns (uint256);\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/execution/iOVM_StateManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { iOVM_StateManager } from \"./iOVM_StateManager.sol\";\n\n/**\n * @title iOVM_StateManagerFactory\n */\ninterface iOVM_StateManagerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n function create(\n address _owner\n )\n external\n returns (\n iOVM_StateManager _ovmStateManager\n );\n}\n" - }, - "contracts/optimistic-ethereum/OVM/verification/Abs_FraudContributor.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/// Minimal contract to be inherited by contracts consumed by users that provide\n/// data for fraud proofs\nabstract contract Abs_FraudContributor is Lib_AddressResolver {\n /// Decorate your functions with this modifier to store how much total gas was\n /// consumed by the sender, to reward users fairly\n modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {\n uint256 startGas = gasleft();\n _;\n uint256 gasSpent = startGas - gasleft();\n iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../utils/Lib_BytesUtils.sol\";\nimport { Lib_RLPReader } from \"../rlp/Lib_RLPReader.sol\";\nimport { Lib_RLPWriter } from \"../rlp/Lib_RLPWriter.sol\";\n\n/**\n * @title Lib_MerkleTrie\n */\nlibrary Lib_MerkleTrie {\n\n /*******************\n * Data Structures *\n *******************/\n\n enum NodeType {\n BranchNode,\n ExtensionNode,\n LeafNode\n }\n\n struct TrieNode {\n bytes encoded;\n Lib_RLPReader.RLPItem[] decoded;\n }\n\n\n /**********************\n * Contract Constants *\n **********************/\n\n // TREE_RADIX determines the number of elements per branch node.\n uint256 constant TREE_RADIX = 16;\n // Branch nodes have TREE_RADIX elements plus an additional `value` slot.\n uint256 constant BRANCH_NODE_LENGTH = TREE_RADIX + 1;\n // Leaf nodes and extension nodes always have two elements, a `path` and a `value`.\n uint256 constant LEAF_OR_EXTENSION_NODE_LENGTH = 2;\n\n // Prefixes are prepended to the `path` within a leaf or extension node and\n // allow us to differentiate between the two node types. `ODD` or `EVEN` is\n // determined by the number of nibbles within the unprefixed `path`. If the\n // number of nibbles if even, we need to insert an extra padding nibble so\n // the resulting prefixed `path` has an even number of nibbles.\n uint8 constant PREFIX_EXTENSION_EVEN = 0;\n uint8 constant PREFIX_EXTENSION_ODD = 1;\n uint8 constant PREFIX_LEAF_EVEN = 2;\n uint8 constant PREFIX_LEAF_ODD = 3;\n\n // Just a utility constant. RLP represents `NULL` as 0x80.\n bytes1 constant RLP_NULL = bytes1(0x80);\n bytes constant RLP_NULL_BYTES = hex'80';\n bytes32 constant internal KECCAK256_RLP_NULL_BYTES = keccak256(RLP_NULL_BYTES);\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Verifies a proof that a given key/value pair is present in the\n * Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _value Value of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the desired node. Unlike\n * traditional Merkle trees, this proof is executed top-down and consists\n * of a list of RLP-encoded nodes that make a path down to the target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the k/v pair exists in the trie, `false` otherwise.\n */\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n (\n bool exists,\n bytes memory value\n ) = get(_key, _proof, _root);\n\n return (\n exists && Lib_BytesUtils.equal(_value, value)\n );\n }\n\n /**\n * @notice Verifies a proof that a given key is *not* present in\n * the Merkle trie.\n * @param _key Key of the node to search for, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _verified `true` if the key is absent in the trie, `false` otherwise.\n */\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _verified\n )\n {\n (\n bool exists,\n ) = get(_key, _proof, _root);\n\n return exists == false;\n }\n\n /**\n * @notice Updates a Merkle trie and returns a new root hash.\n * @param _key Key of the node to update, as a hex string.\n * @param _value Value of the node to update, as a hex string.\n * @param _proof Merkle trie inclusion proof for the node *nearest* the\n * target node. If the key exists, we can simply update the value.\n * Otherwise, we need to modify the trie to handle the new k/v pair.\n * @param _root Known root of the Merkle trie. Used to verify that the\n * included proof is correctly constructed.\n * @return _updatedRoot Root hash of the newly constructed trie.\n */\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n // Special case when inserting the very first node.\n if (_root == KECCAK256_RLP_NULL_BYTES) {\n return getSingleNodeRootHash(_key, _value);\n }\n\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, ) = _walkNodePath(proof, _key, _root);\n TrieNode[] memory newPath = _getNewPath(proof, pathLength, keyRemainder, _value);\n\n return _getUpdatedTrieRoot(newPath, _key);\n }\n\n /**\n * @notice Retrieves the value associated with a given key.\n * @param _key Key to search for, as hex bytes.\n * @param _proof Merkle trie inclusion proof for the key.\n * @param _root Known root of the Merkle trie.\n * @return _exists Whether or not the key exists.\n * @return _value Value of the key if it exists.\n */\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n internal\n pure\n returns (\n bool _exists,\n bytes memory _value\n )\n {\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(proof, _key, _root);\n\n bool exists = keyRemainder.length == 0;\n\n require(\n exists || isFinalNode,\n \"Provided proof is invalid.\"\n );\n\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes('');\n\n return (\n exists,\n value\n );\n }\n\n /**\n * Computes the root hash for a trie with a single node.\n * @param _key Key for the single node.\n * @param _value Value for the single node.\n * @return _updatedRoot Hash of the trie.\n */\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n internal\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n return keccak256(_makeLeafNode(\n Lib_BytesUtils.toNibbles(_key),\n _value\n ).encoded);\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * @notice Walks through a proof using a provided key.\n * @param _proof Inclusion proof to walk through.\n * @param _key Key to use for the walk.\n * @param _root Known root of the trie.\n * @return _pathLength Length of the final path\n * @return _keyRemainder Portion of the key remaining after the walk.\n * @return _isFinalNode Whether or not we've hit a dead end.\n */\n function _walkNodePath(\n TrieNode[] memory _proof,\n bytes memory _key,\n bytes32 _root\n )\n private\n pure\n returns (\n uint256 _pathLength,\n bytes memory _keyRemainder,\n bool _isFinalNode\n )\n {\n uint256 pathLength = 0;\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\n\n bytes32 currentNodeID = _root;\n uint256 currentKeyIndex = 0;\n uint256 currentKeyIncrement = 0;\n TrieNode memory currentNode;\n\n // Proof is top-down, so we start at the first element (root).\n for (uint256 i = 0; i < _proof.length; i++) {\n currentNode = _proof[i];\n currentKeyIndex += currentKeyIncrement;\n\n // Keep track of the proof elements we actually need.\n // It's expensive to resize arrays, so this simply reduces gas costs.\n pathLength += 1;\n\n if (currentKeyIndex == 0) {\n // First proof element is always the root node.\n require(\n keccak256(currentNode.encoded) == currentNodeID,\n \"Invalid root hash\"\n );\n } else if (currentNode.encoded.length >= 32) {\n // Nodes 32 bytes or larger are hashed inside branch nodes.\n require(\n keccak256(currentNode.encoded) == currentNodeID,\n \"Invalid large internal hash\"\n );\n } else {\n // Nodes smaller than 31 bytes aren't hashed.\n require(\n Lib_BytesUtils.toBytes32(currentNode.encoded) == currentNodeID,\n \"Invalid internal node hash\"\n );\n }\n\n if (currentNode.decoded.length == BRANCH_NODE_LENGTH) {\n if (currentKeyIndex == key.length) {\n // We've hit the end of the key, meaning the value should be within this branch node.\n break;\n } else {\n // We're not at the end of the key yet.\n // Figure out what the next node ID should be and continue.\n uint8 branchKey = uint8(key[currentKeyIndex]);\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\n currentNodeID = _getNodeID(nextNode);\n currentKeyIncrement = 1;\n continue;\n }\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(currentNode);\n uint8 prefix = uint8(path[0]);\n uint8 offset = 2 - prefix % 2;\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n if (\n pathRemainder.length == sharedNibbleLength &&\n keyRemainder.length == sharedNibbleLength\n ) {\n // The key within this leaf matches our key exactly.\n // Increment the key index to reflect that we have no remainder.\n currentKeyIndex += sharedNibbleLength;\n }\n\n // We've hit a leaf node, so our next node should be NULL.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n if (sharedNibbleLength == 0) {\n // Our extension node doesn't share any part of our key.\n // We've hit the end of this path, updates will need to modify this extension.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else {\n // Our extension shares some nibbles.\n // Carry on to the next node.\n currentNodeID = _getNodeID(currentNode.decoded[1]);\n currentKeyIncrement = sharedNibbleLength;\n continue;\n }\n } else {\n revert(\"Received a node with an unknown prefix\");\n }\n } else {\n revert(\"Received an unparseable node.\");\n }\n }\n\n // If our node ID is NULL, then we're at a dead end.\n bool isFinalNode = currentNodeID == bytes32(RLP_NULL);\n return (pathLength, Lib_BytesUtils.slice(key, currentKeyIndex), isFinalNode);\n }\n\n /**\n * @notice Creates new nodes to support a k/v pair insertion into a given\n * Merkle trie path.\n * @param _path Path to the node nearest the k/v pair.\n * @param _pathLength Length of the path. Necessary because the provided\n * path may include additional nodes (e.g., it comes directly from a proof)\n * and we can't resize in-memory arrays without costly duplication.\n * @param _keyRemainder Portion of the initial key that must be inserted\n * into the trie.\n * @param _value Value to insert at the given key.\n * @return _newPath A new path with the inserted k/v pair and extra supporting nodes.\n */\n function _getNewPath(\n TrieNode[] memory _path,\n uint256 _pathLength,\n bytes memory _keyRemainder,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode[] memory _newPath\n )\n {\n bytes memory keyRemainder = _keyRemainder;\n\n // Most of our logic depends on the status of the last node in the path.\n TrieNode memory lastNode = _path[_pathLength - 1];\n NodeType lastNodeType = _getNodeType(lastNode);\n\n // Create an array for newly created nodes.\n // We need up to three new nodes, depending on the contents of the last node.\n // Since array resizing is expensive, we'll keep track of the size manually.\n // We're using an explicit `totalNewNodes += 1` after insertions for clarity.\n TrieNode[] memory newNodes = new TrieNode[](3);\n uint256 totalNewNodes = 0;\n\n if (keyRemainder.length == 0 && lastNodeType == NodeType.LeafNode) {\n // We've found a leaf node with the given key.\n // Simply need to update the value of the node to match.\n newNodes[totalNewNodes] = _makeLeafNode(_getNodeKey(lastNode), _value);\n totalNewNodes += 1;\n } else if (lastNodeType == NodeType.BranchNode) {\n if (keyRemainder.length == 0) {\n // We've found a branch node with the given key.\n // Simply need to update the value of the node to match.\n newNodes[totalNewNodes] = _editBranchValue(lastNode, _value);\n totalNewNodes += 1;\n } else {\n // We've found a branch node, but it doesn't contain our key.\n // Reinsert the old branch for now.\n newNodes[totalNewNodes] = lastNode;\n totalNewNodes += 1;\n // Create a new leaf node, slicing our remainder since the first byte points\n // to our branch node.\n newNodes[totalNewNodes] = _makeLeafNode(Lib_BytesUtils.slice(keyRemainder, 1), _value);\n totalNewNodes += 1;\n }\n } else {\n // Our last node is either an extension node or a leaf node with a different key.\n bytes memory lastNodeKey = _getNodeKey(lastNode);\n uint256 sharedNibbleLength = _getSharedNibbleLength(lastNodeKey, keyRemainder);\n\n if (sharedNibbleLength != 0) {\n // We've got some shared nibbles between the last node and our key remainder.\n // We'll need to insert an extension node that covers these shared nibbles.\n bytes memory nextNodeKey = Lib_BytesUtils.slice(lastNodeKey, 0, sharedNibbleLength);\n newNodes[totalNewNodes] = _makeExtensionNode(nextNodeKey, _getNodeHash(_value));\n totalNewNodes += 1;\n\n // Cut down the keys since we've just covered these shared nibbles.\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, sharedNibbleLength);\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, sharedNibbleLength);\n }\n\n // Create an empty branch to fill in.\n TrieNode memory newBranch = _makeEmptyBranchNode();\n\n if (lastNodeKey.length == 0) {\n // Key remainder was larger than the key for our last node.\n // The value within our last node is therefore going to be shifted into\n // a branch value slot.\n newBranch = _editBranchValue(newBranch, _getNodeValue(lastNode));\n } else {\n // Last node key was larger than the key remainder.\n // We're going to modify some index of our branch.\n uint8 branchKey = uint8(lastNodeKey[0]);\n // Move on to the next nibble.\n lastNodeKey = Lib_BytesUtils.slice(lastNodeKey, 1);\n\n if (lastNodeType == NodeType.LeafNode) {\n // We're dealing with a leaf node.\n // We'll modify the key and insert the old leaf node into the branch index.\n TrieNode memory modifiedLastNode = _makeLeafNode(lastNodeKey, _getNodeValue(lastNode));\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\n } else if (lastNodeKey.length != 0) {\n // We're dealing with a shrinking extension node.\n // We need to modify the node to decrease the size of the key.\n TrieNode memory modifiedLastNode = _makeExtensionNode(lastNodeKey, _getNodeValue(lastNode));\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded));\n } else {\n // We're dealing with an unnecessary extension node.\n // We're going to delete the node entirely.\n // Simply insert its current value into the branch index.\n newBranch = _editBranchIndex(newBranch, branchKey, _getNodeValue(lastNode));\n }\n }\n\n if (keyRemainder.length == 0) {\n // We've got nothing left in the key remainder.\n // Simply insert the value into the branch value slot.\n newBranch = _editBranchValue(newBranch, _value);\n // Push the branch into the list of new nodes.\n newNodes[totalNewNodes] = newBranch;\n totalNewNodes += 1;\n } else {\n // We've got some key remainder to work with.\n // We'll be inserting a leaf node into the trie.\n // First, move on to the next nibble.\n keyRemainder = Lib_BytesUtils.slice(keyRemainder, 1);\n // Push the branch into the list of new nodes.\n newNodes[totalNewNodes] = newBranch;\n totalNewNodes += 1;\n // Push a new leaf node for our k/v pair.\n newNodes[totalNewNodes] = _makeLeafNode(keyRemainder, _value);\n totalNewNodes += 1;\n }\n }\n\n // Finally, join the old path with our newly created nodes.\n // Since we're overwriting the last node in the path, we use `_pathLength - 1`.\n return _joinNodeArrays(_path, _pathLength - 1, newNodes, totalNewNodes);\n }\n\n /**\n * @notice Computes the trie root from a given path.\n * @param _nodes Path to some k/v pair.\n * @param _key Key for the k/v pair.\n * @return _updatedRoot Root hash for the updated trie.\n */\n function _getUpdatedTrieRoot(\n TrieNode[] memory _nodes,\n bytes memory _key\n )\n private\n pure\n returns (\n bytes32 _updatedRoot\n )\n {\n bytes memory key = Lib_BytesUtils.toNibbles(_key);\n\n // Some variables to keep track of during iteration.\n TrieNode memory currentNode;\n NodeType currentNodeType;\n bytes memory previousNodeHash;\n\n // Run through the path backwards to rebuild our root hash.\n for (uint256 i = _nodes.length; i > 0; i--) {\n // Pick out the current node.\n currentNode = _nodes[i - 1];\n currentNodeType = _getNodeType(currentNode);\n\n if (currentNodeType == NodeType.LeafNode) {\n // Leaf nodes are already correctly encoded.\n // Shift the key over to account for the nodes key.\n bytes memory nodeKey = _getNodeKey(currentNode);\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\n } else if (currentNodeType == NodeType.ExtensionNode) {\n // Shift the key over to account for the nodes key.\n bytes memory nodeKey = _getNodeKey(currentNode);\n key = Lib_BytesUtils.slice(key, 0, key.length - nodeKey.length);\n\n // If this node is the last element in the path, it'll be correctly encoded\n // and we can skip this part.\n if (previousNodeHash.length > 0) {\n // Re-encode the node based on the previous node.\n currentNode = _makeExtensionNode(nodeKey, previousNodeHash);\n }\n } else if (currentNodeType == NodeType.BranchNode) {\n // If this node is the last element in the path, it'll be correctly encoded\n // and we can skip this part.\n if (previousNodeHash.length > 0) {\n // Re-encode the node based on the previous node.\n uint8 branchKey = uint8(key[key.length - 1]);\n key = Lib_BytesUtils.slice(key, 0, key.length - 1);\n currentNode = _editBranchIndex(currentNode, branchKey, previousNodeHash);\n }\n }\n\n // Compute the node hash for the next iteration.\n previousNodeHash = _getNodeHash(currentNode.encoded);\n }\n\n // Current node should be the root at this point.\n // Simply return the hash of its encoding.\n return keccak256(currentNode.encoded);\n }\n\n /**\n * @notice Parses an RLP-encoded proof into something more useful.\n * @param _proof RLP-encoded proof to parse.\n * @return _parsed Proof parsed into easily accessible structs.\n */\n function _parseProof(\n bytes memory _proof\n )\n private\n pure\n returns (\n TrieNode[] memory _parsed\n )\n {\n Lib_RLPReader.RLPItem[] memory nodes = Lib_RLPReader.readList(_proof);\n TrieNode[] memory proof = new TrieNode[](nodes.length);\n\n for (uint256 i = 0; i < nodes.length; i++) {\n bytes memory encoded = Lib_RLPReader.readBytes(nodes[i]);\n proof[i] = TrieNode({\n encoded: encoded,\n decoded: Lib_RLPReader.readList(encoded)\n });\n }\n\n return proof;\n }\n\n /**\n * @notice Picks out the ID for a node. Node ID is referred to as the\n * \"hash\" within the specification, but nodes < 32 bytes are not actually\n * hashed.\n * @param _node Node to pull an ID for.\n * @return _nodeID ID for the node, depending on the size of its contents.\n */\n function _getNodeID(\n Lib_RLPReader.RLPItem memory _node\n )\n private\n pure\n returns (\n bytes32 _nodeID\n )\n {\n bytes memory nodeID;\n\n if (_node.length < 32) {\n // Nodes smaller than 32 bytes are RLP encoded.\n nodeID = Lib_RLPReader.readRawBytes(_node);\n } else {\n // Nodes 32 bytes or larger are hashed.\n nodeID = Lib_RLPReader.readBytes(_node);\n }\n\n return Lib_BytesUtils.toBytes32(nodeID);\n }\n\n /**\n * @notice Gets the path for a leaf or extension node.\n * @param _node Node to get a path for.\n * @return _path Node path, converted to an array of nibbles.\n */\n function _getNodePath(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _path\n )\n {\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\n }\n\n /**\n * @notice Gets the key for a leaf or extension node. Keys are essentially\n * just paths without any prefix.\n * @param _node Node to get a key for.\n * @return _key Node key, converted to an array of nibbles.\n */\n function _getNodeKey(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _key\n )\n {\n return _removeHexPrefix(_getNodePath(_node));\n }\n\n /**\n * @notice Gets the path for a node.\n * @param _node Node to get a value for.\n * @return _value Node value, as hex bytes.\n */\n function _getNodeValue(\n TrieNode memory _node\n )\n private\n pure\n returns (\n bytes memory _value\n )\n {\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\n }\n\n /**\n * @notice Computes the node hash for an encoded node. Nodes < 32 bytes\n * are not hashed, all others are keccak256 hashed.\n * @param _encoded Encoded node to hash.\n * @return _hash Hash of the encoded node. Simply the input if < 32 bytes.\n */\n function _getNodeHash(\n bytes memory _encoded\n )\n private\n pure\n returns (\n bytes memory _hash\n )\n {\n if (_encoded.length < 32) {\n return _encoded;\n } else {\n return abi.encodePacked(keccak256(_encoded));\n }\n }\n\n /**\n * @notice Determines the type for a given node.\n * @param _node Node to determine a type for.\n * @return _type Type of the node; BranchNode/ExtensionNode/LeafNode.\n */\n function _getNodeType(\n TrieNode memory _node\n )\n private\n pure\n returns (\n NodeType _type\n )\n {\n if (_node.decoded.length == BRANCH_NODE_LENGTH) {\n return NodeType.BranchNode;\n } else if (_node.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(_node);\n uint8 prefix = uint8(path[0]);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n return NodeType.LeafNode;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n return NodeType.ExtensionNode;\n }\n }\n\n revert(\"Invalid node type\");\n }\n\n /**\n * @notice Utility; determines the number of nibbles shared between two\n * nibble arrays.\n * @param _a First nibble array.\n * @param _b Second nibble array.\n * @return _shared Number of shared nibbles.\n */\n function _getSharedNibbleLength(\n bytes memory _a,\n bytes memory _b\n )\n private\n pure\n returns (\n uint256 _shared\n )\n {\n uint256 i = 0;\n while (_a.length > i && _b.length > i && _a[i] == _b[i]) {\n i++;\n }\n return i;\n }\n\n /**\n * @notice Utility; converts an RLP-encoded node into our nice struct.\n * @param _raw RLP-encoded node to convert.\n * @return _node Node as a TrieNode struct.\n */\n function _makeNode(\n bytes[] memory _raw\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes memory encoded = Lib_RLPWriter.writeList(_raw);\n\n return TrieNode({\n encoded: encoded,\n decoded: Lib_RLPReader.readList(encoded)\n });\n }\n\n /**\n * @notice Utility; converts an RLP-decoded node into our nice struct.\n * @param _items RLP-decoded node to convert.\n * @return _node Node as a TrieNode struct.\n */\n function _makeNode(\n Lib_RLPReader.RLPItem[] memory _items\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](_items.length);\n for (uint256 i = 0; i < _items.length; i++) {\n raw[i] = Lib_RLPReader.readRawBytes(_items[i]);\n }\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates a new extension node.\n * @param _key Key for the extension node, unprefixed.\n * @param _value Value for the extension node.\n * @return _node New extension node with the given k/v pair.\n */\n function _makeExtensionNode(\n bytes memory _key,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_key, false);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates a new leaf node.\n * @dev This function is essentially identical to `_makeExtensionNode`.\n * Although we could route both to a single method with a flag, it's\n * more gas efficient to keep them separate and duplicate the logic.\n * @param _key Key for the leaf node, unprefixed.\n * @param _value Value for the leaf node.\n * @return _node New leaf node with the given k/v pair.\n */\n function _makeLeafNode(\n bytes memory _key,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](2);\n bytes memory key = _addHexPrefix(_key, true);\n raw[0] = Lib_RLPWriter.writeBytes(Lib_BytesUtils.fromNibbles(key));\n raw[1] = Lib_RLPWriter.writeBytes(_value);\n return _makeNode(raw);\n }\n\n /**\n * @notice Creates an empty branch node.\n * @return _node Empty branch node as a TrieNode struct.\n */\n function _makeEmptyBranchNode()\n private\n pure\n returns (\n TrieNode memory _node\n )\n {\n bytes[] memory raw = new bytes[](BRANCH_NODE_LENGTH);\n for (uint256 i = 0; i < raw.length; i++) {\n raw[i] = RLP_NULL_BYTES;\n }\n return _makeNode(raw);\n }\n\n /**\n * @notice Modifies the value slot for a given branch.\n * @param _branch Branch node to modify.\n * @param _value Value to insert into the branch.\n * @return _updatedNode Modified branch node.\n */\n function _editBranchValue(\n TrieNode memory _branch,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _updatedNode\n )\n {\n bytes memory encoded = Lib_RLPWriter.writeBytes(_value);\n _branch.decoded[_branch.decoded.length - 1] = Lib_RLPReader.toRLPItem(encoded);\n return _makeNode(_branch.decoded);\n }\n\n /**\n * @notice Modifies a slot at an index for a given branch.\n * @param _branch Branch node to modify.\n * @param _index Slot index to modify.\n * @param _value Value to insert into the slot.\n * @return _updatedNode Modified branch node.\n */\n function _editBranchIndex(\n TrieNode memory _branch,\n uint8 _index,\n bytes memory _value\n )\n private\n pure\n returns (\n TrieNode memory _updatedNode\n )\n {\n bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value);\n _branch.decoded[_index] = Lib_RLPReader.toRLPItem(encoded);\n return _makeNode(_branch.decoded);\n }\n\n /**\n * @notice Utility; adds a prefix to a key.\n * @param _key Key to prefix.\n * @param _isLeaf Whether or not the key belongs to a leaf.\n * @return _prefixedKey Prefixed key.\n */\n function _addHexPrefix(\n bytes memory _key,\n bool _isLeaf\n )\n private\n pure\n returns (\n bytes memory _prefixedKey\n )\n {\n uint8 prefix = _isLeaf ? uint8(0x02) : uint8(0x00);\n uint8 offset = uint8(_key.length % 2);\n bytes memory prefixed = new bytes(2 - offset);\n prefixed[0] = bytes1(prefix + offset);\n return Lib_BytesUtils.concat(prefixed, _key);\n }\n\n /**\n * @notice Utility; removes a prefix from a path.\n * @param _path Path to remove the prefix from.\n * @return _unprefixedKey Unprefixed key.\n */\n function _removeHexPrefix(\n bytes memory _path\n )\n private\n pure\n returns (\n bytes memory _unprefixedKey\n )\n {\n if (uint8(_path[0]) % 2 == 0) {\n return Lib_BytesUtils.slice(_path, 2);\n } else {\n return Lib_BytesUtils.slice(_path, 1);\n }\n }\n\n /**\n * @notice Utility; combines two node arrays. Array lengths are required\n * because the actual lengths may be longer than the filled lengths.\n * Array resizing is extremely costly and should be avoided.\n * @param _a First array to join.\n * @param _aLength Length of the first array.\n * @param _b Second array to join.\n * @param _bLength Length of the second array.\n * @return _joined Combined node array.\n */\n function _joinNodeArrays(\n TrieNode[] memory _a,\n uint256 _aLength,\n TrieNode[] memory _b,\n uint256 _bLength\n )\n private\n pure\n returns (\n TrieNode[] memory _joined\n )\n {\n TrieNode[] memory ret = new TrieNode[](_aLength + _bLength);\n\n // Copy elements from the first array.\n for (uint256 i = 0; i < _aLength; i++) {\n ret[i] = _a[i];\n }\n\n // Copy elements from the second array.\n for (uint256 i = 0; i < _bLength; i++) {\n ret[i + _aLength] = _b[i];\n }\n\n return ret;\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/verification/OVM_StateTransitionerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_StateTransitionerFactory } from \"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\";\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\n\n/* Contract Imports */\nimport { OVM_StateTransitioner } from \"./OVM_StateTransitioner.sol\";\n\n/**\n * @title OVM_StateTransitionerFactory\n * @dev The State Transitioner Factory is used by the Fraud Verifier to create a new State \n * Transitioner during the initialization of a fraud proof.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_AddressResolver {\n\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n /**\n * Creates a new OVM_StateTransitioner\n * @param _libAddressManager Address of the Address Manager.\n * @param _stateTransitionIndex Index of the state transition being verified.\n * @param _preStateRoot State root before the transition was executed.\n * @param _transactionHash Hash of the executed transaction.\n * @return _ovmStateTransitioner New OVM_StateTransitioner instance.\n */\n function create(\n address _libAddressManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n override\n public\n returns (\n iOVM_StateTransitioner _ovmStateTransitioner\n )\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"Create can only be done by the OVM_FraudVerifier.\"\n );\n return new OVM_StateTransitioner(\n _libAddressManager,\n _stateTransitionIndex,\n _preStateRoot,\n _transactionHash\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/verification/iOVM_StateTransitionerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Contract Imports */\nimport { iOVM_StateTransitioner } from \"./iOVM_StateTransitioner.sol\";\n\n/**\n * @title iOVM_StateTransitionerFactory\n */\ninterface iOVM_StateTransitionerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n function create(\n address _proxyManager,\n uint256 _stateTransitionIndex,\n bytes32 _preStateRoot,\n bytes32 _transactionHash\n )\n external\n returns (\n iOVM_StateTransitioner _ovmStateTransitioner\n );\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/verification/iOVM_FraudVerifier.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateTransitioner } from \"./iOVM_StateTransitioner.sol\";\n\n/**\n * @title iOVM_FraudVerifier\n */\ninterface iOVM_FraudVerifier {\n\n /**********\n * Events *\n **********/\n\n event FraudProofInitialized(\n bytes32 _preStateRoot,\n uint256 _preStateRootIndex,\n bytes32 _transactionHash,\n address _who\n );\n\n event FraudProofFinalized(\n bytes32 _preStateRoot,\n uint256 _preStateRootIndex,\n bytes32 _transactionHash,\n address _who\n );\n\n\n /***************************************\n * Public Functions: Transition Status *\n ***************************************/\n\n function getStateTransitioner(bytes32 _preStateRoot, bytes32 _txHash) external view returns (iOVM_StateTransitioner _transitioner);\n\n\n /****************************************\n * Public Functions: Fraud Verification *\n ****************************************/\n\n function initializeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\n Lib_OVMCodec.Transaction calldata _transaction,\n Lib_OVMCodec.TransactionChainElement calldata _txChainElement,\n Lib_OVMCodec.ChainBatchHeader calldata _transactionBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _transactionProof\n ) external;\n\n function finalizeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _preStateRootProof,\n bytes32 _txHash,\n bytes32 _postStateRoot,\n Lib_OVMCodec.ChainBatchHeader calldata _postStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof calldata _postStateRootProof\n ) external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/verification/OVM_FraudVerifier.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\nimport { iOVM_StateTransitioner } from \"../../iOVM/verification/iOVM_StateTransitioner.sol\";\nimport { iOVM_StateTransitionerFactory } from \"../../iOVM/verification/iOVM_StateTransitionerFactory.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\n\n/* Contract Imports */\nimport { Abs_FraudContributor } from \"./Abs_FraudContributor.sol\";\n\n\n\n/**\n * @title OVM_FraudVerifier\n * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. \n * If the fraud proof was successful it prunes any state batches from State Commitment Chain\n * which were published after the fraudulent state root.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier {\n\n /*******************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n mapping (bytes32 => iOVM_StateTransitioner) internal transitioners;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /***************************************\n * Public Functions: Transition Status *\n ***************************************/\n\n /**\n * Retrieves the state transitioner for a given root.\n * @param _preStateRoot State root to query a transitioner for.\n * @return _transitioner Corresponding state transitioner contract.\n */\n function getStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n override\n public\n view\n returns (\n iOVM_StateTransitioner _transitioner\n )\n {\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\n }\n\n\n /****************************************\n * Public Functions: Fraud Verification *\n ****************************************/\n\n /**\n * Begins the fraud verification process.\n * @param _preStateRoot State root before the fraudulent transaction.\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\n * @param _transaction OVM transaction claimed to be fraudulent.\n * @param _txChainElement OVM transaction chain element.\n * @param _transactionBatchHeader Batch header for the provided transaction.\n * @param _transactionProof Inclusion proof for the provided transaction.\n */\n function initializeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _transactionProof\n )\n override\n public\n contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction))\n {\n bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction);\n\n if (_hasStateTransitioner(_preStateRoot, _txHash)) {\n return;\n }\n\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\"));\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _preStateRoot,\n _preStateRootBatchHeader,\n _preStateRootProof\n ),\n \"Invalid pre-state root inclusion proof.\"\n );\n\n require(\n ovmCanonicalTransactionChain.verifyTransaction(\n _transaction,\n _txChainElement,\n _transactionBatchHeader,\n _transactionProof\n ),\n \"Invalid transaction inclusion proof.\"\n );\n\n require (\n _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index,\n \"Pre-state root global index must equal to the transaction root global index.\"\n );\n\n _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index);\n\n emit FraudProofInitialized(\n _preStateRoot,\n _preStateRootProof.index,\n _txHash,\n msg.sender\n );\n }\n\n /**\n * Finalizes the fraud verification process.\n * @param _preStateRoot State root before the fraudulent transaction.\n * @param _preStateRootBatchHeader Batch header for the provided pre-state root.\n * @param _preStateRootProof Inclusion proof for the provided pre-state root.\n * @param _txHash The transaction for the state root\n * @param _postStateRoot State root after the fraudulent transaction.\n * @param _postStateRootBatchHeader Batch header for the provided post-state root.\n * @param _postStateRootProof Inclusion proof for the provided post-state root.\n */\n function finalizeFraudVerification(\n bytes32 _preStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof,\n bytes32 _txHash,\n bytes32 _postStateRoot,\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof\n )\n override\n public\n contributesToFraudProof(_preStateRoot, _txHash)\n {\n iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\"OVM_BondManager\"));\n\n require(\n transitioner.isComplete() == true,\n \"State transition process must be completed prior to finalization.\"\n );\n\n require (\n _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1,\n \"Post-state root global index must equal to the pre state root global index plus one.\"\n );\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _preStateRoot,\n _preStateRootBatchHeader,\n _preStateRootProof\n ),\n \"Invalid pre-state root inclusion proof.\"\n );\n\n require(\n ovmStateCommitmentChain.verifyStateCommitment(\n _postStateRoot,\n _postStateRootBatchHeader,\n _postStateRootProof\n ),\n \"Invalid post-state root inclusion proof.\"\n );\n\n // If the post state root did not match, then there was fraud and we should delete the batch\n require(\n _postStateRoot != transitioner.getPostStateRoot(),\n \"State transition has not been proven fraudulent.\"\n );\n \n _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot);\n\n // TEMPORARY: Remove the transitioner; for minnet.\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000);\n\n emit FraudProofFinalized(\n _preStateRoot,\n _preStateRootProof.index,\n _txHash,\n msg.sender\n );\n }\n\n\n /************************************\n * Internal Functions: Verification *\n ************************************/\n\n /**\n * Checks whether a transitioner already exists for a given pre-state root.\n * @param _preStateRoot Pre-state root to check.\n * @return _exists Whether or not we already have a transitioner for the root.\n */\n function _hasStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n internal\n view\n returns (\n bool _exists\n )\n {\n return address(getStateTransitioner(_preStateRoot, _txHash)) != address(0);\n }\n\n /**\n * Deploys a new state transitioner.\n * @param _preStateRoot Pre-state root to initialize the transitioner with.\n * @param _txHash Hash of the transaction this transitioner will execute.\n * @param _stateTransitionIndex Index of the transaction in the chain.\n */\n function _deployTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n uint256 _stateTransitionIndex\n )\n internal\n {\n transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitionerFactory(\n resolve(\"OVM_StateTransitionerFactory\")\n ).create(\n address(libAddressManager),\n _stateTransitionIndex,\n _preStateRoot,\n _txHash\n );\n }\n\n /**\n * Removes a state transition from the state commitment chain.\n * @param _postStateRootBatchHeader Header for the post-state root.\n * @param _preStateRoot Pre-state root hash.\n */\n function _cancelStateTransition(\n Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader,\n bytes32 _preStateRoot\n )\n internal\n {\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve(\"OVM_BondManager\"));\n\n // Delete the state batch.\n ovmStateCommitmentChain.deleteStateBatch(\n _postStateRootBatchHeader\n );\n\n // Get the timestamp and publisher for that block.\n (uint256 timestamp, address publisher) = abi.decode(_postStateRootBatchHeader.extraData, (uint256, address));\n\n // Slash the bonds at the bond manager.\n ovmBondManager.finalize(\n _preStateRoot,\n publisher,\n timestamp\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/chain/iOVM_StateCommitmentChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title iOVM_StateCommitmentChain\n */\ninterface iOVM_StateCommitmentChain {\n\n /**********\n * Events *\n **********/\n\n event StateBatchAppended(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot,\n uint256 _batchSize,\n uint256 _prevTotalElements,\n bytes _extraData\n );\n\n event StateBatchDeleted(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n external\n view\n returns (\n uint256 _totalElements\n );\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n external\n view\n returns (\n uint256 _totalBatches\n );\n\n /**\n * Retrieves the timestamp of the last batch submitted by the sequencer.\n * @return _lastSequencerTimestamp Last sequencer batch timestamp.\n */\n function getLastSequencerTimestamp()\n external\n view\n returns (\n uint256 _lastSequencerTimestamp\n );\n\n /**\n * Appends a batch of state roots to the chain.\n * @param _batch Batch of state roots.\n * @param _shouldStartAtElement Index of the element at which this batch should start.\n */\n function appendStateBatch(\n bytes32[] calldata _batch,\n uint256 _shouldStartAtElement\n )\n external;\n\n /**\n * Deletes all state roots after (and including) a given batch.\n * @param _batchHeader Header of the batch to start deleting from.\n */\n function deleteStateBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n external;\n\n /**\n * Verifies a batch inclusion proof.\n * @param _element Hash of the element to verify a proof for.\n * @param _batchHeader Header of the batch in which the element was included.\n * @param _proof Merkle inclusion proof for the element.\n */\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n external\n view\n returns (\n bool _verified\n );\n\n /**\n * Checks whether a given batch is still inside its fraud proof window.\n * @param _batchHeader Header of the batch to check.\n * @return _inside Whether or not the batch is inside the fraud proof window.\n */\n function insideFraudProofWindow(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n external\n view\n returns (\n bool _inside\n );\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/chain/iOVM_CanonicalTransactionChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_ChainStorageContainer } from \"./iOVM_ChainStorageContainer.sol\";\n\n/**\n * @title iOVM_CanonicalTransactionChain\n */\ninterface iOVM_CanonicalTransactionChain {\n\n /**********\n * Events *\n **********/\n\n event TransactionEnqueued(\n address _l1TxOrigin,\n address _target,\n uint256 _gasLimit,\n bytes _data,\n uint256 _queueIndex,\n uint256 _timestamp\n );\n\n event QueueBatchAppended(\n uint256 _startingQueueIndex,\n uint256 _numQueueElements,\n uint256 _totalElements\n );\n\n event SequencerBatchAppended(\n uint256 _startingQueueIndex,\n uint256 _numQueueElements,\n uint256 _totalElements\n );\n\n event TransactionBatchAppended(\n uint256 indexed _batchIndex,\n bytes32 _batchRoot,\n uint256 _batchSize,\n uint256 _prevTotalElements,\n bytes _extraData\n );\n\n\n /***********\n * Structs *\n ***********/\n\n struct BatchContext {\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 timestamp;\n uint256 blockNumber;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n external\n view\n returns (\n iOVM_ChainStorageContainer\n );\n\n /**\n * Accesses the queue storage container.\n * @return Reference to the queue storage container.\n */\n function queue()\n external\n view\n returns (\n iOVM_ChainStorageContainer\n );\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n external\n view\n returns (\n uint256 _totalElements\n );\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n external\n view\n returns (\n uint256 _totalBatches\n );\n\n /**\n * Returns the index of the next element to be enqueued.\n * @return Index for the next queue element.\n */\n function getNextQueueIndex()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Gets the queue element at a particular index.\n * @param _index Index of the queue element to access.\n * @return _element Queue element at the given index.\n */\n function getQueueElement(\n uint256 _index\n )\n external\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n );\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Get the number of queue elements which have not yet been included.\n * @return Number of pending queue elements.\n */\n function getNumPendingQueueElements()\n external\n view\n returns (\n uint40\n );\n\n /**\n * Retrieves the length of the queue, including\n * both pending and canonical transactions.\n * @return Length of the queue.\n */\n function getQueueLength()\n external\n view\n returns (\n uint40\n );\n\n\n /**\n * Adds a transaction to the queue.\n * @param _target Target contract to send the transaction to.\n * @param _gasLimit Gas limit for the given transaction.\n * @param _data Transaction data.\n */\n function enqueue(\n address _target,\n uint256 _gasLimit,\n bytes memory _data\n )\n external;\n\n /**\n * Appends a given number of queued transactions as a single batch.\n * @param _numQueuedTransactions Number of transactions to append.\n */\n function appendQueueBatch(\n uint256 _numQueuedTransactions\n )\n external;\n\n /**\n * Allows the sequencer to append a batch of transactions.\n * @dev This function uses a custom encoding scheme for efficiency reasons.\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\n * .param _contexts Array of batch contexts.\n * .param _transactionDataFields Array of raw transaction data.\n */\n function appendSequencerBatch(\n // uint40 _shouldStartAtElement,\n // uint24 _totalElementsToAppend,\n // BatchContext[] _contexts,\n // bytes[] _transactionDataFields\n )\n external;\n\n /**\n * Verifies whether a transaction is included in the chain.\n * @param _transaction Transaction to verify.\n * @param _txChainElement Transaction chain element corresponding to the transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\n * @return True if the transaction exists in the CTC, false if not.\n */\n function verifyTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n external\n view\n returns (\n bool\n );\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/chain/iOVM_ChainStorageContainer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_ChainStorageContainer\n */\ninterface iOVM_ChainStorageContainer {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the container's global metadata field. We're using `bytes27` here because we use five\n * bytes to maintain the length of the underlying data structure, meaning we have an extra\n * 27 bytes to store arbitrary data.\n * @param _globalMetadata New global metadata to set.\n */\n function setGlobalMetadata(\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Retrieves the container's global metadata field.\n * @return Container global metadata field.\n */\n function getGlobalMetadata()\n external\n view\n returns (\n bytes27\n );\n\n /**\n * Retrieves the number of objects stored in the container.\n * @return Number of objects in the container.\n */\n function length()\n external\n view\n returns (\n uint256\n );\n\n /**\n * Pushes an object into the container.\n * @param _object A 32 byte value to insert into the container.\n */\n function push(\n bytes32 _object\n )\n external;\n\n /**\n * Pushes an object into the container. Function allows setting the global metadata since\n * we'll need to touch the \"length\" storage slot anyway, which also contains the global\n * metadata (it's an optimization).\n * @param _object A 32 byte value to insert into the container.\n * @param _globalMetadata New global metadata for the container.\n */\n function push(\n bytes32 _object,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Pushes two objects into the container at the same time. A useful optimization.\n * @param _objectA First 32 byte value to insert into the container.\n * @param _objectB Second 32 byte value to insert into the container.\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB\n )\n external;\n\n /**\n * Pushes two objects into the container at the same time. Also allows setting the global\n * metadata field.\n * @param _objectA First 32 byte value to insert into the container.\n * @param _objectB Second 32 byte value to insert into the container.\n * @param _globalMetadata New global metadata for the container.\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Retrieves an object from the container.\n * @param _index Index of the particular object to access.\n * @return 32 byte object value.\n */\n function get(\n uint256 _index\n )\n external\n view\n returns (\n bytes32\n );\n\n /**\n * Removes all objects after and including a given index.\n * @param _index Object index to delete from.\n */\n function deleteElementsAfterInclusive(\n uint256 _index\n )\n external;\n\n /**\n * Removes all objects after and including a given index. Also allows setting the global\n * metadata field.\n * @param _index Object index to delete from.\n * @param _globalMetadata New global metadata for the container.\n */\n function deleteElementsAfterInclusive(\n uint256 _index,\n bytes27 _globalMetadata\n )\n external;\n\n /**\n * Marks an index as overwritable, meaing the underlying buffer can start to write values over\n * any objects before and including the given index.\n */\n function setNextOverwritableIndex(\n uint256 _index\n )\n external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/verification/OVM_BondManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_BondManager, Errors, ERC20 } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\n\n/**\n * @title OVM_BondManager\n * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded \n * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a\n * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, \n * and the Verifier's gas costs are refunded.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\n\n /****************************\n * Constants and Parameters *\n ****************************/\n\n /// The period to find the earliest fraud proof for a publisher\n uint256 public constant multiFraudProofPeriod = 7 days;\n\n /// The dispute period\n uint256 public constant disputePeriodSeconds = 7 days;\n\n /// The minimum collateral a sequencer must post\n uint256 public constant requiredCollateral = 1 ether;\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n /// The bond token\n ERC20 immutable public token;\n\n\n /********************************************\n * Contract Variables: Internal Accounting *\n *******************************************/\n\n /// The bonds posted by each proposer\n mapping(address => Bond) public bonds;\n\n /// For each pre-state root, there's an array of witnessProviders that must be rewarded\n /// for posting witnesses\n mapping(bytes32 => Rewards) public witnessProviders;\n\n\n /***************\n * Constructor *\n ***************/\n\n /// Initializes with a ERC20 token to be used for the fidelity bonds\n /// and with the Address Manager\n constructor(\n ERC20 _token,\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n token = _token;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`.\n function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public {\n // The sender must be the transitioner that corresponds to the claimed pre-state root\n address transitioner = address(iOVM_FraudVerifier(resolve(\"OVM_FraudVerifier\")).getStateTransitioner(_preStateRoot, _txHash));\n require(transitioner == msg.sender, Errors.ONLY_TRANSITIONER);\n\n witnessProviders[_preStateRoot].total += gasSpent;\n witnessProviders[_preStateRoot].gasSpent[who] += gasSpent;\n }\n\n /// Slashes + distributes rewards or frees up the sequencer's bond, only called by\n /// `FraudVerifier.finalizeFraudVerification`\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public {\n require(msg.sender == resolve(\"OVM_FraudVerifier\"), Errors.ONLY_FRAUD_VERIFIER);\n require(witnessProviders[_preStateRoot].canClaim == false, Errors.ALREADY_FINALIZED);\n\n // allow users to claim from that state root's\n // pool of collateral (effectively slashing the sequencer)\n witnessProviders[_preStateRoot].canClaim = true;\n\n Bond storage bond = bonds[publisher];\n if (bond.firstDisputeAt == 0) {\n bond.firstDisputeAt = block.timestamp;\n bond.earliestDisputedStateRoot = _preStateRoot;\n bond.earliestTimestamp = timestamp;\n } else if (\n // only update the disputed state root for the publisher if it's within\n // the dispute period _and_ if it's before the previous one\n block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod &&\n timestamp < bond.earliestTimestamp\n ) {\n bond.earliestDisputedStateRoot = _preStateRoot;\n bond.earliestTimestamp = timestamp;\n }\n\n // if the fraud proof's dispute period does not intersect with the \n // withdrawal's timestamp, then the user should not be slashed\n // e.g if a user at day 10 submits a withdrawal, and a fraud proof\n // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d)\n // is before the user started their withdrawal. on the contrary, if the user\n // had started their withdrawal at, say, day 6, they would be slashed\n if (\n bond.withdrawalTimestamp != 0 && \n uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds &&\n bond.state == State.WITHDRAWING\n ) {\n return;\n }\n\n // slash!\n bond.state = State.NOT_COLLATERALIZED;\n }\n\n /// Sequencers call this function to post collateral which will be used for\n /// the `appendBatch` call\n function deposit() override public {\n require(\n token.transferFrom(msg.sender, address(this), requiredCollateral),\n Errors.ERC20_ERR\n );\n\n // This cannot overflow\n bonds[msg.sender].state = State.COLLATERALIZED;\n }\n\n /// Starts the withdrawal for a publisher\n function startWithdrawal() override public {\n Bond storage bond = bonds[msg.sender];\n require(bond.withdrawalTimestamp == 0, Errors.WITHDRAWAL_PENDING);\n require(bond.state == State.COLLATERALIZED, Errors.WRONG_STATE);\n\n bond.state = State.WITHDRAWING;\n bond.withdrawalTimestamp = uint32(block.timestamp);\n }\n\n /// Finalizes a pending withdrawal from a publisher\n function finalizeWithdrawal() override public {\n Bond storage bond = bonds[msg.sender];\n\n require(\n block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, \n Errors.TOO_EARLY\n );\n require(bond.state == State.WITHDRAWING, Errors.SLASHED);\n \n // refunds!\n bond.state = State.NOT_COLLATERALIZED;\n bond.withdrawalTimestamp = 0;\n \n require(\n token.transfer(msg.sender, requiredCollateral),\n Errors.ERC20_ERR\n );\n }\n\n /// Claims the user's reward for the witnesses they provided for the earliest\n /// disputed state root of the designated publisher\n function claim(address who) override public {\n Bond storage bond = bonds[who];\n require(\n block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod,\n Errors.WAIT_FOR_DISPUTES\n );\n\n // reward the earliest state root for this publisher\n bytes32 _preStateRoot = bond.earliestDisputedStateRoot;\n Rewards storage rewards = witnessProviders[_preStateRoot];\n\n // only allow claiming if fraud was proven in `finalize`\n require(rewards.canClaim, Errors.CANNOT_CLAIM);\n\n // proportional allocation - only reward 50% (rest gets locked in the\n // contract forever\n uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total);\n\n // reset the user's spent gas so they cannot double claim\n rewards.gasSpent[msg.sender] = 0;\n\n // transfer\n require(token.transfer(msg.sender, amount), Errors.ERC20_ERR);\n }\n\n /// Checks if the user is collateralized\n function isCollateralized(address who) override public view returns (bool) {\n return bonds[who].state == State.COLLATERALIZED;\n }\n\n /// Gets how many witnesses the user has provided for the state root\n function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) {\n return witnessProviders[preStateRoot].gasSpent[who];\n }\n}\n" - }, - "contracts/test-helpers/Mock_FraudVerifier.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nimport { OVM_BondManager } from \"./../optimistic-ethereum/OVM/verification/OVM_BondManager.sol\";\n\ncontract Mock_FraudVerifier {\n OVM_BondManager bondManager;\n\n mapping (bytes32 => address) transitioners;\n\n function setBondManager(OVM_BondManager _bondManager) public {\n bondManager = _bondManager;\n }\n\n function setStateTransitioner(bytes32 preStateRoot, bytes32 txHash, address addr) public {\n transitioners[keccak256(abi.encodePacked(preStateRoot, txHash))] = addr;\n }\n\n function getStateTransitioner(\n bytes32 _preStateRoot,\n bytes32 _txHash\n )\n public\n view\n returns (\n address\n )\n {\n return transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))];\n }\n\n function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) public {\n bondManager.finalize(_preStateRoot, publisher, timestamp);\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\n\n/* Interface Imports */\nimport { iOVM_FraudVerifier } from \"../../iOVM/verification/iOVM_FraudVerifier.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/* External Imports */\nimport '@openzeppelin/contracts/math/SafeMath.sol';\n\n/**\n * @title OVM_StateCommitmentChain\n * @dev The State Commitment Chain (SCC) contract contains a list of proposed state roots which\n * Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). \n * Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique\n * state root calculated off-chain by applying the canonical transactions one by one.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResolver {\n\n /*************\n * Constants *\n *************/\n\n uint256 public FRAUD_PROOF_WINDOW;\n uint256 public SEQUENCER_PUBLISH_WINDOW;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager,\n uint256 _fraudProofWindow,\n uint256 _sequencerPublishWindow\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:SCC:batches\")\n );\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getTotalElements()\n override\n public\n view\n returns (\n uint256 _totalElements\n )\n {\n (uint40 totalElements, ) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getTotalBatches()\n override\n public\n view\n returns (\n uint256 _totalBatches\n )\n {\n return batches().length();\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function getLastSequencerTimestamp()\n override\n public\n view\n returns (\n uint256 _lastSequencerTimestamp\n )\n {\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n return uint256(lastSequencerTimestamp);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function appendStateBatch(\n bytes32[] memory _batch,\n uint256 _shouldStartAtElement\n )\n override\n public\n {\n // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the\n // publication of batches by some other user.\n require(\n _shouldStartAtElement == getTotalElements(),\n \"Actual batch start index does not match expected start index.\"\n );\n\n // Proposers must have previously staked at the BondManager\n require(\n iOVM_BondManager(resolve(\"OVM_BondManager\")).isCollateralized(msg.sender),\n \"Proposer does not have enough collateral posted\"\n );\n\n require(\n _batch.length > 0,\n \"Cannot submit an empty state batch.\"\n );\n\n require(\n getTotalElements() + _batch.length <= iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\")).getTotalElements(),\n \"Number of state roots cannot exceed the number of canonical transactions.\"\n );\n\n // Pass the block's timestamp and the publisher of the data\n // to be used in the fraud proofs\n _appendBatch(\n _batch,\n abi.encode(block.timestamp, msg.sender)\n );\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function deleteStateBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n override\n public\n {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"State batches can only be deleted by the OVM_FraudVerifier.\"\n );\n\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n require(\n insideFraudProofWindow(_batchHeader),\n \"State batches can only be deleted within the fraud proof window.\"\n );\n\n _deleteBatch(_batchHeader);\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n override\n public\n view\n returns (\n bool\n )\n {\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n require(\n Lib_MerkleTree.verify(\n _batchHeader.batchRoot,\n _element,\n _proof.index,\n _proof.siblings,\n _batchHeader.batchSize\n ),\n \"Invalid inclusion proof.\"\n );\n\n return true;\n }\n\n /**\n * @inheritdoc iOVM_StateCommitmentChain\n */\n function insideFraudProofWindow(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n override\n public\n view\n returns (\n bool _inside\n )\n {\n (uint256 timestamp,) = abi.decode(\n _batchHeader.extraData,\n (uint256, address)\n );\n\n require(\n timestamp != 0,\n \"Batch header timestamp cannot be zero\"\n );\n return SafeMath.add(timestamp, FRAUD_PROOF_WINDOW) > block.timestamp;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Parses the batch context from the extra data.\n * @return Total number of elements submitted.\n * @return Timestamp of the last batch submitted by the sequencer.\n */\n function _getBatchExtraData()\n internal\n view\n returns (\n uint40,\n uint40\n )\n {\n bytes27 extraData = batches().getGlobalMetadata();\n\n uint40 totalElements;\n uint40 lastSequencerTimestamp;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n lastSequencerTimestamp := shr(40, and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\n }\n\n return (\n totalElements,\n lastSequencerTimestamp\n );\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _lastSequencerTimestamp Timestamp of the last batch submitted by the sequencer.\n * @return Encoded batch context.\n */\n function _makeBatchExtraData(\n uint40 _totalElements,\n uint40 _lastSequencerTimestamp\n )\n internal\n pure\n returns (\n bytes27\n )\n {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _lastSequencerTimestamp))\n extraData := shl(40, extraData)\n }\n\n return extraData;\n }\n\n /**\n * Appends a batch to the chain.\n * @param _batch Elements within the batch.\n * @param _extraData Any extra data to append to the batch.\n */\n function _appendBatch(\n bytes32[] memory _batch,\n bytes memory _extraData\n )\n internal\n {\n address sequencer = resolve(\"OVM_Sequencer\");\n (uint40 totalElements, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n\n if (msg.sender == sequencer) {\n lastSequencerTimestamp = uint40(block.timestamp);\n } else {\n // We keep track of the last batch submitted by the sequencer so there's a window in\n // which only the sequencer can publish state roots. A window like this just reduces\n // the chance of \"system breaking\" state roots being published while we're still in\n // testing mode. This window should be removed or significantly reduced in the future.\n require(\n lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp,\n \"Cannot publish state roots within the sequencer publication window.\"\n );\n }\n\n Lib_OVMCodec.ChainBatchHeader memory batchHeader = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: getTotalBatches(),\n batchRoot: Lib_MerkleTree.getMerkleRoot(_batch),\n batchSize: _batch.length,\n prevTotalElements: totalElements,\n extraData: _extraData\n });\n\n emit StateBatchAppended(\n batchHeader.batchIndex,\n batchHeader.batchRoot,\n batchHeader.batchSize,\n batchHeader.prevTotalElements,\n batchHeader.extraData\n );\n\n batches().push(\n Lib_OVMCodec.hashBatchHeader(batchHeader),\n _makeBatchExtraData(\n uint40(batchHeader.prevTotalElements + batchHeader.batchSize),\n lastSequencerTimestamp\n )\n );\n }\n\n /**\n * Removes a batch and all subsequent batches from the chain.\n * @param _batchHeader Header of the batch to remove.\n */\n function _deleteBatch(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n {\n require(\n _batchHeader.batchIndex < batches().length(),\n \"Invalid batch index.\"\n );\n\n require(\n _isValidBatchHeader(_batchHeader),\n \"Invalid batch header.\"\n );\n\n batches().deleteElementsAfterInclusive(\n _batchHeader.batchIndex,\n _makeBatchExtraData(\n uint40(_batchHeader.prevTotalElements),\n 0\n )\n );\n\n emit StateBatchDeleted(\n _batchHeader.batchIndex,\n _batchHeader.batchRoot\n );\n }\n\n /**\n * Checks that a batch header matches the stored hash for the given index.\n * @param _batchHeader Batch header to validate.\n * @return Whether or not the header matches the stored one.\n */\n function _isValidBatchHeader(\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader\n )\n internal\n view\n returns (\n bool\n )\n {\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_MerkleTree\n * @author River Keefer\n */\nlibrary Lib_MerkleTree {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number\n * of leaves passed in is not a power of two, it pads out the tree with zero hashes.\n * If you do not know the original length of elements for the tree you are verifying,\n * then this may allow empty leaves past _elements.length to pass a verification check down the line.\n * @param _elements Array of hashes from which to generate a merkle root.\n * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above).\n */\n function getMerkleRoot(\n bytes32[] memory _elements\n )\n internal\n view\n returns (\n bytes32\n )\n {\n require(\n _elements.length > 0,\n \"Lib_MerkleTree: Must provide at least one leaf hash.\"\n );\n\n if (_elements.length == 0) {\n return _elements[0];\n }\n\n uint256[16] memory defaults = [\n 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,\n 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d,\n 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d,\n 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8,\n 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da,\n 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5,\n 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7,\n 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead,\n 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10,\n 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82,\n 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516,\n 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c,\n 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e,\n 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab,\n 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862,\n 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10\n ];\n\n // Reserve memory space for our hashes.\n bytes memory buf = new bytes(64);\n\n // We'll need to keep track of left and right siblings.\n bytes32 leftSibling;\n bytes32 rightSibling;\n\n // Number of non-empty nodes at the current depth.\n uint256 rowSize = _elements.length;\n\n // Current depth, counting from 0 at the leaves\n uint256 depth = 0;\n\n // Common sub-expressions\n uint256 halfRowSize; // rowSize / 2\n bool rowSizeIsOdd; // rowSize % 2 == 1\n\n while (rowSize > 1) {\n halfRowSize = rowSize / 2;\n rowSizeIsOdd = rowSize % 2 == 1;\n\n for (uint256 i = 0; i < halfRowSize; i++) {\n leftSibling = _elements[(2 * i) ];\n rightSibling = _elements[(2 * i) + 1];\n assembly {\n mstore(add(buf, 32), leftSibling )\n mstore(add(buf, 64), rightSibling)\n }\n\n _elements[i] = keccak256(buf);\n }\n\n if (rowSizeIsOdd) {\n leftSibling = _elements[rowSize - 1];\n rightSibling = bytes32(defaults[depth]);\n assembly {\n mstore(add(buf, 32), leftSibling)\n mstore(add(buf, 64), rightSibling)\n }\n\n _elements[halfRowSize] = keccak256(buf);\n }\n\n rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0);\n depth++;\n }\n\n return _elements[0];\n }\n\n /**\n * Verifies a merkle branch for the given leaf hash. Assumes the original length\n * of leaves generated is a known, correct input, and does not return true for indices \n * extending past that index (even if _siblings would be otherwise valid.)\n * @param _root The Merkle root to verify against.\n * @param _leaf The leaf hash to verify inclusion of.\n * @param _index The index in the tree of this leaf.\n * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 (bottom of the tree). \n * @param _totalLeaves The total number of leaves originally passed into.\n * @return Whether or not the merkle branch and leaf passes verification.\n */\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n )\n internal\n pure\n returns (\n bool\n )\n {\n require(\n _totalLeaves > 0,\n \"Lib_MerkleTree: Total leaves must be greater than zero.\"\n );\n\n require(\n _index < _totalLeaves,\n \"Lib_MerkleTree: Index out of bounds.\"\n );\n\n require(\n _siblings.length == _ceilLog2(_totalLeaves),\n \"Lib_MerkleTree: Total siblings does not correctly correspond to total leaves.\"\n );\n\n bytes32 computedRoot = _leaf;\n\n for (uint256 i = 0; i < _siblings.length; i++) {\n if ((_index & 1) == 1) {\n computedRoot = keccak256(\n abi.encodePacked(\n _siblings[i],\n computedRoot\n )\n );\n } else {\n computedRoot = keccak256(\n abi.encodePacked(\n computedRoot,\n _siblings[i]\n )\n );\n }\n\n _index >>= 1;\n }\n\n return _root == computedRoot;\n }\n\n\n /*********************\n * Private Functions *\n *********************/\n\n /**\n * Calculates the integer ceiling of the log base 2 of an input.\n * @param _in Unsigned input to calculate the log.\n * @return ceil(log_base_2(_in))\n */\n function _ceilLog2(\n uint256 _in\n )\n private\n pure\n returns (\n uint256\n )\n { \n require(\n _in > 0,\n \"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\"\n );\n\n if (_in == 1) {\n return 0;\n }\n\n // Find the highest set bit (will be floor(log_2)).\n // Borrowed with <3 from https://github.com/ethereum/solidity-examples\n uint256 val = _in;\n uint256 highest = 0;\n for (uint8 i = 128; i >= 1; i >>= 1) {\n if (val & (uint(1) << i) - 1 << i != 0) {\n highest += i;\n val >>= i;\n }\n }\n\n // Increment by one if this is not a perfect logarithm.\n if ((uint(1) << highest) != _in) {\n highest += 1;\n }\n\n return highest;\n }\n}\n" - }, - "@openzeppelin/contracts/math/SafeMath.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/chain/OVM_ChainStorageContainer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_RingBuffer } from \"../../libraries/utils/Lib_RingBuffer.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/**\n * @title OVM_ChainStorageContainer\n * @dev The Chain Storage Container provides its owner contract with read, write and delete functionality.\n * This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used\n * in a fraud proof due to the fraud window having passed, and the associated chain state or\n * transactions being finalized.\n * Three disctint Chain Storage Containers will be deployed on Layer 1:\n * 1. Stores transaction batches for the Canonical Transaction Chain\n * 2. Stores queued transactions for the Canonical Transaction Chain\n * 3. Stores chain state batches for the State Commitment Chain\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {\n\n /*************\n * Libraries *\n *************/\n\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\n\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_RingBuffer.RingBuffer internal buffer;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n * @param _owner Name of the contract that owns this container (will be resolved later).\n */\n constructor(\n address _libAddressManager,\n string memory _owner\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n owner = _owner;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n msg.sender == resolve(owner),\n \"OVM_ChainStorageContainer: Function can only be called by the owner.\"\n );\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function setGlobalMetadata(\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n return buffer.setExtraData(_globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function getGlobalMetadata()\n override\n public\n view\n returns (\n bytes27\n )\n {\n return buffer.getExtraData();\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function length()\n override\n public\n view\n returns (\n uint256\n )\n {\n return uint256(buffer.getLength());\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push(\n bytes32 _object\n )\n override\n public\n onlyOwner\n {\n buffer.push(_object);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push(\n bytes32 _object,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.push(_object, _globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB\n )\n override\n public\n onlyOwner\n {\n buffer.push2(_objectA, _objectB);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function push2(\n bytes32 _objectA,\n bytes32 _objectB,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.push2(_objectA, _objectB, _globalMetadata);\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function get(\n uint256 _index\n )\n override\n public\n view\n returns (\n bytes32\n )\n {\n return buffer.get(uint40(_index));\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function deleteElementsAfterInclusive(\n uint256 _index\n )\n override\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(\n uint40(_index)\n );\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function deleteElementsAfterInclusive(\n uint256 _index,\n bytes27 _globalMetadata\n )\n override\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(\n uint40(_index),\n _globalMetadata\n );\n }\n\n /**\n * @inheritdoc iOVM_ChainStorageContainer\n */\n function setNextOverwritableIndex(\n uint256 _index\n )\n override\n public\n onlyOwner\n {\n buffer.nextOverwritableIndex = _index;\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\nlibrary Lib_RingBuffer {\n using Lib_RingBuffer for RingBuffer;\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n uint256 length;\n mapping (uint256 => bytes32) buf;\n }\n\n struct RingBuffer {\n bytes32 contextA;\n bytes32 contextB;\n Buffer bufferA;\n Buffer bufferB;\n uint256 nextOverwritableIndex;\n }\n\n struct RingBufferContext {\n // contextA\n uint40 globalIndex;\n bytes27 extraData;\n\n // contextB\n uint64 currBufferIndex;\n uint40 prevResetIndex;\n uint40 currResetIndex;\n }\n\n\n /*************\n * Constants *\n *************/\n\n uint256 constant MIN_CAPACITY = 16;\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n * @param _extraData Optional global extra data.\n */\n function push(\n RingBuffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n\n // Set a minimum capacity.\n if (currBuffer.length == 0) {\n currBuffer.length = MIN_CAPACITY;\n }\n\n // Check if we need to expand the buffer.\n if (ctx.globalIndex - ctx.currResetIndex >= currBuffer.length) {\n if (ctx.currResetIndex < _self.nextOverwritableIndex) {\n // We're going to overwrite the inactive buffer.\n // Bump the buffer index, reset the delete offset, and set our reset indices.\n ctx.currBufferIndex++;\n ctx.prevResetIndex = ctx.currResetIndex;\n ctx.currResetIndex = ctx.globalIndex;\n\n // Swap over to the next buffer.\n currBuffer = _self.getBuffer(ctx.currBufferIndex);\n } else {\n // We're not overwriting yet, double the length of the current buffer.\n currBuffer.length *= 2;\n }\n }\n\n // Index to write to is the difference of the global and reset indices.\n uint256 writeHead = ctx.globalIndex - ctx.currResetIndex;\n currBuffer.buf[writeHead] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.globalIndex++;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n */\n function push(\n RingBuffer storage _self,\n bytes32 _value\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n \n _self.push(\n _value,\n ctx.extraData\n );\n }\n\n /**\n * Pushes a two elements to the buffer.\n * @param _self Buffer to access.\n * @param _valueA First value to push to the buffer.\n * @param _valueA Second value to push to the buffer.\n * @param _extraData Optional global extra data.\n */\n function push2(\n RingBuffer storage _self,\n bytes32 _valueA,\n bytes32 _valueB,\n bytes27 _extraData\n )\n internal\n {\n _self.push(_valueA, _extraData);\n _self.push(_valueB, _extraData);\n }\n\n /**\n * Pushes a two elements to the buffer.\n * @param _self Buffer to access.\n * @param _valueA First value to push to the buffer.\n * @param _valueA Second value to push to the buffer.\n */\n function push2(\n RingBuffer storage _self,\n bytes32 _valueA,\n bytes32 _valueB\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n\n _self.push2(\n _valueA,\n _valueB,\n ctx.extraData\n );\n }\n\n /**\n * Retrieves an element from the buffer.\n * @param _self Buffer to access.\n * @param _index Element index to retrieve.\n * @return Value of the element at the given index.\n */\n function get(\n RingBuffer storage _self,\n uint256 _index\n )\n internal\n view\n returns (\n bytes32 \n )\n {\n RingBufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.globalIndex,\n \"Index out of bounds.\"\n );\n\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\n\n if (_index >= ctx.currResetIndex) {\n // We're trying to load an element from the current buffer.\n // Relative index is just the difference from the reset index.\n uint256 relativeIndex = _index - ctx.currResetIndex;\n\n // Shouldn't happen but why not check.\n require(\n relativeIndex < currBuffer.length,\n \"Index out of bounds.\"\n );\n\n return currBuffer.buf[relativeIndex];\n } else {\n // We're trying to load an element from the previous buffer.\n // Relative index is the difference from the reset index in the other direction.\n uint256 relativeIndex = ctx.currResetIndex - _index;\n\n // Condition only fails in the case that we deleted and flipped buffers.\n require(\n ctx.currResetIndex > ctx.prevResetIndex,\n \"Index out of bounds.\"\n );\n\n // Make sure we're not trying to read beyond the array.\n require(\n relativeIndex <= prevBuffer.length,\n \"Index out of bounds.\"\n );\n\n return prevBuffer.buf[prevBuffer.length - relativeIndex];\n }\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n * @param _extraData Optional global extra data.\n */\n function deleteElementsAfterInclusive(\n RingBuffer storage _self,\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n\n require(\n _index < ctx.globalIndex && _index >= ctx.prevResetIndex,\n \"Index out of bounds.\"\n );\n\n Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);\n Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);\n\n if (_index < ctx.currResetIndex) {\n // We're switching back to the previous buffer.\n // Reduce the buffer index, set the current reset index back to match the previous one.\n // We use the equality of these two values to prevent reading beyond this buffer.\n ctx.currBufferIndex--;\n ctx.currResetIndex = ctx.prevResetIndex;\n }\n\n // Set our global index and extra data, save the context.\n ctx.globalIndex = _index;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n */\n function deleteElementsAfterInclusive(\n RingBuffer storage _self,\n uint40 _index\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n _self.deleteElementsAfterInclusive(\n _index,\n ctx.extraData\n );\n }\n\n /**\n * Retrieves the current global index.\n * @param _self Buffer to access.\n * @return Current global index.\n */\n function getLength(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n uint40\n )\n {\n RingBufferContext memory ctx = _self.getContext();\n return ctx.globalIndex;\n }\n\n /**\n * Changes current global extra data.\n * @param _self Buffer to access.\n * @param _extraData New global extra data.\n */\n function setExtraData(\n RingBuffer storage _self,\n bytes27 _extraData\n )\n internal\n {\n RingBufferContext memory ctx = _self.getContext();\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Retrieves the current global extra data.\n * @param _self Buffer to access.\n * @return Current global extra data.\n */\n function getExtraData(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n bytes27\n )\n {\n RingBufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current ring buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current ring buffer context.\n */\n function setContext(\n RingBuffer storage _self,\n RingBufferContext memory _ctx\n )\n internal\n returns (\n bytes32\n )\n {\n bytes32 contextA;\n bytes32 contextB;\n\n uint40 globalIndex = _ctx.globalIndex;\n bytes27 extraData = _ctx.extraData;\n assembly {\n contextA := globalIndex\n contextA := or(contextA, extraData)\n }\n\n uint64 currBufferIndex = _ctx.currBufferIndex;\n uint40 prevResetIndex = _ctx.prevResetIndex;\n uint40 currResetIndex = _ctx.currResetIndex;\n assembly {\n contextB := currBufferIndex\n contextB := or(contextB, shl(64, prevResetIndex))\n contextB := or(contextB, shl(104, currResetIndex))\n }\n\n if (_self.contextA != contextA) {\n _self.contextA = contextA;\n }\n\n if (_self.contextB != contextB) {\n _self.contextB = contextB;\n }\n }\n\n /**\n * Retrieves the current ring buffer context.\n * @param _self Buffer to access.\n * @return Current ring buffer context.\n */\n function getContext(\n RingBuffer storage _self\n )\n internal\n view\n returns (\n RingBufferContext memory\n )\n {\n bytes32 contextA = _self.contextA;\n bytes32 contextB = _self.contextB;\n\n uint40 globalIndex;\n bytes27 extraData;\n assembly {\n globalIndex := and(contextA, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n extraData := and(contextA, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n }\n\n uint64 currBufferIndex;\n uint40 prevResetIndex;\n uint40 currResetIndex;\n assembly {\n currBufferIndex := and(contextB, 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\n prevResetIndex := shr(64, and(contextB, 0x00000000000000000000000000000000000000FFFFFFFFFF0000000000000000))\n currResetIndex := shr(104, and(contextB, 0x0000000000000000000000000000FFFFFFFFFF00000000000000000000000000))\n }\n\n return RingBufferContext({\n globalIndex: globalIndex,\n extraData: extraData,\n currBufferIndex: currBufferIndex,\n prevResetIndex: prevResetIndex,\n currResetIndex: currResetIndex\n });\n }\n\n /**\n * Retrieves the a buffer from the ring buffer by index.\n * @param _self Buffer to access.\n * @param _which Index of the sub buffer to access.\n * @return Sub buffer for the index.\n */\n function getBuffer(\n RingBuffer storage _self,\n uint256 _which\n )\n internal\n view\n returns (\n Buffer storage\n )\n {\n return _which % 2 == 0 ? _self.bufferA : _self.bufferB;\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_RingBuffer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RingBuffer } from \"../../optimistic-ethereum/libraries/utils/Lib_RingBuffer.sol\";\n\n/**\n * @title TestLib_RingBuffer\n */\ncontract TestLib_RingBuffer {\n using Lib_RingBuffer for Lib_RingBuffer.RingBuffer;\n \n Lib_RingBuffer.RingBuffer internal buf;\n\n function push(\n bytes32 _value,\n bytes27 _extraData\n )\n public\n {\n buf.push(\n _value,\n _extraData\n );\n }\n\n function push2(\n bytes32 _valueA,\n bytes32 _valueB,\n bytes27 _extraData\n )\n public\n {\n buf.push2(\n _valueA,\n _valueB,\n _extraData\n );\n }\n\n function get(\n uint256 _index\n )\n public\n view\n returns (\n bytes32 \n )\n {\n return buf.get(_index);\n }\n\n function deleteElementsAfterInclusive(\n uint40 _index,\n bytes27 _extraData\n )\n internal\n {\n return buf.deleteElementsAfterInclusive(\n _index,\n _extraData\n );\n }\n\n function getLength()\n internal\n view\n returns (\n uint40\n )\n {\n return buf.getLength();\n }\n\n function getExtraData()\n internal\n view\n returns (\n bytes27\n )\n {\n return buf.getExtraData();\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\nimport { Lib_Math } from \"../../libraries/utils/Lib_Math.sol\";\n\n/* Interface Imports */\nimport { iOVM_CanonicalTransactionChain } from \"../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_ChainStorageContainer } from \"../../iOVM/chain/iOVM_ChainStorageContainer.sol\";\n\n/* Contract Imports */\nimport { OVM_ExecutionManager } from \"../execution/OVM_ExecutionManager.sol\";\n\n\n/**\n * @title OVM_CanonicalTransactionChain\n * @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions\n * which must be applied to the rollup state. It defines the ordering of rollup transactions by\n * writing them to the 'CTC:batches' instance of the Chain Storage Container.\n * The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the Sequencer\n * will eventually append it to the rollup state.\n * If the Sequencer does not include an enqueued transaction within the 'force inclusion period',\n * then any account may force it to be included by calling appendQueueBatch().\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_AddressResolver {\n\n /*************\n * Constants *\n *************/\n\n // L2 tx gas-related\n uint256 constant public MIN_ROLLUP_TX_GAS = 100000;\n uint256 constant public MAX_ROLLUP_TX_SIZE = 10000;\n uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 32;\n\n // Encoding-related (all in bytes)\n uint256 constant internal BATCH_CONTEXT_SIZE = 16;\n uint256 constant internal BATCH_CONTEXT_LENGTH_POS = 12;\n uint256 constant internal BATCH_CONTEXT_START_POS = 15;\n uint256 constant internal TX_DATA_HEADER_SIZE = 3;\n uint256 constant internal BYTES_TILL_TX_DATA = 65;\n\n\n /*************\n * Variables *\n *************/\n\n uint256 public forceInclusionPeriodSeconds;\n uint256 public forceInclusionPeriodBlocks;\n uint256 public maxTransactionGasLimit;\n\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager,\n uint256 _forceInclusionPeriodSeconds,\n uint256 _forceInclusionPeriodBlocks,\n uint256 _maxTransactionGasLimit\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {\n forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds;\n forceInclusionPeriodBlocks = _forceInclusionPeriodBlocks;\n maxTransactionGasLimit = _maxTransactionGasLimit;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Accesses the batch storage container.\n * @return Reference to the batch storage container.\n */\n function batches()\n override\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:CTC:batches\")\n );\n }\n\n /**\n * Accesses the queue storage container.\n * @return Reference to the queue storage container.\n */\n function queue()\n override\n public\n view\n returns (\n iOVM_ChainStorageContainer\n )\n {\n return iOVM_ChainStorageContainer(\n resolve(\"OVM_ChainStorageContainer:CTC:queue\")\n );\n }\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements()\n override\n public\n view\n returns (\n uint256 _totalElements\n )\n {\n (uint40 totalElements,,,) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches()\n override\n public\n view\n returns (\n uint256 _totalBatches\n )\n {\n return batches().length();\n }\n\n /**\n * Returns the index of the next element to be enqueued.\n * @return Index for the next queue element.\n */\n function getNextQueueIndex()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,uint40 nextQueueIndex,,) = _getBatchExtraData();\n return nextQueueIndex;\n }\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,,uint40 lastTimestamp,) = _getBatchExtraData();\n return lastTimestamp;\n }\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber()\n override\n public\n view\n returns (\n uint40\n )\n {\n (,,,uint40 lastBlockNumber) = _getBatchExtraData();\n return lastBlockNumber;\n }\n\n /**\n * Gets the queue element at a particular index.\n * @param _index Index of the queue element to access.\n * @return _element Queue element at the given index.\n */\n function getQueueElement(\n uint256 _index\n )\n override\n public\n view\n returns (\n Lib_OVMCodec.QueueElement memory _element\n )\n {\n iOVM_ChainStorageContainer queue = queue();\n\n uint40 trueIndex = uint40(_index * 2);\n bytes32 queueRoot = queue.get(trueIndex);\n bytes32 timestampAndBlockNumber = queue.get(trueIndex + 1);\n\n uint40 elementTimestamp;\n uint40 elementBlockNumber;\n assembly {\n elementTimestamp := and(timestampAndBlockNumber, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n elementBlockNumber := shr(40, and(timestampAndBlockNumber, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000))\n }\n\n return Lib_OVMCodec.QueueElement({\n queueRoot: queueRoot,\n timestamp: elementTimestamp,\n blockNumber: elementBlockNumber\n });\n }\n\n /**\n * Get the number of queue elements which have not yet been included.\n * @return Number of pending queue elements.\n */\n function getNumPendingQueueElements()\n override\n public\n view\n returns (\n uint40\n )\n {\n return getQueueLength() - getNextQueueIndex();\n }\n\n /**\n * Retrieves the length of the queue, including\n * both pending and canonical transactions.\n * @return Length of the queue.\n */\n function getQueueLength()\n override\n public\n view\n returns (\n uint40\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the real queue length we need\n // to divide by 2. See the usage of `push2(..)`.\n return uint40(queue().length() / 2);\n }\n\n /**\n * Adds a transaction to the queue.\n * @param _target Target L2 contract to send the transaction to.\n * @param _gasLimit Gas limit for the enqueued L2 transaction.\n * @param _data Transaction data.\n */\n function enqueue(\n address _target,\n uint256 _gasLimit,\n bytes memory _data\n )\n override\n public\n {\n require(\n _data.length <= MAX_ROLLUP_TX_SIZE,\n \"Transaction data size exceeds maximum for rollup transaction.\"\n );\n\n require(\n _gasLimit <= maxTransactionGasLimit,\n \"Transaction gas limit exceeds maximum for rollup transaction.\"\n );\n\n require(\n _gasLimit >= MIN_ROLLUP_TX_GAS,\n \"Transaction gas limit too low to enqueue.\"\n );\n\n // We need to consume some amount of L1 gas in order to rate limit transactions going into\n // L2. However, L2 is cheaper than L1 so we only need to burn some small proportion of the\n // provided L1 gas.\n uint256 gasToConsume = _gasLimit/L2_GAS_DISCOUNT_DIVISOR;\n uint256 startingGas = gasleft();\n\n // Although this check is not necessary (burn below will run out of gas if not true), it\n // gives the user an explicit reason as to why the enqueue attempt failed.\n require(\n startingGas > gasToConsume,\n \"Insufficient gas for L2 rate limiting burn.\"\n );\n\n // Here we do some \"dumb\" work in order to burn gas, although we should probably replace\n // this with something like minting gas token later on.\n uint256 i;\n while(startingGas - gasleft() < gasToConsume) {\n i++;\n }\n\n bytes32 transactionHash = keccak256(\n abi.encode(\n msg.sender,\n _target,\n _gasLimit,\n _data\n )\n );\n\n bytes32 timestampAndBlockNumber;\n assembly {\n timestampAndBlockNumber := timestamp()\n timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))\n }\n\n iOVM_ChainStorageContainer queue = queue();\n\n queue.push2(\n transactionHash,\n timestampAndBlockNumber\n );\n\n uint256 queueIndex = queue.length() / 2;\n emit TransactionEnqueued(\n msg.sender,\n _target,\n _gasLimit,\n _data,\n queueIndex - 1,\n block.timestamp\n );\n }\n\n /**\n * Appends a given number of queued transactions as a single batch.\n * @param _numQueuedTransactions Number of transactions to append.\n */\n function appendQueueBatch(\n uint256 _numQueuedTransactions\n )\n override\n public\n {\n // Disable `appendQueueBatch` for minnet\n revert(\"appendQueueBatch is currently disabled.\");\n\n _numQueuedTransactions = Lib_Math.min(_numQueuedTransactions, getNumPendingQueueElements());\n require(\n _numQueuedTransactions > 0,\n \"Must append more than zero transactions.\"\n );\n\n bytes32[] memory leaves = new bytes32[](_numQueuedTransactions);\n uint40 nextQueueIndex = getNextQueueIndex();\n\n for (uint256 i = 0; i < _numQueuedTransactions; i++) {\n if (msg.sender != resolve(\"OVM_Sequencer\")) {\n Lib_OVMCodec.QueueElement memory el = getQueueElement(nextQueueIndex);\n require(\n el.timestamp + forceInclusionPeriodSeconds < block.timestamp,\n \"Queue transactions cannot be submitted during the sequencer inclusion period.\"\n );\n }\n leaves[i] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n }\n\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\n\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n _numQueuedTransactions,\n _numQueuedTransactions,\n lastElement.timestamp,\n lastElement.blockNumber\n );\n\n emit QueueBatchAppended(\n nextQueueIndex - _numQueuedTransactions,\n _numQueuedTransactions,\n getTotalElements()\n );\n }\n\n /**\n * Allows the sequencer to append a batch of transactions.\n * @dev This function uses a custom encoding scheme for efficiency reasons.\n * .param _shouldStartAtElement Specific batch we expect to start appending to.\n * .param _totalElementsToAppend Total number of batch elements we expect to append.\n * .param _contexts Array of batch contexts.\n * .param _transactionDataFields Array of raw transaction data.\n */\n function appendSequencerBatch()\n override\n public\n {\n uint40 shouldStartAtElement;\n uint24 totalElementsToAppend;\n uint24 numContexts;\n assembly {\n shouldStartAtElement := shr(216, calldataload(4))\n totalElementsToAppend := shr(232, calldataload(9))\n numContexts := shr(232, calldataload(12))\n }\n\n require(\n shouldStartAtElement == getTotalElements(),\n \"Actual batch start index does not match expected start index.\"\n );\n\n require(\n msg.sender == resolve(\"OVM_Sequencer\"),\n \"Function can only be called by the Sequencer.\"\n );\n\n require(\n numContexts > 0,\n \"Must provide at least one batch context.\"\n );\n\n require(\n totalElementsToAppend > 0,\n \"Must append at least one element.\"\n );\n\n uint40 nextTransactionPtr = uint40(BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts);\n uint256 calldataSize;\n assembly {\n calldataSize := calldatasize()\n }\n\n require(\n calldataSize >= nextTransactionPtr,\n \"Not enough BatchContexts provided.\"\n );\n\n // Get queue length for future comparison/\n uint40 queueLength = getQueueLength();\n\n // Initialize the array of canonical chain leaves that we will append.\n bytes32[] memory leaves = new bytes32[](totalElementsToAppend);\n // Each leaf index corresponds to a tx, either sequenced or enqueued.\n uint32 leafIndex = 0;\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n // We will sequentially append leaves which are pointers to the queue.\n // The initial queue index is what is currently in storage.\n uint40 nextQueueIndex = getNextQueueIndex();\n\n BatchContext memory curContext;\n\n for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n if (i == 0) {\n _validateFirstBatchContext(nextContext);\n }\n _validateNextBatchContext(curContext, nextContext, nextQueueIndex);\n\n curContext = nextContext;\n\n for (uint32 j = 0; j < curContext.numSequencedTransactions; j++) {\n uint256 txDataLength;\n assembly {\n txDataLength := shr(232, calldataload(nextTransactionPtr))\n }\n\n leaves[leafIndex] = _getSequencerLeafHash(curContext, nextTransactionPtr, txDataLength);\n nextTransactionPtr += uint40(TX_DATA_HEADER_SIZE + txDataLength);\n numSequencerTransactions++;\n leafIndex++;\n }\n\n for (uint32 j = 0; j < curContext.numSubsequentQueueTransactions; j++) {\n require(nextQueueIndex < queueLength, \"Not enough queued transactions to append.\");\n leaves[leafIndex] = _getQueueLeafHash(nextQueueIndex);\n nextQueueIndex++;\n leafIndex++;\n }\n }\n\n _validateFinalBatchContext(curContext);\n\n require(\n calldataSize == nextTransactionPtr,\n \"Not all sequencer transactions were processed.\"\n );\n\n require(\n leafIndex == totalElementsToAppend,\n \"Actual transaction index does not match expected total elements to append.\"\n );\n\n // Generate the required metadata that we need to append this batch\n uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions;\n uint40 timestamp;\n uint40 blockNumber;\n if (curContext.numSubsequentQueueTransactions == 0) {\n // The last element is a sequencer tx, therefore pull timestamp and block number from the last context.\n timestamp = uint40(curContext.timestamp);\n blockNumber = uint40(curContext.blockNumber);\n } else {\n // The last element is a queue tx, therefore pull timestamp and block number from the queue element.\n Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);\n timestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n _appendBatch(\n Lib_MerkleTree.getMerkleRoot(leaves),\n totalElementsToAppend,\n numQueuedTransactions,\n timestamp,\n blockNumber\n );\n\n emit SequencerBatchAppended(\n nextQueueIndex - numQueuedTransactions,\n numQueuedTransactions,\n getTotalElements()\n );\n }\n\n /**\n * Verifies whether a transaction is included in the chain.\n * @param _transaction Transaction to verify.\n * @param _txChainElement Transaction chain element corresponding to the transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof Inclusion proof for the provided transaction chain element.\n * @return True if the transaction exists in the CTC, false if not.\n */\n function verifyTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n override\n public\n view\n returns (\n bool\n )\n {\n if (_txChainElement.isSequenced == true) {\n return _verifySequencerTransaction(\n _transaction,\n _txChainElement,\n _batchHeader,\n _inclusionProof\n );\n } else {\n return _verifyQueueTransaction(\n _transaction,\n _txChainElement.queueIndex,\n _batchHeader,\n _inclusionProof\n );\n }\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Returns the BatchContext located at a particular index.\n * @param _index The index of the BatchContext\n * @return The BatchContext at the specified index.\n */\n function _getBatchContext(\n uint256 _index\n )\n internal\n pure\n returns (\n BatchContext memory\n )\n {\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 ctxTimestamp;\n uint256 ctxBlockNumber;\n\n assembly {\n numSequencedTransactions := shr(232, calldataload(contextPtr))\n numSubsequentQueueTransactions := shr(232, calldataload(add(contextPtr, 3)))\n ctxTimestamp := shr(216, calldataload(add(contextPtr, 6)))\n ctxBlockNumber := shr(216, calldataload(add(contextPtr, 11)))\n }\n\n return BatchContext({\n numSequencedTransactions: numSequencedTransactions,\n numSubsequentQueueTransactions: numSubsequentQueueTransactions,\n timestamp: ctxTimestamp,\n blockNumber: ctxBlockNumber\n });\n }\n\n /**\n * Parses the batch context from the extra data.\n * @return Total number of elements submitted.\n * @return Index of the next queue element.\n */\n function _getBatchExtraData()\n internal\n view\n returns (\n uint40,\n uint40,\n uint40,\n uint40\n )\n {\n bytes27 extraData = batches().getGlobalMetadata();\n\n uint40 totalElements;\n uint40 nextQueueIndex;\n uint40 lastTimestamp;\n uint40 lastBlockNumber;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF)\n nextQueueIndex := shr(40, and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000))\n lastTimestamp := shr(80, and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000))\n lastBlockNumber := shr(120, and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000))\n }\n\n return (\n totalElements,\n nextQueueIndex,\n lastTimestamp,\n lastBlockNumber\n );\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _nextQueueIndex Index of the next queue element.\n * @param _timestamp Timestamp for the last batch.\n * @param _blockNumber Block number of the last batch.\n * @return Encoded batch context.\n */\n function _makeBatchExtraData(\n uint40 _totalElements,\n uint40 _nextQueueIndex,\n uint40 _timestamp,\n uint40 _blockNumber\n )\n internal\n pure\n returns (\n bytes27\n )\n {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _nextQueueIndex))\n extraData := or(extraData, shl(80, _timestamp))\n extraData := or(extraData, shl(120, _blockNumber))\n extraData := shl(40, extraData)\n }\n\n return extraData;\n }\n\n /**\n * Retrieves the hash of a queue element.\n * @param _index Index of the queue element to retrieve a hash for.\n * @return Hash of the queue element.\n */\n function _getQueueLeafHash(\n uint256 _index\n )\n internal\n view\n returns (\n bytes32\n )\n {\n return _hashTransactionChainElement(\n Lib_OVMCodec.TransactionChainElement({\n isSequenced: false,\n queueIndex: _index,\n timestamp: 0,\n blockNumber: 0,\n txData: hex\"\"\n })\n );\n }\n\n /**\n * Retrieves the length of the queue.\n * @return Length of the queue.\n */\n function _getQueueLength()\n internal\n view\n returns (\n uint40\n )\n {\n // The underlying queue data structure stores 2 elements\n // per insertion, so to get the real queue length we need\n // to divide by 2. See the usage of `push2(..)`.\n return uint40(queue().length() / 2);\n }\n\n /**\n * Retrieves the hash of a sequencer element.\n * @param _context Batch context for the given element.\n * @param _nextTransactionPtr Pointer to the next transaction in the calldata.\n * @param _txDataLength Length of the transaction item.\n * @return Hash of the sequencer element.\n */\n function _getSequencerLeafHash(\n BatchContext memory _context,\n uint256 _nextTransactionPtr,\n uint256 _txDataLength\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + _txDataLength);\n uint256 ctxTimestamp = _context.timestamp;\n uint256 ctxBlockNumber = _context.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(chainElement, 0x20)\n\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\n // This distinguishes sequencer ChainElements from queue ChainElements because\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\n // elements is always zero\n mstore8(chainElementStart, 1)\n\n mstore(add(chainElementStart, 1), ctxTimestamp)\n mstore(add(chainElementStart, 33), ctxBlockNumber)\n\n calldatacopy(add(chainElementStart, BYTES_TILL_TX_DATA), add(_nextTransactionPtr, 3), _txDataLength)\n\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, _txDataLength))\n }\n\n return leafHash;\n }\n\n /**\n * Retrieves the hash of a sequencer element.\n * @param _txChainElement The chain element which is hashed to calculate the leaf.\n * @return Hash of the sequencer element.\n */\n function _getSequencerLeafHash(\n Lib_OVMCodec.TransactionChainElement memory _txChainElement\n )\n internal\n view\n returns(\n bytes32\n )\n {\n bytes memory txData = _txChainElement.txData;\n uint256 txDataLength = _txChainElement.txData.length;\n\n bytes memory chainElement = new bytes(BYTES_TILL_TX_DATA + txDataLength);\n uint256 ctxTimestamp = _txChainElement.timestamp;\n uint256 ctxBlockNumber = _txChainElement.blockNumber;\n\n bytes32 leafHash;\n assembly {\n let chainElementStart := add(chainElement, 0x20)\n\n // Set the first byte equal to `1` to indicate this is a sequencer chain element.\n // This distinguishes sequencer ChainElements from queue ChainElements because\n // all queue ChainElements are ABI encoded and the first byte of ABI encoded\n // elements is always zero\n mstore8(chainElementStart, 1)\n\n mstore(add(chainElementStart, 1), ctxTimestamp)\n mstore(add(chainElementStart, 33), ctxBlockNumber)\n\n pop(staticcall(gas(), 0x04, add(txData, 0x20), txDataLength, add(chainElementStart, BYTES_TILL_TX_DATA), txDataLength))\n\n leafHash := keccak256(chainElementStart, add(BYTES_TILL_TX_DATA, txDataLength))\n }\n\n return leafHash;\n }\n\n /**\n * Inserts a batch into the chain of batches.\n * @param _transactionRoot Root of the transaction tree for this batch.\n * @param _batchSize Number of elements in the batch.\n * @param _numQueuedTransactions Number of queue transactions in the batch.\n * @param _timestamp The latest batch timestamp.\n * @param _blockNumber The latest batch blockNumber.\n */\n function _appendBatch(\n bytes32 _transactionRoot,\n uint256 _batchSize,\n uint256 _numQueuedTransactions,\n uint40 _timestamp,\n uint40 _blockNumber\n )\n internal\n {\n (uint40 totalElements, uint40 nextQueueIndex, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n\n Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({\n batchIndex: batches().length(),\n batchRoot: _transactionRoot,\n batchSize: _batchSize,\n prevTotalElements: totalElements,\n extraData: hex\"\"\n });\n\n emit TransactionBatchAppended(\n header.batchIndex,\n header.batchRoot,\n header.batchSize,\n header.prevTotalElements,\n header.extraData\n );\n\n bytes32 batchHeaderHash = Lib_OVMCodec.hashBatchHeader(header);\n bytes27 latestBatchContext = _makeBatchExtraData(\n totalElements + uint40(header.batchSize),\n nextQueueIndex + uint40(_numQueuedTransactions),\n _timestamp,\n _blockNumber\n );\n\n batches().push(batchHeaderHash, latestBatchContext);\n }\n\n /**\n * Checks that the first batch context in a sequencer submission is valid\n * @param _firstContext The batch context to validate.\n */\n function _validateFirstBatchContext(\n BatchContext memory _firstContext\n )\n internal\n view\n {\n // If there are existing elements, this batch must come later.\n if (getTotalElements() > 0) {\n (,, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData();\n require(_firstContext.blockNumber >= lastBlockNumber, \"Context block number is lower than last submitted.\");\n require(_firstContext.timestamp >= lastTimestamp, \"Context timestamp is lower than last submitted.\");\n }\n // Sequencer cannot submit contexts which are more than the force inclusion period old.\n require(_firstContext.timestamp + forceInclusionPeriodSeconds >= block.timestamp, \"Context timestamp too far in the past.\");\n require(_firstContext.blockNumber + forceInclusionPeriodBlocks >= block.number, \"Context block number too far in the past.\");\n }\n\n /**\n * Checks that a given batch context is valid based on its previous context, and the next queue elemtent.\n * @param _prevContext The previously validated batch context.\n * @param _nextContext The batch context to validate with this call.\n * @param _nextQueueIndex Index of the next queue element to process for the _nextContext's subsequentQueueElements.\n */\n function _validateNextBatchContext(\n BatchContext memory _prevContext,\n BatchContext memory _nextContext,\n uint40 _nextQueueIndex\n )\n internal\n view\n {\n // All sequencer transactions' times must increase from the previous ones.\n require(\n _nextContext.timestamp >= _prevContext.timestamp,\n \"Context timestamp values must monotonically increase.\"\n );\n\n require(\n _nextContext.blockNumber >= _prevContext.blockNumber,\n \"Context blockNumber values must monotonically increase.\"\n );\n\n // If there are some queue elements pending:\n if (getQueueLength() - _nextQueueIndex > 0) {\n Lib_OVMCodec.QueueElement memory nextQueueElement = getQueueElement(_nextQueueIndex);\n\n // If the force inclusion period has passed for an enqueued transaction, it MUST be the next chain element.\n require(\n block.timestamp < nextQueueElement.timestamp + forceInclusionPeriodSeconds,\n \"Previously enqueued batches have expired and must be appended before a new sequencer batch.\"\n );\n\n // Just like sequencer transaction times must be increasing relative to each other,\n // We also require that they be increasing relative to any interspersed queue elements.\n require(\n _nextContext.timestamp <= nextQueueElement.timestamp,\n \"Sequencer transaction timestamp exceeds that of next queue element.\"\n );\n\n require(\n _nextContext.blockNumber <= nextQueueElement.blockNumber,\n \"Sequencer transaction blockNumber exceeds that of next queue element.\"\n );\n }\n }\n\n /**\n * Checks that the final batch context in a sequencer submission is valid.\n * @param _finalContext The batch context to validate.\n */\n function _validateFinalBatchContext(\n BatchContext memory _finalContext\n )\n internal\n view\n {\n // Batches cannot be added from the future, or subsequent enqueue() contexts would violate monotonicity.\n require(_finalContext.timestamp <= block.timestamp, \"Context timestamp is from the future.\");\n require(_finalContext.blockNumber <= block.number, \"Context block number is from the future.\");\n }\n\n /**\n * Hashes a transaction chain element.\n * @param _element Chain element to hash.\n * @return Hash of the chain element.\n */\n function _hashTransactionChainElement(\n Lib_OVMCodec.TransactionChainElement memory _element\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(\n abi.encode(\n _element.isSequenced,\n _element.queueIndex,\n _element.timestamp,\n _element.blockNumber,\n _element.txData\n )\n );\n }\n\n /**\n * Verifies a sequencer transaction, returning true if it was indeed included in the CTC\n * @param _transaction The transaction we are verifying inclusion of.\n * @param _txChainElement The chain element that the transaction is claimed to be a part of.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof An inclusion proof into the CTC at a particular index.\n * @return True if the transaction was included in the specified location, else false.\n */\n function _verifySequencerTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n Lib_OVMCodec.TransactionChainElement memory _txChainElement,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n internal\n view\n returns (\n bool\n )\n {\n OVM_ExecutionManager ovmExecutionManager = OVM_ExecutionManager(resolve(\"OVM_ExecutionManager\"));\n uint256 gasLimit = ovmExecutionManager.getMaxTransactionGasLimit();\n bytes32 leafHash = _getSequencerLeafHash(_txChainElement);\n\n require(\n _verifyElement(\n leafHash,\n _batchHeader,\n _inclusionProof\n ),\n \"Invalid Sequencer transaction inclusion proof.\"\n );\n\n require(\n _transaction.blockNumber == _txChainElement.blockNumber\n && _transaction.timestamp == _txChainElement.timestamp\n && _transaction.entrypoint == resolve(\"OVM_DecompressionPrecompileAddress\")\n && _transaction.gasLimit == gasLimit\n && _transaction.l1TxOrigin == address(0)\n && _transaction.l1QueueOrigin == Lib_OVMCodec.QueueOrigin.SEQUENCER_QUEUE\n && keccak256(_transaction.data) == keccak256(_txChainElement.txData),\n \"Invalid Sequencer transaction.\"\n );\n\n return true;\n }\n\n /**\n * Verifies a queue transaction, returning true if it was indeed included in the CTC\n * @param _transaction The transaction we are verifying inclusion of.\n * @param _queueIndex The queueIndex of the queued transaction.\n * @param _batchHeader Header of the batch the transaction was included in.\n * @param _inclusionProof An inclusion proof into the CTC at a particular index (should point to queue tx).\n * @return True if the transaction was included in the specified location, else false.\n */\n function _verifyQueueTransaction(\n Lib_OVMCodec.Transaction memory _transaction,\n uint256 _queueIndex,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _inclusionProof\n )\n internal\n view\n returns (\n bool\n )\n {\n bytes32 leafHash = _getQueueLeafHash(_queueIndex);\n\n require(\n _verifyElement(\n leafHash,\n _batchHeader,\n _inclusionProof\n ),\n \"Invalid Queue transaction inclusion proof.\"\n );\n\n bytes32 transactionHash = keccak256(\n abi.encode(\n _transaction.l1TxOrigin,\n _transaction.entrypoint,\n _transaction.gasLimit,\n _transaction.data\n )\n );\n\n Lib_OVMCodec.QueueElement memory el = getQueueElement(_queueIndex);\n require(\n el.queueRoot == transactionHash\n && el.timestamp == _transaction.timestamp\n && el.blockNumber == _transaction.blockNumber,\n \"Invalid Queue transaction.\"\n );\n\n return true;\n }\n\n /**\n * Verifies a batch inclusion proof.\n * @param _element Hash of the element to verify a proof for.\n * @param _batchHeader Header of the batch in which the element was included.\n * @param _proof Merkle inclusion proof for the element.\n */\n function _verifyElement(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n require(\n Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(uint32(_batchHeader.batchIndex)),\n \"Invalid batch header.\"\n );\n\n require(\n Lib_MerkleTree.verify(\n _batchHeader.batchRoot,\n _element,\n _proof.index,\n _proof.siblings,\n _batchHeader.batchSize\n ),\n \"Invalid inclusion proof.\"\n );\n\n return true;\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_Math.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title Lib_Math\n */\nlibrary Lib_Math {\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Calculates the minumum of two numbers.\n * @param _x First number to compare.\n * @param _y Second number to compare.\n * @return Lesser of the two numbers.\n */\n function min(\n uint256 _x,\n uint256 _y\n )\n internal\n pure\n returns (\n uint256\n )\n {\n if (_x < _y) {\n return _x;\n }\n\n return _y;\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_AddressManager } from \"../../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_CanonicalTransactionChain } from \"../../../iOVM/chain/iOVM_CanonicalTransactionChain.sol\";\nimport { iOVM_StateCommitmentChain } from \"../../../iOVM/chain/iOVM_StateCommitmentChain.sol\";\n\n/* Contract Imports */\nimport { Abs_BaseCrossDomainMessenger } from \"./Abs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_L1CrossDomainMessenger\n * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. \n * In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted \n * via this contract's replay function. \n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * Pass a default zero address to the address resolver. This will be updated when initialized.\n */\n constructor()\n public\n Lib_AddressResolver(address(0))\n {}\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n function initialize(\n address _libAddressManager\n )\n public\n {\n require(address(libAddressManager) == address(0), \"L1CrossDomainMessenger already intialized.\");\n libAddressManager = Lib_AddressManager(_libAddressManager);\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the OVM_L2MessageRelayer contract may successfully call a method.\n */\n modifier onlyRelayer() {\n address relayer = resolve(\"OVM_L2MessageRelayer\");\n if (relayer != address(0)) {\n require(\n msg.sender == relayer,\n \"Only OVM_L2MessageRelayer can relay L2-to-L1 messages.\"\n );\n }\n _;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc iOVM_L1CrossDomainMessenger\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n )\n override\n public\n nonReentrant\n onlyRelayer()\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n _verifyXDomainMessage(\n xDomainCalldata,\n _proof\n ) == true,\n \"Provided message could not be verified.\"\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n xDomainMessageSender = _sender;\n (bool success, ) = _target.call(_message);\n\n // Mark the message as received if the call was successful. Ensures that a message can be\n // relayed multiple times in the case that the call reverted.\n if (success == true) {\n successfulMessages[xDomainCalldataHash] = true;\n emit RelayedMessage(xDomainCalldataHash);\n }\n\n // Store an identifier that can be used to prove that the given message was relayed by some\n // user. Gives us an easy way to pay relayers for their work.\n bytes32 relayId = keccak256(\n abi.encodePacked(\n xDomainCalldata,\n msg.sender,\n block.number\n )\n );\n relayedMessages[relayId] = true;\n }\n\n /**\n * Replays a cross domain message to the target messenger.\n * @inheritdoc iOVM_L1CrossDomainMessenger\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n sentMessages[keccak256(xDomainCalldata)] == true,\n \"Provided message has not already been sent.\"\n );\n\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Verifies that the given message is valid.\n * @param _xDomainCalldata Calldata to verify.\n * @param _proof Inclusion proof for the message.\n * @return Whether or not the provided message is valid.\n */\n function _verifyXDomainMessage(\n bytes memory _xDomainCalldata,\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n return (\n _verifyStateRootProof(_proof)\n && _verifyStorageProof(_xDomainCalldata, _proof)\n );\n }\n\n /**\n * Verifies that the state root within an inclusion proof is valid.\n * @param _proof Message inclusion proof.\n * @return Whether or not the provided proof is valid.\n */\n function _verifyStateRootProof(\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve(\"OVM_StateCommitmentChain\"));\n\n return (\n ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) == false\n && ovmStateCommitmentChain.verifyStateCommitment(\n _proof.stateRoot,\n _proof.stateRootBatchHeader,\n _proof.stateRootProof\n )\n );\n }\n\n /**\n * Verifies that the storage proof within an inclusion proof is valid.\n * @param _xDomainCalldata Encoded message calldata.\n * @param _proof Message inclusion proof.\n * @return Whether or not the provided proof is valid.\n */\n function _verifyStorageProof(\n bytes memory _xDomainCalldata,\n L2MessageInclusionProof memory _proof\n )\n internal\n view\n returns (\n bool\n )\n {\n bytes32 storageKey = keccak256(\n abi.encodePacked(\n keccak256(\n abi.encodePacked(\n _xDomainCalldata,\n resolve(\"OVM_L2CrossDomainMessenger\")\n )\n ),\n uint256(0)\n )\n );\n\n (\n bool exists,\n bytes memory encodedMessagePassingAccount\n ) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(0x4200000000000000000000000000000000000000),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing precompile has not been initialized or invalid proof provided.\"\n );\n\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedMessagePassingAccount\n );\n\n return Lib_SecureMerkleTrie.verifyInclusionProof(\n abi.encodePacked(storageKey),\n abi.encodePacked(uint8(1)),\n _proof.storageTrieWitness,\n account.storageRoot\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n override\n internal\n {\n iOVM_CanonicalTransactionChain(resolve(\"OVM_CanonicalTransactionChain\")).enqueue(\n resolve(\"OVM_L2CrossDomainMessenger\"),\n _gasLimit,\n _message\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/utils/Lib_ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract Lib_ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor () internal {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"./iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L1CrossDomainMessenger\n */\ninterface iOVM_L1CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /*******************\n * Data Structures *\n *******************/\n\n struct L2MessageInclusionProof {\n bytes32 stateRoot;\n Lib_OVMCodec.ChainBatchHeader stateRootBatchHeader;\n Lib_OVMCodec.ChainInclusionProof stateRootProof;\n bytes stateTrieWitness;\n bytes storageTrieWitness;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _proof Inclusion proof for the given message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) external;\n\n /**\n * Replays a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _sender Original sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _gasLimit Gas limit for the provided message.\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/messenging/Abs_BaseCrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/* Library Imports */\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/**\n * @title Abs_BaseCrossDomainMessenger\n * @dev The Base Cross Domain Messenger is an abstract contract providing the interface and common functionality used in the\n * L1 and L2 Cross Domain Messengers. It can also serve as a template for developers wishing to implement a custom bridge \n * contract to suit their needs.\n *\n * Compiler used: defined by child contract\n * Runtime target: defined by child contract\n */\nabstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger, Lib_ReentrancyGuard {\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public relayedMessages;\n mapping (bytes32 => bool) public successfulMessages;\n mapping (bytes32 => bool) public sentMessages;\n uint256 public messageNonce;\n address override public xDomainMessageSender;\n\n /********************\n * Public Functions *\n ********************/\n\n constructor() Lib_ReentrancyGuard() internal {}\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n messageNonce += 1;\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n _sendXDomainMessage(xDomainCalldata, _gasLimit);\n emit SentMessage(xDomainCalldata);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Generates the correct cross domain calldata for a message.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @return ABI encoded cross domain calldata.\n */\n function _getXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n )\n internal\n pure\n returns (\n bytes memory\n )\n {\n return abi.encodeWithSignature(\n \"relayMessage(address,address,bytes,uint256)\",\n _target,\n _sender,\n _message,\n _messageNonce\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit Gas limit for the provided message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n virtual\n internal\n {\n revert(\"Implement me in child contracts!\");\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iAbs_BaseCrossDomainMessenger\n */\ninterface iAbs_BaseCrossDomainMessenger {\n\n /**********\n * Events *\n **********/\n event SentMessage(bytes message);\n event RelayedMessage(bytes32 msgHash);\n\n /**********************\n * Contract Variables *\n **********************/\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_ReentrancyGuard } from \"../../../libraries/utils/Lib_ReentrancyGuard.sol\";\n\n/* Interface Imports */\nimport { iOVM_L2CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L2CrossDomainMessenger.sol\";\nimport { iOVM_L1MessageSender } from \"../../../iOVM/precompiles/iOVM_L1MessageSender.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../../../iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol\";\n\n/* Contract Imports */\nimport { Abs_BaseCrossDomainMessenger } from \"./Abs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_L2CrossDomainMessenger\n * @dev The L2 Cross Domain Messenger contract sends messages from L2 to L1, and is the entry point\n * for L2 messages sent via the L1 Cross Domain Messenger.\n * \n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCrossDomainMessenger, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc iOVM_L2CrossDomainMessenger\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n )\n override\n nonReentrant\n public\n {\n require(\n _verifyXDomainMessage() == true,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = _getXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n xDomainMessageSender = _sender;\n (bool success, ) = _target.call(_message);\n\n // Mark the message as received if the call was successful. Ensures that a message can be\n // relayed multiple times in the case that the call reverted.\n if (success == true) {\n successfulMessages[xDomainCalldataHash] = true;\n emit RelayedMessage(xDomainCalldataHash);\n }\n\n // Store an identifier that can be used to prove that the given message was relayed by some\n // user. Gives us an easy way to pay relayers for their work.\n bytes32 relayId = keccak256(\n abi.encodePacked(\n xDomainCalldata,\n msg.sender,\n block.number\n )\n );\n relayedMessages[relayId] = true;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Verifies that a received cross domain message is valid.\n * @return _valid Whether or not the message is valid.\n */\n function _verifyXDomainMessage()\n internal\n returns (\n bool _valid\n )\n {\n return (\n iOVM_L1MessageSender(resolve(\"OVM_L1MessageSender\")).getL1MessageSender() == resolve(\"OVM_L1CrossDomainMessenger\")\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _message Message to send.\n * @param _gasLimit Gas limit for the provided message.\n */\n function _sendXDomainMessage(\n bytes memory _message,\n uint256 _gasLimit\n )\n override\n internal\n {\n iOVM_L2ToL1MessagePasser(resolve(\"OVM_L2ToL1MessagePasser\")).passMessageToL1(_message);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"./iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title iOVM_L2CrossDomainMessenger\n */\ninterface iOVM_L2CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) external;\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_L1MessageSender.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_L1MessageSender\n */\ninterface iOVM_L1MessageSender {\n\n /********************\n * Public Functions *\n ********************/\n\n function getL1MessageSender() external view returns (address _l1MessageSender);\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(\n uint256 _nonce,\n address _sender,\n bytes _data\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_L2ToL1MessagePasser.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_L2ToL1MessagePasser } from \"../../iOVM/precompiles/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title OVM_L2ToL1MessagePasser\n * @dev The L2 to L1 Message Passer is a utility contract which facilitate an L1 proof of the \n * of a message on L2. The L1 Cross Domain Messenger performs this proof in its\n * _verifyStorageProof function, which verifies the existence of the transaction hash in this \n * contract's `sentMessages` mapping.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser {\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping (bytes32 => bool) public sentMessages;\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Passes a message to L1.\n * @param _message Message to pass to L1.\n */\n function passMessageToL1(\n bytes memory _message\n )\n override\n public\n {\n // Note: although this function is public, only messages sent from the OVM_L2CrossDomainMessenger \n // will be relayed by the OVM_L1CrossDomainMessenger. This is enforced by a check in \n // OVM_L1CrossDomainMessenger._verifyStorageProof().\n sentMessages[keccak256(\n abi.encodePacked(\n _message,\n msg.sender\n )\n )] = true;\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_L1MessageSender.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_L1MessageSender } from \"../../iOVM/precompiles/iOVM_L1MessageSender.sol\";\nimport { iOVM_ExecutionManager } from \"../../iOVM/execution/iOVM_ExecutionManager.sol\";\n\n/**\n * @title OVM_L1MessageSender\n * @dev The L1MessageSender is a predeploy contract running on L2. During the execution of cross \n * domain transaction from L1 to L2, it returns the address of the L1 account (either an EOA or\n * contract) which sent the message to L2 via the Canonical Transaction Chain's `enqueue()` \n * function.\n * \n * This contract exclusively serves as a getter for the ovmL1TXORIGIN operation. This is necessary \n * because there is no corresponding operation in the EVM which the the optimistic solidity compiler \n * can be replaced with a call to the ExecutionManager's ovmL1TXORIGIN() function.\n *\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_L1MessageSender is iOVM_L1MessageSender {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @return _l1MessageSender L1 message sender address (msg.sender).\n */\n function getL1MessageSender()\n override\n public\n view\n returns (\n address _l1MessageSender\n )\n {\n // Note that on L2 msg.sender (ie. evmCALLER) will always be the Execution Manager \n return iOVM_ExecutionManager(msg.sender).ovmL1TXORIGIN();\n }\n}\n" - }, - "contracts/optimistic-ethereum/mockOVM/bridge/mockOVM_CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Contract Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title mockOVM_CrossDomainMessenger\n */\ncontract mockOVM_CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {\n\n /***********\n * Structs *\n ***********/\n\n struct ReceivedMessage {\n uint256 timestamp;\n address target;\n address sender;\n bytes message;\n uint256 messageNonce;\n uint32 gasLimit;\n }\n\n\n /**********************\n * Contract Variables *\n **********************/\n\n ReceivedMessage[] internal fullReceivedMessages;\n address internal targetMessengerAddress;\n uint256 internal lastRelayedMessage;\n uint256 internal delay;\n uint256 public messageNonce;\n address override public xDomainMessageSender;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _delay Time in seconds before a message can be relayed.\n */\n constructor(\n uint256 _delay\n )\n public\n {\n delay = _delay;\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sets the target messenger address.\n * @dev Currently, this function is public and therefore allows anyone to modify the target\n * messenger for a given xdomain messenger contract. Obviously this shouldn't be allowed,\n * but we still need to determine an adequate mechanism for updating this address.\n * @param _targetMessengerAddress New messenger address.\n */\n function setTargetMessengerAddress(\n address _targetMessengerAddress\n )\n public\n {\n targetMessengerAddress = _targetMessengerAddress;\n }\n\n /**\n * Sends a message to another mock xdomain messenger.\n * @param _target Target for the message.\n * @param _message Message to send.\n * @param _gasLimit Amount of gas to send with the call.\n */\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n )\n override\n public\n {\n mockOVM_CrossDomainMessenger targetMessenger = mockOVM_CrossDomainMessenger(\n targetMessengerAddress\n );\n\n // Just send it over!\n targetMessenger.receiveMessage(ReceivedMessage({\n timestamp: block.timestamp,\n target: _target,\n sender: msg.sender,\n message: _message,\n messageNonce: messageNonce,\n gasLimit: _gasLimit\n }));\n\n messageNonce += 1;\n }\n\n /**\n * Receives a message to be sent later.\n * @param _message Message to send later.\n */\n function receiveMessage(\n ReceivedMessage memory _message\n )\n public\n {\n fullReceivedMessages.push(_message);\n }\n\n /**\n * Checks whether we have messages to relay.\n * @param _exists Whether or not we have more messages to relay.\n */\n function hasNextMessage()\n public\n view\n returns (\n bool _exists\n )\n {\n return fullReceivedMessages.length > lastRelayedMessage;\n }\n\n /**\n * Relays the last received message not yet relayed.\n */\n function relayNextMessage()\n public\n {\n require(hasNextMessage(), \"No pending messages to relay\");\n ReceivedMessage memory nextMessage = fullReceivedMessages[lastRelayedMessage];\n require(nextMessage.timestamp + delay < block.timestamp, \"Message is not ready to be relayed. The delay period is not up yet!\");\n\n xDomainMessageSender = nextMessage.sender;\n (bool success,) = nextMessage.target.call{gas: nextMessage.gasLimit}(nextMessage.message);\n require(success, \"Cross-domain message call reverted. Did you set your gas limit high enough?\");\n lastRelayedMessage += 1;\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n/* Interface Imports */\nimport { iAbs_BaseCrossDomainMessenger } from \"../../iOVM/bridge/messenging/iAbs_BaseCrossDomainMessenger.sol\";\n\n/**\n * @title OVM_CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n * Runtime target: defined by inheriting contract\n */\ncontract OVM_CrossDomainEnabled {\n // Messenger contract used to send and recieve messages from the other domain.\n address public messenger;\n\n uint32 public constant DEFAULT_FINALIZE_DEPOSIT_L2_GAS = 700000;\n uint32 public constant DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS = 100000;\n\n /***************\n * Constructor *\n ***************/ \n constructor(\n address _messenger\n ) {\n messenger = _messenger;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * @notice Enforces that the modified function is only callable by a specific cross-domain account.\n * @param _sourceDomainAccount The only account on the originating domain which is authenticated to call this function.\n */\n modifier onlyFromCrossDomainAccount(\n address _sourceDomainAccount\n ) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n \n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * @notice Gets the messenger, usually from storage. This function is exposed in case a child contract needs to override.\n * @return The address of the cross-domain messenger contract which should be used. \n */\n function getCrossDomainMessenger()\n internal\n virtual\n returns(\n iAbs_BaseCrossDomainMessenger\n )\n {\n return iAbs_BaseCrossDomainMessenger(messenger);\n }\n\n /**\n * @notice Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _data The data to send to the target (usually calldata to a function with `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n bytes memory _data,\n uint32 _gasLimit\n ) internal {\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _data, _gasLimit);\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L2DepositedERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_L1ERC20Gateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\n\n/* Contract Imports */\nimport { UniswapV2ERC20 } from \"../../../libraries/standards/UniswapV2ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title OVM_L2DepositedERC20\n * @dev The L2 Deposited ERC20 is an ERC20 implementation which represents L1 assets deposited into L2.\n * This contract mints new tokens when it hears about deposits into the L1 ERC20 gateway.\n * This contract also burns the tokens intended for withdrawal, informing the L1 gateway to release L1 funds.\n *\n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_L2DepositedERC20 is iOVM_L2DepositedERC20, UniswapV2ERC20, OVM_CrossDomainEnabled {\n \n /*******************\n * Contract Events *\n *******************/\n\n event Initialized(iOVM_L1ERC20Gateway _l1ERC20Gateway);\n\n /********************************\n * External Contract References *\n ********************************/\n\n iOVM_L1ERC20Gateway l1ERC20Gateway;\n\n /********************************\n * Constructor & Initialization *\n ********************************/\n\n /**\n * @param _l2CrossDomainMessenger L1 Messenger address being used for cross-chain communications.\n * @param _decimals L2 ERC20 decimals\n * @param _name L2 ERC20 name\n * @param _symbol L2 ERC20 symbol\n */\n constructor(\n address _l2CrossDomainMessenger,\n uint8 _decimals,\n string memory _name,\n string memory _symbol\n )\n public\n OVM_CrossDomainEnabled(_l2CrossDomainMessenger)\n UniswapV2ERC20(_decimals, _name, _symbol)\n {}\n\n /**\n * @dev Initialize this gateway with the L1 gateway address\n * The assumed flow is that this contract is deployed on L2, then the L1 \n * gateway is dpeloyed, and its address passed here to init.\n *\n * @param _l1ERC20Gateway Address of the corresponding L1 gateway deployed to the main chain\n */\n function init(\n iOVM_L1ERC20Gateway _l1ERC20Gateway\n )\n public\n {\n require(address(l1ERC20Gateway) == address(0), \"Contract has already been initialized\");\n\n l1ERC20Gateway = _l1ERC20Gateway;\n \n emit Initialized(l1ERC20Gateway);\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyInitialized() {\n require(address(l1ERC20Gateway) != address(0), \"Contract has not yet been initialized\");\n _;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @dev initiate a withdraw of some ERC20 to the caller's account on L1\n * @param _amount Amount of the ERC20 to withdraw\n */\n function withdraw(\n uint _amount\n )\n external\n override\n onlyInitialized()\n {\n _initiateWithdrawal(msg.sender, _amount);\n }\n\n /**\n * @dev initiate a withdraw of some ERC20 to a recipient's account on L1\n * @param _to L1 adress to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function withdrawTo(address _to, uint _amount) external override onlyInitialized() {\n _initiateWithdrawal(_to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 ERC20 Gateway of the deposit.\n *\n * @param _to Account to give the withdrawal to on L1\n * @param _amount Amount of the ERC20 to withdraw\n */\n function _initiateWithdrawal(address _to, uint _amount) internal {\n // burn L2 funds so they can't be used more on L2\n _burn(msg.sender, _amount);\n\n // Construct calldata for l1ERC20Gateway.finalizeWithdrawal(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L1ERC20Gateway.finalizeWithdrawal.selector,\n _to,\n _amount\n );\n\n // Send message up to L1 gateway\n sendCrossDomainMessage(\n address(l1ERC20Gateway),\n data,\n DEFAULT_FINALIZE_WITHDRAWAL_L1_GAS\n );\n\n emit WithdrawalInitiated(msg.sender, _to, _amount);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this \n * L2 ERC20 token. \n * This call will fail if it did not originate from a corresponding deposit in OVM_L1ERC20Gateway. \n *\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeDeposit(address _to, uint _amount) external override onlyInitialized()\n onlyFromCrossDomainAccount(address(l1ERC20Gateway))\n {\n _mint(_to, _amount);\n emit DepositFinalized(_to, _amount);\n }\n}" - }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { IUniswapV2ERC20 } from \"../../../libraries/standards/IUniswapV2ERC20.sol\";\n\n/**\n * @title iOVM_L2DepositedERC20\n */\ninterface iOVM_L2DepositedERC20 is IUniswapV2ERC20 {\n\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n\n event DepositFinalized(\n address indexed _to,\n uint256 _amount\n ); \n\n\n /********************\n * Public Functions *\n ********************/\n\n function withdraw(\n uint _amount\n )\n external;\n\n function withdrawTo(\n address _to,\n uint _amount\n )\n external;\n\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeDeposit(\n address _to,\n uint _amount\n )\n external;\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ERC20Gateway\n */\ninterface iOVM_L1ERC20Gateway {\n\n /**********\n * Events *\n **********/\n\n event DepositInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n \n event WithdrawalFinalized(\n address indexed _to,\n uint256 _amount\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function deposit(\n uint _amount\n )\n external;\n\n function depositTo(\n address _to,\n uint _amount\n )\n external;\n\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external;\n}\n" - }, - "contracts/optimistic-ethereum/libraries/standards/UniswapV2ERC20.sol": { - "content": "pragma solidity >=0.5.16 <0.8.0;\n\nimport './IUniswapV2ERC20.sol';\nimport './UniSafeMath.sol';\n\ncontract UniswapV2ERC20 is IUniswapV2ERC20 {\n using UniSafeMath for uint;\n\n string public override name;\n string public override symbol;\n uint8 public override immutable decimals;\n uint public override totalSupply;\n mapping(address => uint) public override balanceOf;\n mapping(address => mapping(address => uint)) public override allowance;\n\n bytes32 public override DOMAIN_SEPARATOR;\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n mapping(address => uint) public override nonces;\n\n constructor(\n uint8 _decimals,\n string memory _name,\n string memory _symbol\n ) public {\n decimals = _decimals;\n name = _name;\n symbol = _symbol;\n\n uint chainId;\n assembly {\n chainId := chainid()\n }\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),\n keccak256(bytes(name)),\n keccak256(bytes('1')),\n chainId,\n address(this)\n )\n );\n }\n\n function _mint(address to, uint value) internal {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _burn(address from, uint value) internal {\n balanceOf[from] = balanceOf[from].sub(value);\n totalSupply = totalSupply.sub(value);\n emit Transfer(from, address(0), value);\n }\n\n function _approve(address owner, address spender, uint value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint value) external override returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint value) external override returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint value) external override returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {\n require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');\n bytes32 digest = keccak256(\n abi.encodePacked(\n '\\x19\\x01',\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');\n _approve(owner, spender, value);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/standards/IUniswapV2ERC20.sol": { - "content": "pragma solidity >=0.5.16 <0.8.0;\n\ninterface IUniswapV2ERC20 {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n}\n" - }, - "contracts/optimistic-ethereum/libraries/standards/UniSafeMath.sol": { - "content": "pragma solidity >=0.5.16 <0.8.0;\n\n// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)\n\nlibrary UniSafeMath {\n function add(uint x, uint y) internal pure returns (uint z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint x, uint y) internal pure returns (uint z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint x, uint y) internal pure returns (uint z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_ETH.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { iOVM_L1ERC20Gateway } from \"../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\n\n/* Contract Imports */\nimport { OVM_L2DepositedERC20 } from \"../bridge/tokens/OVM_L2DepositedERC20.sol\";\n\n/**\n * @title OVM_ETH\n * @dev The ETH predeploy provides an ERC20 interface for ETH deposited to Layer 2. Note that \n * unlike on Layer 1, Layer 2 accounts do not have a balance field.\n * \n * Compiler used: optimistic-solc\n * Runtime target: OVM\n */\ncontract OVM_ETH is OVM_L2DepositedERC20 {\n constructor(\n address _l2CrossDomainMessenger,\n address _l1ETHGateway\n ) \n OVM_L2DepositedERC20(\n _l2CrossDomainMessenger,\n 18, // WETH decimals\n \"ovmWETH\",\n \"oWETH\"\n )\n public \n {\n init(iOVM_L1ERC20Gateway(_l1ETHGateway));\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ERC20Gateway.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm \npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1ERC20Gateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ERC20Gateway.sol\";\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/precompiles/iOVM_ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\n\n/**\n * @title OVM_L1ERC20Gateway\n * @dev The L1 ERC20 Gateway is a contract which stores deposited L1 funds that are in use on L2.\n * It synchronizes a corresponding L2 ERC20 Gateway, informing it of deposits, and listening to it \n * for newly finalized withdrawals.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ERC20Gateway is iOVM_L1ERC20Gateway, OVM_CrossDomainEnabled {\n \n /********************************\n * External Contract References *\n ********************************/\n \n iOVM_ERC20 public l1ERC20;\n address public l2DepositedERC20;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1ERC20 L1 ERC20 address this contract stores deposits for\n * @param _l2DepositedERC20 L2 Gateway address on the chain being deposited into\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n */\n constructor(\n iOVM_ERC20 _l1ERC20,\n address _l2DepositedERC20,\n address _l1messenger \n )\n OVM_CrossDomainEnabled(_l1messenger)\n {\n l1ERC20 = _l1ERC20;\n l2DepositedERC20 = _l2DepositedERC20;\n }\n\n /**************\n * Depositing *\n **************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2\n * @param _amount Amount of the ERC20 to deposit\n */\n function deposit(\n uint _amount\n )\n external\n override\n {\n _initiateDeposit(msg.sender, msg.sender, _amount);\n }\n\n /**\n * @dev deposit an amount of ERC20 to a recipients's balance on L2\n * @param _to L2 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to deposit\n */\n function depositTo(\n address _to,\n uint _amount\n )\n external\n override\n {\n _initiateDeposit(msg.sender, _to, _amount);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 Deposited ERC20 contract of the deposit.\n *\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n * @param _amount Amount of the ERC20 to deposit.\n */\n function _initiateDeposit(\n address _from,\n address _to,\n uint _amount\n )\n internal\n {\n // Hold on to the newly deposited funds\n l1ERC20.transferFrom(\n _from,\n address(this),\n _amount\n );\n\n // Construct calldata for l2DepositedERC20.finalizeDeposit(_to, _amount)\n bytes memory data = abi.encodeWithSelector(\n iOVM_L2DepositedERC20.finalizeDeposit.selector,\n _to,\n _amount\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2DepositedERC20,\n data,\n DEFAULT_FINALIZE_DEPOSIT_L2_GAS\n );\n\n emit DepositInitiated(_from, _to, _amount);\n }\n\n /*************************************\n * Cross-chain Function: Withdrawing *\n *************************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the \n * L1 ERC20 token. \n * This call will fail if the initialized withdrawal from L2 has not been finalized. \n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external\n override \n onlyFromCrossDomainAccount(l2DepositedERC20)\n {\n l1ERC20.transfer(_to, _amount);\n\n emit WithdrawalFinalized(_to, _amount);\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/precompiles/iOVM_ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/**\n * @title iOVM_ERC20\n */\ninterface iOVM_ERC20 {\n /* This is a slight change to the ERC20 base standard.\n function totalSupply() constant returns (uint256 supply);\n is replaced with:\n uint256 public totalSupply;\n This automatically creates a getter function for the totalSupply.\n This is moved to the base contract since public getter functions are not\n currently recognised as an implementation of the matching abstract\n function by the compiler.\n */\n /// total amount of tokens\n function totalSupply() external view returns (uint256);\n\n /// @param _owner The address from which the balance will be retrieved\n /// @return balance The balance\n function balanceOf(address _owner) external view returns (uint256 balance);\n\n /// @notice send `_value` token to `_to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return success Whether the transfer was successful or not\n function transfer(address _to, uint256 _value) external returns (bool success);\n\n /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return success Whether the transfer was successful or not\n function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);\n\n /// @notice `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of tokens to be approved for transfer\n /// @return success Whether the approval was successful or not\n function approve(address _spender, uint256 _value) external returns (bool success);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return remaining Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender) external view returns (uint256 remaining);\n\n // solhint-disable-next-line no-simple-event-func-name\n event Transfer(address indexed _from, address indexed _to, uint256 _value);\n event Approval(address indexed _owner, address indexed _spender, uint256 _value);\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/tokens/OVM_L1ETHGateway.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1ETHGateway } from \"../../../iOVM/bridge/tokens/iOVM_L1ETHGateway.sol\";\nimport { iOVM_L2DepositedERC20 } from \"../../../iOVM/bridge/tokens/iOVM_L2DepositedERC20.sol\";\nimport { iOVM_ERC20 } from \"../../../iOVM/precompiles/iOVM_ERC20.sol\";\n\n/* Library Imports */\nimport { OVM_CrossDomainEnabled } from \"../../../libraries/bridge/OVM_CrossDomainEnabled.sol\";\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title OVM_L1ETHGateway\n * @dev The L1 ETH Gateway is a contract which stores deposited ETH that is in use on L2.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_AddressResolver {\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2ERC20Gateway;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address manager for this OE deployment\n */\n constructor(\n address _libAddressManager,\n address _l2ERC20Gateway\n )\n OVM_CrossDomainEnabled(address(0)) // overridden in constructor code\n Lib_AddressResolver(_libAddressManager)\n {\n l2ERC20Gateway = _l2ERC20Gateway;\n messenger = resolve(\"Proxy__OVM_L1CrossDomainMessenger\"); // overrides OVM_CrossDomainEnabled constructor setting because resolve() is not yet accessible\n }\n\n /**************\n * Depositing *\n **************/\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2\n */\n function deposit() \n external\n override\n payable\n {\n _initiateDeposit(msg.sender, msg.sender);\n }\n\n /**\n * @dev deposit an amount of ERC20 to a recipients's balance on L2\n * @param _to L2 address to credit the withdrawal to\n */\n function depositTo(\n address _to\n )\n external\n override\n payable\n {\n _initiateDeposit(msg.sender, _to);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ERC20 and informing the L2 ERC20 Gateway of the deposit.\n *\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n */\n function _initiateDeposit(\n address _from,\n address _to\n )\n internal\n {\n // Construct calldata for l2ERC20Gateway.finalizeDeposit(_to, _amount)\n bytes memory data =\n abi.encodeWithSelector(\n iOVM_L2DepositedERC20.finalizeDeposit.selector,\n _to,\n msg.value\n );\n\n // Send calldata into L2\n sendCrossDomainMessage(\n l2ERC20Gateway,\n data,\n DEFAULT_FINALIZE_DEPOSIT_L2_GAS\n );\n\n emit DepositInitiated(_from, _to, msg.value);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _to L1 address to credit the withdrawal to\n * @param _amount Amount of the ERC20 to withdraw\n */\n function finalizeWithdrawal(\n address _to,\n uint256 _amount\n )\n external\n override\n onlyFromCrossDomainAccount(l2ERC20Gateway)\n {\n _safeTransferETH(_to, _amount);\n\n emit WithdrawalFinalized(_to, _amount);\n }\n\n /**********************************\n * Internal Functions: Accounting *\n **********************************/\n\n /**\n * @dev Internal accounting function for moving around L1 ETH.\n *\n * @param _to L1 address to transfer ETH to\n * @param _value Amount of ETH to send to\n */\n function _safeTransferETH(\n address _to,\n uint256 _value\n )\n internal\n {\n (bool success, ) = _to.call{value: _value}(new bytes(0));\n require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');\n }\n\n /**\n * @dev Prevent users from sending ETH directly to this contract without calling deposit\n */\n receive()\n external\n payable\n {\n revert(\"Deposits must be initiated via deposit() or depositTo()\");\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/tokens/iOVM_L1ETHGateway.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0;\npragma experimental ABIEncoderV2;\n\n/**\n * @title iOVM_L1ETHGateway\n */\ninterface iOVM_L1ETHGateway {\n\n /**********\n * Events *\n **********/\n\n event DepositInitiated(\n address indexed _from,\n address _to,\n uint256 _amount\n );\n\n event WithdrawalFinalized(\n address indexed _to,\n uint256 _amount\n );\n\n\n /********************\n * Public Functions *\n ********************/\n\n function deposit()\n external\n payable;\n\n function depositTo(\n address _to\n )\n external\n payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n function finalizeWithdrawal(\n address _to,\n uint _amount\n )\n external;\n}\n" - }, - "contracts/optimistic-ethereum/OVM/bridge/messenging/OVM_L1MultiMessageRelayer.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\nimport { iOVM_L1MultiMessageRelayer } from \"../../../iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../../libraries/resolver/Lib_AddressResolver.sol\";\n\n\n/**\n * @title OVM_L1MultiMessageRelayer\n * @dev The L1 Multi-Message Relayer contract is a gas efficiency optimization which enables the \n * relayer to submit multiple messages in a single transaction to be relayed by the L1 Cross Domain\n * Message Sender.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_L1MultiMessageRelayer is iOVM_L1MultiMessageRelayer, Lib_AddressResolver {\n\n /***************\n * Constructor *\n ***************/\n constructor(\n address _libAddressManager\n ) \n Lib_AddressResolver(_libAddressManager)\n {}\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyBatchRelayer() {\n require(\n msg.sender == resolve(\"OVM_L2BatchMessageRelayer\"),\n \"OVM_L1MultiMessageRelayer: Function can only be called by the OVM_L2BatchMessageRelayer\"\n );\n _;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @notice Forwards multiple cross domain messages to the L1 Cross Domain Messenger for relaying\n * @param _messages An array of L2 to L1 messages\n */\n function batchRelayMessages(L2ToL1Message[] calldata _messages) \n override\n external\n onlyBatchRelayer \n {\n iOVM_L1CrossDomainMessenger messenger = iOVM_L1CrossDomainMessenger(resolve(\"Proxy__OVM_L1CrossDomainMessenger\"));\n for (uint256 i = 0; i < _messages.length; i++) {\n L2ToL1Message memory message = _messages[i];\n messenger.relayMessage(\n message.target,\n message.sender,\n message.message,\n message.messageNonce,\n message.proof\n );\n }\n }\n}\n" - }, - "contracts/optimistic-ethereum/iOVM/bridge/messenging/iOVM_L1MultiMessageRelayer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_L1CrossDomainMessenger } from \"../../../iOVM/bridge/messenging/iOVM_L1CrossDomainMessenger.sol\";\ninterface iOVM_L1MultiMessageRelayer {\n\n struct L2ToL1Message {\n address target;\n address sender;\n bytes message;\n uint256 messageNonce;\n iOVM_L1CrossDomainMessenger.L2MessageInclusionProof proof;\n }\n\n function batchRelayMessages(L2ToL1Message[] calldata _messages) external; \n}\n" - }, - "contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_SecureMerkleTrie } from \"../../optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol\";\n\n/**\n * @title TestLib_SecureMerkleTrie\n */\ncontract TestLib_SecureMerkleTrie {\n\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_SecureMerkleTrie.verifyInclusionProof(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_SecureMerkleTrie.verifyExclusionProof(\n _key,\n _proof,\n _root\n );\n }\n\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_SecureMerkleTrie.update(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool,\n bytes memory\n )\n {\n return Lib_SecureMerkleTrie.get(\n _key,\n _proof,\n _root\n );\n }\n\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_SecureMerkleTrie.getSingleNodeRootHash(\n _key,\n _value\n );\n }\n}\n" - }, - "contracts/test-libraries/trie/TestLib_MerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"../../optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol\";\n\n/**\n * @title TestLib_MerkleTrie\n */\ncontract TestLib_MerkleTrie {\n\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTrie.verifyInclusionProof(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function verifyExclusionProof(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTrie.verifyExclusionProof(\n _key,\n _proof,\n _root\n );\n }\n\n function update(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_MerkleTrie.update(\n _key,\n _value,\n _proof,\n _root\n );\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n )\n public\n pure\n returns (\n bool,\n bytes memory\n )\n {\n return Lib_MerkleTrie.get(\n _key,\n _proof,\n _root\n );\n }\n\n function getSingleNodeRootHash(\n bytes memory _key,\n bytes memory _value\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_MerkleTrie.getSingleNodeRootHash(\n _key,\n _value\n );\n }\n}\n" - }, - "contracts/test-libraries/rlp/TestLib_RLPWriter.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../../optimistic-ethereum/libraries/rlp/Lib_RLPWriter.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_RLPWriter\n */\ncontract TestLib_RLPWriter {\n\n function writeBytes(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeBytes(_in);\n }\n\n function writeList(\n bytes[] memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeList(_in);\n }\n\n function writeString(\n string memory _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeString(_in);\n }\n\n function writeAddress(\n address _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeAddress(_in);\n }\n\n function writeUint(\n uint256 _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeUint(_in);\n }\n\n function writeBool(\n bool _in\n )\n public\n pure\n returns (\n bytes memory _out\n )\n {\n return Lib_RLPWriter.writeBool(_in);\n }\n\n function writeAddressWithTaintedMemory(\n address _in\n )\n public\n returns (\n bytes memory _out\n )\n {\n new TestERC20();\n return Lib_RLPWriter.writeAddress(_in);\n }\n}\n" - }, - "contracts/test-helpers/TestERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n// a test ERC20 token with an open mint function\ncontract TestERC20 {\n using SafeMath for uint;\n\n string public constant name = 'Test';\n string public constant symbol = 'TST';\n uint8 public constant decimals = 18;\n uint256 public totalSupply;\n mapping(address => uint) public balanceOf;\n mapping(address => mapping(address => uint)) public allowance;\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n constructor() public {}\n\n function mint(address to, uint256 value) public {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _approve(address owner, address spender, uint256 value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint256 value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint256 value) external returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint256 value) external returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint256 value) external returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n}\n\nlibrary SafeMath {\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_BytesUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_BytesUtils.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_BytesUtils\n */\ncontract TestLib_BytesUtils {\n\n function concat(\n bytes memory _preBytes,\n bytes memory _postBytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.concat(\n _preBytes,\n _postBytes\n );\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.slice(\n _bytes,\n _start,\n _length\n );\n }\n\n function toBytes32(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes32)\n {\n return Lib_BytesUtils.toBytes32(\n _bytes\n );\n }\n\n function toUint256(\n bytes memory _bytes\n )\n public\n pure\n returns (uint256)\n {\n return Lib_BytesUtils.toUint256(\n _bytes\n );\n }\n\n function toNibbles(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.toNibbles(\n _bytes\n );\n }\n\n function fromNibbles(\n bytes memory _bytes\n )\n public\n pure\n returns (bytes memory)\n {\n return Lib_BytesUtils.fromNibbles(\n _bytes\n );\n }\n\n function equal(\n bytes memory _bytes,\n bytes memory _other\n )\n public\n pure\n returns (bool)\n {\n return Lib_BytesUtils.equal(\n _bytes,\n _other\n );\n }\n\n function sliceWithTaintedMemory(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n )\n public\n returns (bytes memory)\n {\n new TestERC20();\n return Lib_BytesUtils.slice(\n _bytes,\n _start,\n _length\n );\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_EthUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\n// @unsupported: ovm\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_EthUtils } from \"../../optimistic-ethereum/libraries/utils/Lib_EthUtils.sol\";\n\n/**\n * @title TestLib_EthUtils\n */\ncontract TestLib_EthUtils {\n\n function getCode(\n address _address,\n uint256 _offset,\n uint256 _length\n )\n public\n view\n returns (\n bytes memory _code\n )\n {\n return Lib_EthUtils.getCode(\n _address,\n _offset,\n _length\n );\n }\n\n function getCode(\n address _address\n )\n public\n view\n returns (\n bytes memory _code\n )\n {\n return Lib_EthUtils.getCode(\n _address\n );\n }\n\n function getCodeSize(\n address _address\n )\n public\n view\n returns (\n uint256 _codeSize\n )\n {\n return Lib_EthUtils.getCodeSize(\n _address\n );\n }\n\n function getCodeHash(\n address _address\n )\n public\n view\n returns (\n bytes32 _codeHash\n )\n {\n return Lib_EthUtils.getCodeHash(\n _address\n );\n }\n\n function createContract(\n bytes memory _code\n )\n public\n returns (\n address _created\n )\n {\n return Lib_EthUtils.createContract(\n _code\n );\n }\n\n function getAddressForCREATE(\n address _creator,\n uint256 _nonce\n )\n public\n pure\n returns (\n address _address\n )\n {\n return Lib_EthUtils.getAddressForCREATE(\n _creator,\n _nonce\n );\n }\n\n function getAddressForCREATE2(\n address _creator,\n bytes memory _bytecode,\n bytes32 _salt\n )\n public\n pure\n returns (address _address)\n {\n return Lib_EthUtils.getAddressForCREATE2(\n _creator,\n _bytecode,\n _salt\n );\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_Bytes32Utils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../optimistic-ethereum/libraries/utils/Lib_Bytes32Utils.sol\";\n\n/**\n * @title TestLib_Byte32Utils\n */\ncontract TestLib_Bytes32Utils {\n\n function toBool(\n bytes32 _in\n )\n public\n pure\n returns (\n bool _out\n )\n {\n return Lib_Bytes32Utils.toBool(_in);\n }\n\n function fromBool(\n bool _in\n )\n public\n pure\n returns (\n bytes32 _out\n )\n {\n return Lib_Bytes32Utils.fromBool(_in);\n }\n\n function toAddress(\n bytes32 _in\n )\n public\n pure\n returns (\n address _out\n )\n {\n return Lib_Bytes32Utils.toAddress(_in);\n }\n\n function fromAddress(\n address _in\n )\n public\n pure\n returns (\n bytes32 _out\n )\n {\n return Lib_Bytes32Utils.fromAddress(_in);\n }\n}\n" - }, - "contracts/test-libraries/rlp/TestLib_RLPReader.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../../optimistic-ethereum/libraries/rlp/Lib_RLPReader.sol\";\n\n/**\n * @title TestLib_RLPReader\n */\ncontract TestLib_RLPReader {\n\n function readList(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes[] memory\n )\n {\n Lib_RLPReader.RLPItem[] memory decoded = Lib_RLPReader.readList(_in);\n bytes[] memory out = new bytes[](decoded.length);\n for (uint256 i = 0; i < out.length; i++) {\n out[i] = Lib_RLPReader.readRawBytes(decoded[i]);\n }\n return out;\n }\n\n function readString(\n bytes memory _in\n )\n public\n pure\n returns (\n string memory\n )\n {\n return Lib_RLPReader.readString(_in);\n }\n\n function readBytes(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes memory\n )\n {\n return Lib_RLPReader.readBytes(_in);\n }\n\n function readBytes32(\n bytes memory _in\n )\n public\n pure\n returns (\n bytes32\n )\n {\n return Lib_RLPReader.readBytes32(_in);\n }\n\n function readUint256(\n bytes memory _in\n )\n public\n pure\n returns (\n uint256\n )\n {\n return Lib_RLPReader.readUint256(_in);\n }\n\n function readBool(\n bytes memory _in\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_RLPReader.readBool(_in);\n }\n\n function readAddress(\n bytes memory _in\n )\n public\n pure\n returns (\n address\n )\n {\n return Lib_RLPReader.readAddress(_in);\n }\n}\n" - }, - "contracts/optimistic-ethereum/libraries/resolver/Lib_ResolvedDelegateProxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_ResolvedDelegateProxy\n */\ncontract Lib_ResolvedDelegateProxy {\n\n /*************\n * Variables *\n *************/\n\n\n // Using mappings to store fields to avoid overwriting storage slots in the\n // implementation contract. For example, instead of storing these fields at\n // storage slot `0` & `1`, they are stored at `keccak256(key + slot)`.\n // See: https://solidity.readthedocs.io/en/v0.7.0/internals/layout_in_storage.html\n // NOTE: Do not use this code in your own contract system. \n // There is a known flaw in this contract, and we will remove it from the repository\n // in the near future. Due to the very limited way that we are using it, this flaw is\n // not an issue in our system. \n mapping(address=>string) private implementationName;\n mapping(address=>Lib_AddressManager) private addressManager;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n * @param _implementationName implementationName of the contract to proxy to.\n */\n constructor(\n address _libAddressManager,\n string memory _implementationName\n )\n public\n {\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\n implementationName[address(this)] = _implementationName;\n }\n\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n address target = addressManager[address(this)].getAddress((implementationName[address(this)]));\n require(\n target != address(0),\n \"Target address must be initialized.\"\n );\n\n (bool success, bytes memory returndata) = target.delegatecall(msg.data);\n\n if (success == true) {\n assembly {\n return(add(returndata, 0x20), mload(returndata))\n }\n } else {\n assembly {\n revert(add(returndata, 0x20), mload(returndata))\n }\n }\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_MerkleTree.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_MerkleTree } from \"../../optimistic-ethereum/libraries/utils/Lib_MerkleTree.sol\";\n\n/**\n * @title TestLib_MerkleTree\n */\ncontract TestLib_MerkleTree {\n\n function getMerkleRoot(\n bytes32[] memory _elements\n )\n public\n view\n returns (\n bytes32\n )\n {\n return Lib_MerkleTree.getMerkleRoot(\n _elements\n );\n }\n\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n )\n public\n pure\n returns (\n bool\n )\n {\n return Lib_MerkleTree.verify(\n _root,\n _leaf,\n _index,\n _siblings,\n _totalLeaves\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/mockOVM/verification/mockOVM_BondManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_BondManager } from \"../../iOVM/verification/iOVM_BondManager.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title mockOVM_BondManager\n */\ncontract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {\n constructor(\n address _libAddressManager\n )\n public\n Lib_AddressResolver(_libAddressManager)\n {}\n\n function recordGasSpent(\n bytes32 _preStateRoot,\n bytes32 _txHash,\n address _who,\n uint256 _gasSpent\n )\n override\n public\n {}\n\n function finalize(\n bytes32 _preStateRoot,\n address _publisher,\n uint256 _timestamp\n )\n override\n public\n {}\n\n function deposit()\n override\n public\n {}\n\n function startWithdrawal()\n override\n public\n {}\n\n function finalizeWithdrawal()\n override\n public\n {}\n\n function claim(\n address _who\n )\n override\n public\n {}\n\n function isCollateralized(\n address _who\n )\n override\n public\n view\n returns (\n bool\n )\n {\n // Only authenticate sequencer to submit state root batches.\n return _who == resolve(\"OVM_Sequencer\");\n }\n\n function getGasSpent(\n bytes32 _preStateRoot,\n address _who\n )\n override\n public\n view\n returns (\n uint256\n )\n {\n return 0;\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/execution/OVM_StateManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\nimport { iOVM_StateManagerFactory } from \"../../iOVM/execution/iOVM_StateManagerFactory.sol\";\n\n/* Contract Imports */\nimport { OVM_StateManager } from \"./OVM_StateManager.sol\";\n\n/**\n * @title OVM_StateManagerFactory\n * @dev The State Manager Factory is called by a State Transitioner's init code, to create a new \n * State Manager for use in the Fraud Verification process.\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateManagerFactory is iOVM_StateManagerFactory {\n\n /***************************************\n * Public Functions: Contract Creation *\n ***************************************/\n\n /**\n * Creates a new OVM_StateManager\n * @param _owner Owner of the created contract.\n * @return _ovmStateManager New OVM_StateManager instance.\n */\n function create(\n address _owner\n )\n override\n public\n returns (\n iOVM_StateManager _ovmStateManager\n )\n {\n return new OVM_StateManager(_owner);\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/execution/OVM_StateManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { iOVM_StateManager } from \"../../iOVM/execution/iOVM_StateManager.sol\";\n\n/**\n * @title OVM_StateManager\n * @dev The State Manager contract holds all storage values for contracts in the OVM. It can only be written to by the\n * the Execution Manager and State Transitioner. It runs on L1 during the setup and execution of a fraud proof.\n * The same logic runs on L2, but has been implemented as a precompile in the L2 go-ethereum client\n * (see https://github.com/ethereum-optimism/go-ethereum/blob/master/core/vm/ovm_state_manager.go).\n * \n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_StateManager is iOVM_StateManager {\n\n /**********************\n * Contract Constants *\n **********************/\n\n bytes32 constant internal EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421;\n bytes32 constant internal EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n bytes32 constant internal STORAGE_XOR_VALUE = 0xFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEF;\n\n\n /*******************************************\n * Contract Variables: Contract References *\n *******************************************/\n\n address override public owner;\n address override public ovmExecutionManager;\n\n\n /****************************************\n * Contract Variables: Internal Storage *\n ****************************************/\n\n mapping (address => Lib_OVMCodec.Account) internal accounts;\n mapping (address => mapping (bytes32 => bytes32)) internal contractStorage;\n mapping (address => mapping (bytes32 => bool)) internal verifiedContractStorage;\n mapping (bytes32 => ItemState) internal itemStates;\n uint256 internal totalUncommittedAccounts;\n uint256 internal totalUncommittedContractStorage;\n\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address of the owner of this contract.\n */\n constructor(\n address _owner\n )\n public\n {\n owner = _owner;\n }\n\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Simple authentication, this contract should only be accessible to the owner (which is expected to be the State Transitioner during `PRE_EXECUTION` \n * or the OVM_ExecutionManager during transaction execution.\n */\n modifier authenticated() {\n // owner is the State Transitioner\n require(\n msg.sender == owner || msg.sender == ovmExecutionManager,\n \"Function can only be called by authenticated addresses\"\n );\n _;\n }\n\n /***************************\n * Public Functions: Misc *\n ***************************/\n\n\n function isAuthenticated(\n address _address\n )\n override\n public\n view\n returns (bool)\n {\n return (_address == owner || _address == ovmExecutionManager);\n }\n\n /***************************\n * Public Functions: Setup *\n ***************************/\n\n /**\n * Sets the address of the OVM_ExecutionManager.\n * @param _ovmExecutionManager Address of the OVM_ExecutionManager.\n */\n function setExecutionManager(\n address _ovmExecutionManager\n )\n override\n public\n authenticated\n {\n ovmExecutionManager = _ovmExecutionManager;\n }\n\n\n /************************************\n * Public Functions: Account Access *\n ************************************/\n\n /**\n * Inserts an account into the state.\n * @param _address Address of the account to insert.\n * @param _account Account to insert for the given address.\n */\n function putAccount(\n address _address,\n Lib_OVMCodec.Account memory _account\n )\n override\n public\n authenticated\n {\n accounts[_address] = _account;\n }\n\n /**\n * Marks an account as empty.\n * @param _address Address of the account to mark.\n */\n function putEmptyAccount(\n address _address\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\n }\n\n /**\n * Retrieves an account from the state.\n * @param _address Address of the account to retrieve.\n * @return _account Account for the given address.\n */\n function getAccount(address _address)\n override\n public\n view\n returns (\n Lib_OVMCodec.Account memory _account\n )\n {\n return accounts[_address];\n }\n\n /**\n * Checks whether the state has a given account.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the state has the account.\n */\n function hasAccount(\n address _address\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return accounts[_address].codeHash != bytes32(0);\n }\n\n /**\n * Checks whether the state has a given known empty account.\n * @param _address Address of the account to check.\n * @return _exists Whether or not the state has the empty account.\n */\n function hasEmptyAccount(\n address _address\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return (\n accounts[_address].codeHash == EMPTY_ACCOUNT_CODE_HASH\n && accounts[_address].nonce == 0\n );\n }\n\n /**\n * Sets the nonce of an account.\n * @param _address Address of the account to modify.\n * @param _nonce New account nonce.\n */\n function setAccountNonce(\n address _address,\n uint256 _nonce\n )\n override\n public\n authenticated\n {\n accounts[_address].nonce = _nonce;\n }\n\n /**\n * Gets the nonce of an account.\n * @param _address Address of the account to access.\n * @return _nonce Nonce of the account.\n */\n function getAccountNonce(\n address _address\n )\n override\n public\n view\n returns (\n uint256 _nonce\n )\n {\n return accounts[_address].nonce;\n }\n\n /**\n * Retrieves the Ethereum address of an account.\n * @param _address Address of the account to access.\n * @return _ethAddress Corresponding Ethereum address.\n */\n function getAccountEthAddress(\n address _address\n )\n override\n public\n view\n returns (\n address _ethAddress\n )\n {\n return accounts[_address].ethAddress;\n }\n\n /**\n * Retrieves the storage root of an account.\n * @param _address Address of the account to access.\n * @return _storageRoot Corresponding storage root.\n */\n function getAccountStorageRoot(\n address _address\n )\n override\n public\n view\n returns (\n bytes32 _storageRoot\n )\n {\n return accounts[_address].storageRoot;\n }\n\n /**\n * Initializes a pending account (during CREATE or CREATE2) with the default values.\n * @param _address Address of the account to initialize.\n */\n function initPendingAccount(\n address _address\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.nonce = 1;\n account.storageRoot = EMPTY_ACCOUNT_STORAGE_ROOT;\n account.codeHash = EMPTY_ACCOUNT_CODE_HASH;\n account.isFresh = true;\n }\n\n /**\n * Finalizes the creation of a pending account (during CREATE or CREATE2).\n * @param _address Address of the account to finalize.\n * @param _ethAddress Address of the account's associated contract on Ethereum.\n * @param _codeHash Hash of the account's code.\n */\n function commitPendingAccount(\n address _address,\n address _ethAddress,\n bytes32 _codeHash\n )\n override\n public\n authenticated\n {\n Lib_OVMCodec.Account storage account = accounts[_address];\n account.ethAddress = _ethAddress;\n account.codeHash = _codeHash;\n }\n\n /**\n * Checks whether an account has already been retrieved, and marks it as retrieved if not.\n * @param _address Address of the account to check.\n * @return _wasAccountAlreadyLoaded Whether or not the account was already loaded.\n */\n function testAndSetAccountLoaded(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountAlreadyLoaded\n )\n {\n return _testAndSetItemState(\n _getItemHash(_address),\n ItemState.ITEM_LOADED\n );\n }\n\n /**\n * Checks whether an account has already been modified, and marks it as modified if not.\n * @param _address Address of the account to check.\n * @return _wasAccountAlreadyChanged Whether or not the account was already modified.\n */\n function testAndSetAccountChanged(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountAlreadyChanged\n )\n {\n return _testAndSetItemState(\n _getItemHash(_address),\n ItemState.ITEM_CHANGED\n );\n }\n\n /**\n * Attempts to mark an account as committed.\n * @param _address Address of the account to commit.\n * @return _wasAccountCommitted Whether or not the account was committed.\n */\n function commitAccount(\n address _address\n )\n override\n public\n authenticated\n returns (\n bool _wasAccountCommitted\n )\n {\n bytes32 item = _getItemHash(_address);\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\n return false;\n }\n\n itemStates[item] = ItemState.ITEM_COMMITTED;\n totalUncommittedAccounts -= 1;\n\n return true;\n }\n\n /**\n * Increments the total number of uncommitted accounts.\n */\n function incrementTotalUncommittedAccounts()\n override\n public\n authenticated\n {\n totalUncommittedAccounts += 1;\n }\n\n /**\n * Gets the total number of uncommitted accounts.\n * @return _total Total uncommitted accounts.\n */\n function getTotalUncommittedAccounts()\n override\n public\n view\n returns (\n uint256 _total\n )\n {\n return totalUncommittedAccounts;\n }\n\n /**\n * Checks whether a given account was changed during execution.\n * @param _address Address to check.\n * @return Whether or not the account was changed.\n */\n function wasAccountChanged(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_address);\n return itemStates[item] >= ItemState.ITEM_CHANGED;\n }\n\n /**\n * Checks whether a given account was committed after execution.\n * @param _address Address to check.\n * @return Whether or not the account was committed.\n */\n function wasAccountCommitted(\n address _address\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_address);\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\n }\n\n\n /************************************\n * Public Functions: Storage Access *\n ************************************/\n\n /**\n * Changes a contract storage slot value.\n * @param _contract Address of the contract to modify.\n * @param _key 32 byte storage slot key.\n * @param _value 32 byte storage slot value.\n */\n function putContractStorage(\n address _contract,\n bytes32 _key,\n bytes32 _value\n )\n override\n public\n authenticated\n {\n // A hilarious optimization. `SSTORE`ing a value of `bytes32(0)` is common enough that it's\n // worth populating this with a non-zero value in advance (during the fraud proof\n // initialization phase) to cut the execution-time cost down to 5000 gas.\n contractStorage[_contract][_key] = _value ^ STORAGE_XOR_VALUE;\n\n // Only used when initially populating the contract storage. OVM_ExecutionManager will\n // perform a `hasContractStorage` INVALID_STATE_ACCESS check before putting any contract\n // storage because writing to zero when the actual value is nonzero causes a gas\n // discrepancy. Could be moved into a new `putVerifiedContractStorage` function, or\n // something along those lines.\n if (verifiedContractStorage[_contract][_key] == false) {\n verifiedContractStorage[_contract][_key] = true;\n }\n }\n\n /**\n * Retrieves a contract storage slot value.\n * @param _contract Address of the contract to access.\n * @param _key 32 byte storage slot key.\n * @return _value 32 byte storage slot value.\n */\n function getContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bytes32 _value\n )\n {\n // Storage XOR system doesn't work for newly created contracts that haven't set this\n // storage slot value yet.\n if (\n verifiedContractStorage[_contract][_key] == false\n && accounts[_contract].isFresh\n ) {\n return bytes32(0);\n }\n\n // See `putContractStorage` for more information about the XOR here.\n return contractStorage[_contract][_key] ^ STORAGE_XOR_VALUE;\n }\n\n /**\n * Checks whether a contract storage slot exists in the state.\n * @param _contract Address of the contract to access.\n * @param _key 32 byte storage slot key.\n * @return _exists Whether or not the key was set in the state.\n */\n function hasContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool _exists\n )\n {\n return verifiedContractStorage[_contract][_key] || accounts[_contract].isFresh;\n }\n\n /**\n * Checks whether a storage slot has already been retrieved, and marks it as retrieved if not.\n * @param _contract Address of the contract to check.\n * @param _key 32 byte storage slot key.\n * @return _wasContractStorageAlreadyLoaded Whether or not the slot was already loaded.\n */\n function testAndSetContractStorageLoaded(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageAlreadyLoaded\n )\n {\n return _testAndSetItemState(\n _getItemHash(_contract, _key),\n ItemState.ITEM_LOADED\n );\n }\n\n /**\n * Checks whether a storage slot has already been modified, and marks it as modified if not.\n * @param _contract Address of the contract to check.\n * @param _key 32 byte storage slot key.\n * @return _wasContractStorageAlreadyChanged Whether or not the slot was already modified.\n */\n function testAndSetContractStorageChanged(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageAlreadyChanged\n )\n {\n return _testAndSetItemState(\n _getItemHash(_contract, _key),\n ItemState.ITEM_CHANGED\n );\n }\n\n /**\n * Attempts to mark a storage slot as committed.\n * @param _contract Address of the account to commit.\n * @param _key 32 byte slot key to commit.\n * @return _wasContractStorageCommitted Whether or not the slot was committed.\n */\n function commitContractStorage(\n address _contract,\n bytes32 _key\n )\n override\n public\n authenticated\n returns (\n bool _wasContractStorageCommitted\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n if (itemStates[item] != ItemState.ITEM_CHANGED) {\n return false;\n }\n\n itemStates[item] = ItemState.ITEM_COMMITTED;\n totalUncommittedContractStorage -= 1;\n\n return true;\n }\n\n /**\n * Increments the total number of uncommitted storage slots.\n */\n function incrementTotalUncommittedContractStorage()\n override\n public\n authenticated\n {\n totalUncommittedContractStorage += 1;\n }\n\n /**\n * Gets the total number of uncommitted storage slots.\n * @return _total Total uncommitted storage slots.\n */\n function getTotalUncommittedContractStorage()\n override\n public\n view\n returns (\n uint256 _total\n )\n {\n return totalUncommittedContractStorage;\n }\n\n /**\n * Checks whether a given storage slot was changed during execution.\n * @param _contract Address to check.\n * @param _key Key of the storage slot to check.\n * @return Whether or not the storage slot was changed.\n */\n function wasContractStorageChanged(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n return itemStates[item] >= ItemState.ITEM_CHANGED;\n }\n\n /**\n * Checks whether a given storage slot was committed after execution.\n * @param _contract Address to check.\n * @param _key Key of the storage slot to check.\n * @return Whether or not the storage slot was committed.\n */\n function wasContractStorageCommitted(\n address _contract,\n bytes32 _key\n )\n override\n public\n view\n returns (\n bool\n )\n {\n bytes32 item = _getItemHash(_contract, _key);\n return itemStates[item] >= ItemState.ITEM_COMMITTED;\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Generates a unique hash for an address.\n * @param _address Address to generate a hash for.\n * @return Unique hash for the given address.\n */\n function _getItemHash(\n address _address\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(_address));\n }\n\n /**\n * Generates a unique hash for an address/key pair.\n * @param _contract Address to generate a hash for.\n * @param _key Key to generate a hash for.\n * @return Unique hash for the given pair.\n */\n function _getItemHash(\n address _contract,\n bytes32 _key\n )\n internal\n pure\n returns (\n bytes32\n )\n {\n return keccak256(abi.encodePacked(\n _contract,\n _key\n ));\n }\n\n /**\n * Checks whether an item is in a particular state (ITEM_LOADED or ITEM_CHANGED) and sets the\n * item to the provided state if not.\n * @param _item 32 byte item ID to check.\n * @param _minItemState Minimum state that must be satisfied by the item.\n * @return _wasItemState Whether or not the item was already in the state.\n */\n function _testAndSetItemState(\n bytes32 _item,\n ItemState _minItemState\n )\n internal\n returns (\n bool _wasItemState\n )\n {\n bool wasItemState = itemStates[_item] >= _minItemState;\n\n if (wasItemState == false) {\n itemStates[_item] = _minItemState;\n }\n\n return wasItemState;\n }\n}\n" - }, - "contracts/optimistic-ethereum/mockOVM/accounts/mockOVM_ECDSAContractAccount.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\npragma experimental ABIEncoderV2;\n\n/* Interface Imports */\nimport { iOVM_ECDSAContractAccount } from \"../../iOVM/accounts/iOVM_ECDSAContractAccount.sol\";\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_ECDSAUtils } from \"../../libraries/utils/Lib_ECDSAUtils.sol\";\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title mockOVM_ECDSAContractAccount\n */\ncontract mockOVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Executes a signed transaction.\n * @param _transaction Signed EOA transaction.\n * @param _signatureType Hashing scheme used for the transaction (e.g., ETH signed message).\n * @param _v Signature `v` parameter.\n * @param _r Signature `r` parameter.\n * @param _s Signature `s` parameter.\n * @return _success Whether or not the call returned (rather than reverted).\n * @return _returndata Data returned by the call.\n */\n function execute(\n bytes memory _transaction,\n Lib_OVMCodec.EOASignatureType _signatureType,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n )\n override\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n bool isEthSign = _signatureType == Lib_OVMCodec.EOASignatureType.ETH_SIGNED_MESSAGE;\n Lib_OVMCodec.EIP155Transaction memory decodedTx = Lib_OVMCodec.decodeEIP155Transaction(_transaction, isEthSign);\n\n // Need to make sure that the transaction nonce is right.\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n decodedTx.nonce == Lib_SafeExecutionManagerWrapper.safeGETNONCE(),\n \"Transaction nonce does not match the expected nonce.\"\n );\n\n // Contract creations are signalled by sending a transaction to the zero address.\n if (decodedTx.to == address(0)) {\n address created = Lib_SafeExecutionManagerWrapper.safeCREATE(\n decodedTx.gasLimit,\n decodedTx.data\n );\n\n // If the created address is the ZERO_ADDRESS then we know the deployment failed, though not why\n return (created != address(0), abi.encode(created));\n } else {\n // We only want to bump the nonce for `ovmCALL` because `ovmCREATE` automatically bumps\n // the nonce of the calling account. Normally an EOA would bump the nonce for both\n // cases, but since this is a contract we'd end up bumping the nonce twice.\n Lib_SafeExecutionManagerWrapper.safeSETNONCE(decodedTx.nonce + 1);\n\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n decodedTx.gasLimit,\n decodedTx.to,\n decodedTx.data\n );\n }\n }\n\n function qall(\n uint256 _gasLimit,\n address _to,\n bytes memory _data\n )\n public\n returns (\n bool _success,\n bytes memory _returndata\n )\n {\n return Lib_SafeExecutionManagerWrapper.safeCALL(\n _gasLimit,\n _to,\n _data\n );\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/precompiles/OVM_ProxySequencerEntrypoint.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Library Imports */\nimport { Lib_SafeExecutionManagerWrapper } from \"../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol\";\n\n/**\n * @title OVM_ProxySequencerEntrypoint \n * @dev The Proxy Sequencer Entrypoint is a predeployed proxy to the implementation of the \n * Sequencer Entrypoint. This will enable the Optimism team to upgrade the Sequencer Entrypoint \n * contract.\n * \n * Compiler used: solc\n * Runtime target: OVM\n */\ncontract OVM_ProxySequencerEntrypoint {\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback()\n external\n {\n Lib_SafeExecutionManagerWrapper.safeDELEGATECALL(\n gasleft(),\n _getImplementation(),\n msg.data\n );\n }\n\n\n /********************\n * Public Functions *\n ********************/\n\n function init(\n address _implementation,\n address _owner\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n _getOwner() == address(0),\n \"ProxySequencerEntrypoint has already been inited\"\n );\n _setOwner(_owner);\n _setImplementation(_implementation);\n }\n\n function upgrade(\n address _implementation\n )\n external\n {\n Lib_SafeExecutionManagerWrapper.safeREQUIRE(\n _getOwner() == Lib_SafeExecutionManagerWrapper.safeCALLER(),\n \"Only owner can upgrade the Entrypoint\"\n );\n\n _setImplementation(_implementation);\n }\n\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _setImplementation(\n address _implementation\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n bytes32(uint256(0)),\n bytes32(uint256(uint160(_implementation)))\n );\n }\n\n function _getImplementation()\n internal\n returns (\n address _implementation\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n bytes32(uint256(0))\n )\n )));\n }\n\n function _setOwner(\n address _owner\n )\n internal\n {\n Lib_SafeExecutionManagerWrapper.safeSSTORE(\n bytes32(uint256(1)),\n bytes32(uint256(uint160(_owner)))\n );\n }\n\n function _getOwner()\n internal\n returns (\n address _owner\n )\n {\n return address(uint160(uint256(\n Lib_SafeExecutionManagerWrapper.safeSLOAD(\n bytes32(uint256(1))\n )\n )));\n }\n}\n" - }, - "contracts/optimistic-ethereum/OVM/execution/OVM_SafetyChecker.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.8.0;\n\n/* Interface Imports */\nimport { iOVM_SafetyChecker } from \"../../iOVM/execution/iOVM_SafetyChecker.sol\";\n\n/**\n * @title OVM_SafetyChecker\n * @dev The Safety Checker verifies that contracts deployed on L2 do not contain any\n * \"unsafe\" operations. An operation is considered unsafe if it would access state variables which\n * are specific to the environment (ie. L1 or L2) in which it is executed, as this could be used\n * to \"escape the sandbox\" of the OVM, resulting in non-deterministic fraud proofs. \n * That is, an attacker would be able to \"prove fraud\" on an honestly applied transaction.\n * Note that a \"safe\" contract requires opcodes to appear in a particular pattern;\n * omission of \"unsafe\" opcodes is necessary, but not sufficient.\n *\n * Compiler used: solc\n * Runtime target: EVM\n */\ncontract OVM_SafetyChecker is iOVM_SafetyChecker {\n\n /********************\n * Public Functions *\n ********************/\n /**\n * Returns whether or not all of the provided bytecode is safe.\n * @param _bytecode The bytecode to safety check.\n * @return `true` if the bytecode is safe, `false` otherwise.\n */\n function isBytecodeSafe(\n bytes memory _bytecode\n )\n override\n external\n pure\n returns (bool)\n {\n // autogenerated by gen_safety_checker_constants.py\n // number of bytes to skip for each opcode\n uint256[8] memory opcodeSkippableBytes = [\n uint256(0x0001010101010101010101010000000001010101010101010101010101010000),\n uint256(0x0100000000000000000000000000000000000000010101010101000000010100),\n uint256(0x0000000000000000000000000000000001010101000000010101010100000000),\n uint256(0x0203040500000000000000000000000000000000000000000000000000000000),\n uint256(0x0101010101010101010101010101010101010101010101010101010101010101),\n uint256(0x0101010101000000000000000000000000000000000000000000000000000000),\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000),\n uint256(0x0000000000000000000000000000000000000000000000000000000000000000)\n ];\n // Mask to gate opcode specific cases\n uint256 opcodeGateMask = ~uint256(0xffffffffffffffffffffffe000000000fffffffff070ffff9c0ffffec000f001);\n // Halting opcodes\n uint256 opcodeHaltingMask = ~uint256(0x4008000000000000000000000000000000000000004000000000000000000001);\n // PUSH opcodes\n uint256 opcodePushMask = ~uint256(0xffffffff000000000000000000000000);\n\n uint256 codeLength;\n uint256 _pc;\n assembly {\n _pc := add(_bytecode, 0x20)\n }\n codeLength = _pc + _bytecode.length;\n do {\n // current opcode: 0x00...0xff\n uint256 opNum;\n\n // inline assembly removes the extra add + bounds check\n assembly {\n let word := mload(_pc) //load the next 32 bytes at pc into word\n\n // Look up number of bytes to skip from opcodeSkippableBytes and then update indexInWord\n // E.g. the 02030405 in opcodeSkippableBytes is the number of bytes to skip for PUSH1->4\n // We repeat this 6 times, thus we can only skip bytes for up to PUSH4 ((1+4) * 6 = 30 < 32).\n // If we see an opcode that is listed as 0 skippable bytes e.g. PUSH5,\n // then we will get stuck on that indexInWord and then opNum will be set to the PUSH5 opcode.\n let indexInWord := byte(0, mload(add(opcodeSkippableBytes, byte(0, word))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n indexInWord := add(indexInWord, byte(0, mload(add(opcodeSkippableBytes, byte(indexInWord, word)))))\n _pc := add(_pc, indexInWord)\n\n opNum := byte(indexInWord, word)\n }\n\n // + push opcodes\n // + stop opcodes [STOP(0x00),JUMP(0x56),RETURN(0xf3),INVALID(0xfe)]\n // + caller opcode CALLER(0x33)\n // + blacklisted opcodes\n uint256 opBit = 1 << opNum;\n if (opBit & opcodeGateMask == 0) {\n if (opBit & opcodePushMask == 0) {\n // all pushes are valid opcodes\n // subsequent bytes are not opcodes. Skip them.\n _pc += (opNum - 0x5e); // PUSH1 is 0x60, so opNum-0x5f = PUSHed bytes and we +1 to\n // skip the _pc++; line below in order to save gas ((-0x5f + 1) = -0x5e)\n continue;\n } else if (opBit & opcodeHaltingMask == 0) {\n // STOP or JUMP or RETURN or INVALID (Note: REVERT is blacklisted, so not included here)\n // We are now inside unreachable code until we hit a JUMPDEST!\n do {\n _pc++;\n assembly {\n opNum := byte(0, mload(_pc))\n }\n // encountered a JUMPDEST\n if (opNum == 0x5b) break;\n // skip PUSHed bytes\n if ((1 << opNum) & opcodePushMask == 0) _pc += (opNum - 0x5f); // opNum-0x5f = PUSHed bytes (PUSH1 is 0x60)\n } while (_pc < codeLength);\n // opNum is 0x5b, so we don't continue here since the pc++ is fine\n } else if (opNum == 0x33) { // Caller opcode\n uint256 firstOps; // next 32 bytes of bytecode\n uint256 secondOps; // following 32 bytes of bytecode\n\n assembly {\n firstOps := mload(_pc)\n // 37 bytes total, 5 left over --> 32 - 5 bytes = 27 bytes = 216 bits\n secondOps := shr(216, mload(add(_pc, 0x20)))\n }\n\n // Call identity precompile\n // CALLER POP PUSH1 0x00 PUSH1 0x04 GAS CALL\n // 32 - 8 bytes = 24 bytes = 192\n if ((firstOps >> 192) == 0x3350600060045af1) {\n _pc += 8;\n // Call EM and abort execution if instructed\n // CALLER PUSH1 0x00 SWAP1 GAS CALL PC PUSH1 0x0E ADD JUMPI RETURNDATASIZE PUSH1 0x00 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x00 REVERT JUMPDEST RETURNDATASIZE PUSH1 0x01 EQ ISZERO PC PUSH1 0x0a ADD JUMPI PUSH1 0x01 PUSH1 0x00 RETURN JUMPDEST \n } else if (firstOps == 0x336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760 && secondOps == 0x016000f35b) {\n _pc += 37;\n } else {\n return false;\n }\n continue;\n } else {\n // encountered a non-whitelisted opcode!\n return false;\n }\n }\n _pc++;\n } while (_pc < codeLength);\n return true;\n }\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout", - "storageLayout" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - } - } -} \ No newline at end of file From abef7628d26d31f3be8f213b334bd21ebfd69b61 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 16:23:54 -0700 Subject: [PATCH 05/41] keep old deploy script --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 63d433843..813dd12ad 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,9 @@ "lint:fix": "yarn run lint:fix:typescript", "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", - "deploy": "hardhat deploy", + "deploy": "./bin/deploy.js", + "serve": "./bin/serve_dump.sh", + "deploy:hh": "hardhat deploy", "verify": "hardhat etherscan-verify" }, "dependencies": { From f717b5a8febe740a7228b2c76422ea5b1c3c2903 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 16:36:44 -0700 Subject: [PATCH 06/41] remove old hardhat-typechain dependency --- package.json | 1 - yarn.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/package.json b/package.json index 813dd12ad..208b79671 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,6 @@ "ethers": "^5.0.31", "hardhat": "^2.0.8", "hardhat-deploy": "^0.7.0-beta.50", - "hardhat-typechain": "^0.3.4", "lodash": "^4.17.20", "merkle-patricia-tree": "^4.0.0", "merkletreejs": "^0.2.12", diff --git a/yarn.lock b/yarn.lock index 9a9d6e266..7f9a1d6a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4219,11 +4219,6 @@ hardhat-deploy@^0.7.0-beta.50: murmur-128 "^0.2.1" qs "^6.9.4" -hardhat-typechain@^0.3.4: - version "0.3.5" - resolved "https://registry.yarnpkg.com/hardhat-typechain/-/hardhat-typechain-0.3.5.tgz#8e50616a9da348b33bd001168c8fda9c66b7b4af" - integrity sha512-w9lm8sxqTJACY+V7vijiH+NkPExnmtiQEjsV9JKD1KgMdVk2q8y+RhvU/c4B7+7b1+HylRUCxpOIvFuB3rE4+w== - hardhat@^2.0.8: version "2.0.10" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.0.10.tgz#9b50da13b6915bb9b61b7f38f8f2b9b352447462" From 4be40ab78f67432aca6de9f2d0710e081a9dfb8d Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 16:42:57 -0700 Subject: [PATCH 07/41] remove unused import --- hardhat.config.ts | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 67a95d29a..71743d6fe 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -8,7 +8,6 @@ import { // Hardhat plugins import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-waffle' -import 'hardhat-typechain' import 'hardhat-deploy' import '@typechain/hardhat' import '@eth-optimism/plugins/hardhat/compiler' diff --git a/package.json b/package.json index 208b79671..1abb013f1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint": "yarn run lint:typescript", "lint:typescript": "tslint --format stylish --project .", "lint:fix": "yarn run lint:fix:typescript", - "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", + "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", "serve": "./bin/serve_dump.sh", From 0b320e0510fcbffe64ff25e4e46c330d408bb378 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 17:02:57 -0700 Subject: [PATCH 08/41] remove kovan config --- hardhat.config.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 71743d6fe..c9e6ef776 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -21,13 +21,6 @@ const config: HardhatUserConfig = { saveDeployments: false, tags: ['test', 'local'], }, - kovan: { - url: 'https://kovan.infura.io/v3/', - accounts: [''], - live: true, - saveDeployments: true, - tags: ['test', 'kovan'], - }, }, mocha: { timeout: 50000, From 024966ba736b1985cd29d150366ad2d3f1a3a0b8 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 17:47:31 -0700 Subject: [PATCH 09/41] Tweak deployment a bit --- .../OVM_CanonicalTransactionChain.deploy.ts | 6 ++-- deploy/OVM_ExecutionManager.deploy.ts | 13 +++++---- deploy/OVM_StateCommitmentChain.deploy.ts | 4 +-- ...roxy__OVM_L1CrossDomainMessenger.deploy.ts | 15 ++++++++-- hardhat.config.ts | 1 + hardhat/index.ts | 1 + hardhat/tasks/task-deploy.ts | 28 +++++++++++++++++++ package.json | 2 +- 8 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 hardhat/index.ts create mode 100644 hardhat/tasks/task-deploy.ts diff --git a/deploy/OVM_CanonicalTransactionChain.deploy.ts b/deploy/OVM_CanonicalTransactionChain.deploy.ts index e24cb5507..7794c9256 100644 --- a/deploy/OVM_CanonicalTransactionChain.deploy.ts +++ b/deploy/OVM_CanonicalTransactionChain.deploy.ts @@ -10,9 +10,9 @@ const deployFn: DeployFunction = async (hre) => { from: deployer, args: [ Lib_AddressManager.address, - 600, // _forceInclusionPeriodSeconds - 10, // _forceInclusionPeriodBlocks - 9_000_000, // _maxTransactionGasLimit + (hre as any).deployConfig.ctcForceInclusionPeriodSeconds, + (hre as any).deployConfig.ctcForceInclusionPeriodBlocks, + (hre as any).deployConfig.ctcMaxTransactionGasLimit, ], log: true, }) diff --git a/deploy/OVM_ExecutionManager.deploy.ts b/deploy/OVM_ExecutionManager.deploy.ts index a69dd5c32..ab5d05b32 100644 --- a/deploy/OVM_ExecutionManager.deploy.ts +++ b/deploy/OVM_ExecutionManager.deploy.ts @@ -11,13 +11,16 @@ const deployFn: DeployFunction = async (hre) => { args: [ Lib_AddressManager.address, { - minTransactionGasLimit: 20_000, - maxTransactionGasLimit: 9_000_000, - maxGasPerQueuePerEpoch: 9_000_000, - secondsPerEpoch: 0, + minTransactionGasLimit: (hre as any).deployConfig + .emMinTransactionGasLimit, + maxTransactionGasLimit: (hre as any).deployConfig + .emMaxGasPerQueuePerEpoch, + maxGasPerQueuePerEpoch: (hre as any).deployConfig + .emMaxGasPerQueuePerEpoch, + secondsPerEpoch: (hre as any).deployConfig.emSecondsPerEpoch, }, { - ovmCHAINID: 10, + ovmCHAINID: (hre as any).deployConfig.emOvmChainId, }, ], log: true, diff --git a/deploy/OVM_StateCommitmentChain.deploy.ts b/deploy/OVM_StateCommitmentChain.deploy.ts index f718af422..59af0b212 100644 --- a/deploy/OVM_StateCommitmentChain.deploy.ts +++ b/deploy/OVM_StateCommitmentChain.deploy.ts @@ -10,8 +10,8 @@ const deployFn: DeployFunction = async (hre) => { from: deployer, args: [ Lib_AddressManager.address, - 60000, // _fraudProofWindow - 60000, // _sequencerPublishWindow + (hre as any).deployConfig.sccFraudProofWindow, + (hre as any).deployConfig.sccSequencerPublishWindow, ], log: true, }) diff --git a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts index 6333f0663..a5257755a 100644 --- a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts @@ -1,18 +1,28 @@ +import { ethers } from 'ethers' import { DeployFunction } from 'hardhat-deploy/dist/types' const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy, execute, rawTx } = hre.deployments const { deployer } = await hre.getNamedAccounts() const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') - const contract = await deploy('Lib_ResolvedDelegateProxy', { + const contract = await deploy('Proxy__OVM_L1CrossDomainMessenger', { + contract: 'Lib_ResolvedDelegateProxy', from: deployer, args: [Lib_AddressManager.address, 'OVM_L1CrossDomainMessenger'], log: true, }) if (contract.newlyDeployed) { + await rawTx({ + to: contract.address, + from: deployer, + data: + ethers.utils.id('initialize(address)').slice(0, 10) + + Lib_AddressManager.address.slice(2).padStart(64, '0'), + }) + await execute( 'Lib_AddressManager', { @@ -25,6 +35,7 @@ const deployFn: DeployFunction = async (hre) => { } } +deployFn.dependencies = ['OVM_L1CrossDomainMessenger'] deployFn.tags = ['Proxy__OVM_L1CrossDomainMessenger'] export default deployFn diff --git a/hardhat.config.ts b/hardhat.config.ts index c9e6ef776..8a795a2aa 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -11,6 +11,7 @@ import '@nomiclabs/hardhat-waffle' import 'hardhat-deploy' import '@typechain/hardhat' import '@eth-optimism/plugins/hardhat/compiler' +import './hardhat' const config: HardhatUserConfig = { networks: { diff --git a/hardhat/index.ts b/hardhat/index.ts new file mode 100644 index 000000000..02a559c38 --- /dev/null +++ b/hardhat/index.ts @@ -0,0 +1 @@ +import './tasks/task-deploy' diff --git a/hardhat/tasks/task-deploy.ts b/hardhat/tasks/task-deploy.ts new file mode 100644 index 000000000..2c867f94e --- /dev/null +++ b/hardhat/tasks/task-deploy.ts @@ -0,0 +1,28 @@ +import { task } from 'hardhat/config' +import { int } from 'hardhat/internal/core/params/argumentTypes' + +task('deploy') + .addOptionalParam( + 'ctcForceInclusionPeriodSeconds', + '', + 60 * 60 * 24 * 30, + int + ) + .addOptionalParam( + 'ctcForceInclusionPeriodBlocks', + '', + (60 * 60 * 24 * 30) / 15, + int + ) + .addOptionalParam('ctcMaxTransactionGasLimit', '', 9_000_000, int) + .addOptionalParam('emMinTransactionGasLimit', '', 50_000, int) + .addOptionalParam('emMaxTransactionGasLimit', '', 9_000_000, int) + .addOptionalParam('emMaxGasPerQueuePerEpoch', '', 250_000_000, int) + .addOptionalParam('emSecondsPerEpoch', '', 0, int) + .addOptionalParam('emOvmChainId', '', 420, int) + .addOptionalParam('sccFraudProofWindow', '', 60 * 60 * 24 * 7, int) + .addOptionalParam('sccSequencerPublishWindow', '', 60 * 30, int) + .setAction(async (args, hre: any, runSuper) => { + hre.deployConfig = args + return runSuper(args) + }) diff --git a/package.json b/package.json index 1abb013f1..a98daef4f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint": "yarn run lint:typescript", "lint:typescript": "tslint --format stylish --project .", "lint:fix": "yarn run lint:fix:typescript", - "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy}/**/*.ts\"", + "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy,hardhat}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", "serve": "./bin/serve_dump.sh", From e0acec7866380f6fa102cd1b0fffbf67edec7054 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 17:54:10 -0700 Subject: [PATCH 10/41] Clean up defaults --- hardhat/tasks/task-deploy.ts | 80 +++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/hardhat/tasks/task-deploy.ts b/hardhat/tasks/task-deploy.ts index 2c867f94e..d14979cce 100644 --- a/hardhat/tasks/task-deploy.ts +++ b/hardhat/tasks/task-deploy.ts @@ -1,27 +1,79 @@ +/* Imports: External */ import { task } from 'hardhat/config' import { int } from 'hardhat/internal/core/params/argumentTypes' +const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS = 60 * 60 * 24 * 30 // 30 days +const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS = (60 * 60 * 24 * 30) / 15 // 30 days in blocks +const DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT = 9_000_000 +const DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT = 50_000 +const DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT = 9_000_000 +const DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH = 250_000_000 +const DEFAULT_EM_SECONDS_PER_EPOCH = 0 +const DEFAULT_EM_OVM_CHAIN_ID = 420 +const DEFAULT_SCC_FRAUD_PROOF_WINDOW = 60 * 60 * 24 * 7 // 7 days +const DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW = 60 * 30 // 30 minutes + task('deploy') .addOptionalParam( 'ctcForceInclusionPeriodSeconds', - '', - 60 * 60 * 24 * 30, + 'Number of seconds that the sequencer has to include transactions before the L1 queue.', + DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS, int ) .addOptionalParam( 'ctcForceInclusionPeriodBlocks', - '', - (60 * 60 * 24 * 30) / 15, - int - ) - .addOptionalParam('ctcMaxTransactionGasLimit', '', 9_000_000, int) - .addOptionalParam('emMinTransactionGasLimit', '', 50_000, int) - .addOptionalParam('emMaxTransactionGasLimit', '', 9_000_000, int) - .addOptionalParam('emMaxGasPerQueuePerEpoch', '', 250_000_000, int) - .addOptionalParam('emSecondsPerEpoch', '', 0, int) - .addOptionalParam('emOvmChainId', '', 420, int) - .addOptionalParam('sccFraudProofWindow', '', 60 * 60 * 24 * 7, int) - .addOptionalParam('sccSequencerPublishWindow', '', 60 * 30, int) + 'Number of blocks that the sequencer has to include transactions before the L1 queue.', + DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS, + int + ) + .addOptionalParam( + 'ctcMaxTransactionGasLimit', + 'Max gas limit for L1 queue transactions.', + DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT, + int + ) + .addOptionalParam( + 'emMinTransactionGasLimit', + 'Minimum allowed transaction gas limit.', + DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT, + int + ) + .addOptionalParam( + 'emMaxTransactionGasLimit', + 'Maximum allowed transaction gas limit.', + DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT, + int + ) + .addOptionalParam( + 'emMaxGasPerQueuePerEpoch', + 'Maximum gas allowed in a given queue for each epoch.', + DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH, + int + ) + .addOptionalParam( + 'emSecondsPerEpoch', + 'Number of seconds in each epoch.', + DEFAULT_EM_SECONDS_PER_EPOCH, + int + ) + .addOptionalParam( + 'emOvmChainId', + 'Chain ID for the L2 network.', + DEFAULT_EM_OVM_CHAIN_ID, + int + ) + .addOptionalParam( + 'sccFraudProofWindow', + 'Number of seconds until a transaction is considered finalized.', + DEFAULT_SCC_FRAUD_PROOF_WINDOW, + int + ) + .addOptionalParam( + 'sccSequencerPublishWindow', + 'Number of seconds that the sequencer is exclusively allowed to post state roots.', + DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW, + int + ) .setAction(async (args, hre: any, runSuper) => { hre.deployConfig = args return runSuper(args) From 9cc3ad39aa42788e5b73351ad8bcf1bf8af992b0 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 18:01:03 -0700 Subject: [PATCH 11/41] rename hardhat => hh --- hardhat.config.ts | 2 +- {hardhat => hh}/index.ts | 0 {hardhat => hh}/tasks/task-deploy.ts | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {hardhat => hh}/index.ts (100%) rename {hardhat => hh}/tasks/task-deploy.ts (100%) diff --git a/hardhat.config.ts b/hardhat.config.ts index 8a795a2aa..52754db39 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -11,7 +11,7 @@ import '@nomiclabs/hardhat-waffle' import 'hardhat-deploy' import '@typechain/hardhat' import '@eth-optimism/plugins/hardhat/compiler' -import './hardhat' +import './hh' const config: HardhatUserConfig = { networks: { diff --git a/hardhat/index.ts b/hh/index.ts similarity index 100% rename from hardhat/index.ts rename to hh/index.ts diff --git a/hardhat/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts similarity index 100% rename from hardhat/tasks/task-deploy.ts rename to hh/tasks/task-deploy.ts From 1f2c7e568f5f41e7d4c3791b9375538d4b2698e4 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 25 Mar 2021 20:08:24 -0700 Subject: [PATCH 12/41] Use mock bond manager --- deploy/OVM_BondManager.deploy.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/deploy/OVM_BondManager.deploy.ts b/deploy/OVM_BondManager.deploy.ts index 522fba263..716cdff87 100644 --- a/deploy/OVM_BondManager.deploy.ts +++ b/deploy/OVM_BondManager.deploy.ts @@ -6,12 +6,9 @@ const deployFn: DeployFunction = async (hre) => { const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') - const contract = await deploy('OVM_BondManager', { + const contract = await deploy('mockOVM_BondManager', { from: deployer, - args: [ - '0x0000000000000000000000000000000000000000', - Lib_AddressManager.address, - ], + args: [Lib_AddressManager.address], log: true, }) From cf9dcc1ddf4df4a46bd9c27d18abc9773cef33c3 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 00:16:42 -0700 Subject: [PATCH 13/41] Make deploy a bit more robust --- .../resolver/Lib_AddressResolver.sol | 2 +- deploy/OVM_BondManager.deploy.ts | 31 --------- .../OVM_CanonicalTransactionChain.deploy.ts | 33 ++++++---- ...hainStorageContainer_ctc_batches.deploy.ts | 33 ++++++---- ..._ChainStorageContainer_ctc_queue.deploy.ts | 33 ++++++---- ...hainStorageContainer_scc_batches.deploy.ts | 35 ++++++---- deploy/OVM_ExecutionManager.deploy.ts | 30 +++++---- deploy/OVM_FraudVerifier.deploy.ts | 30 +++++---- deploy/OVM_L1CrossDomainMessenger.deploy.ts | 52 +++++++++++---- deploy/OVM_L1MultiMessageRelayer.deploy.ts | 33 ++++++---- deploy/OVM_SafetyChecker.deploy.ts | 30 +++++---- deploy/OVM_StateCommitmentChain.deploy.ts | 33 ++++++---- deploy/OVM_StateManagerFactory.deploy.ts | 30 +++++---- deploy/OVM_StateTransitionerFactory.deploy.ts | 33 ++++++---- ...roxy__OVM_L1CrossDomainMessenger.deploy.ts | 64 ++++++++++++------- deploy/mockOVM_BondManager.deploy.ts | 35 ++++++++++ hardhat.config.ts | 9 +++ src/hardhat-deploy-ethers.ts | 55 ++++++++++++++++ 18 files changed, 394 insertions(+), 207 deletions(-) delete mode 100644 deploy/OVM_BondManager.deploy.ts create mode 100644 deploy/mockOVM_BondManager.deploy.ts create mode 100644 src/hardhat-deploy-ethers.ts diff --git a/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol b/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol index d48be8704..2b768d6b2 100644 --- a/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol +++ b/contracts/optimistic-ethereum/libraries/resolver/Lib_AddressResolver.sol @@ -13,7 +13,7 @@ abstract contract Lib_AddressResolver { * Contract Variables: Contract References * *******************************************/ - Lib_AddressManager internal libAddressManager; + Lib_AddressManager public libAddressManager; /*************** diff --git a/deploy/OVM_BondManager.deploy.ts b/deploy/OVM_BondManager.deploy.ts deleted file mode 100644 index 716cdff87..000000000 --- a/deploy/OVM_BondManager.deploy.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { DeployFunction } from 'hardhat-deploy/dist/types' - -const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') - - const contract = await deploy('mockOVM_BondManager', { - from: deployer, - args: [Lib_AddressManager.address], - log: true, - }) - - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_BondManager', - contract.address - ) - } -} - -deployFn.dependencies = ['Lib_AddressManager'] -deployFn.tags = ['OVM_BondManager'] - -export default deployFn diff --git a/deploy/OVM_CanonicalTransactionChain.deploy.ts b/deploy/OVM_CanonicalTransactionChain.deploy.ts index 7794c9256..b9af75bb3 100644 --- a/deploy/OVM_CanonicalTransactionChain.deploy.ts +++ b/deploy/OVM_CanonicalTransactionChain.deploy.ts @@ -1,12 +1,22 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_CanonicalTransactionChain', { + const result = await deploy('OVM_CanonicalTransactionChain', { from: deployer, args: [ Lib_AddressManager.address, @@ -17,17 +27,14 @@ const deployFn: DeployFunction = async (hre) => { log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_CanonicalTransactionChain', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_CanonicalTransactionChain', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts index 2c02d8445..a4d819f7c 100644 --- a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -1,29 +1,36 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_ChainStorageContainer:CTC:batches', { + const result = await deploy('OVM_ChainStorageContainer:CTC:batches', { contract: 'OVM_ChainStorageContainer', from: deployer, args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_ChainStorageContainer:CTC:batches', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_ChainStorageContainer:CTC:batches', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts index c79361c3f..b7ab1ef41 100644 --- a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -1,29 +1,36 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_ChainStorageContainer:CTC:queue', { + const result = await deploy('OVM_ChainStorageContainer:CTC:queue', { contract: 'OVM_ChainStorageContainer', from: deployer, args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_ChainStorageContainer:CTC:queue', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_ChainStorageContainer:CTC:queue', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts index 33b387f3f..4e8bbe475 100644 --- a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts +++ b/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -1,32 +1,39 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_ChainStorageContainer:SCC:batches', { + const result = await deploy('OVM_ChainStorageContainer:SCC:queue', { contract: 'OVM_ChainStorageContainer', from: deployer, args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_ChainStorageContainer:SCC:queue', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_ChainStorageContainer:SCC:queue', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] -deployFn.tags = ['OVM_ChainStorageContainer_scc_batches'] +deployFn.tags = ['OVM_ChainStorageContainer_scc_queue'] export default deployFn diff --git a/deploy/OVM_ExecutionManager.deploy.ts b/deploy/OVM_ExecutionManager.deploy.ts index ab5d05b32..a8fd27c78 100644 --- a/deploy/OVM_ExecutionManager.deploy.ts +++ b/deploy/OVM_ExecutionManager.deploy.ts @@ -1,12 +1,22 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_ExecutionManager', { + const result = await deploy('OVM_ExecutionManager', { from: deployer, args: [ Lib_AddressManager.address, @@ -26,17 +36,11 @@ const deployFn: DeployFunction = async (hre) => { log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_ChainStorageContainer:ctc:batches', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress('OVM_ExecutionManager', result.address) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_FraudVerifier.deploy.ts b/deploy/OVM_FraudVerifier.deploy.ts index 108a24850..88a01703a 100644 --- a/deploy/OVM_FraudVerifier.deploy.ts +++ b/deploy/OVM_FraudVerifier.deploy.ts @@ -1,28 +1,32 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_FraudVerifier', { + const result = await deploy('OVM_FraudVerifier', { from: deployer, args: [Lib_AddressManager.address], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_FraudVerifier', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress('OVM_FraudVerifier', result.address) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_L1CrossDomainMessenger.deploy.ts b/deploy/OVM_L1CrossDomainMessenger.deploy.ts index 43f4b35e5..e9b26f6c8 100644 --- a/deploy/OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/OVM_L1CrossDomainMessenger.deploy.ts @@ -1,26 +1,56 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const contract = await deploy('OVM_L1CrossDomainMessenger', { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('OVM_L1CrossDomainMessenger', { from: deployer, args: [], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_L1CrossDomainMessenger', - contract.address + if (!result.newlyDeployed) { + return + } + + const OVM_L1CrossDomainMessenger = await getDeployedContract( + hre, + 'OVM_L1CrossDomainMessenger', + { + signerOrProvider: deployer, + } + ) + + await OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address) + + const libAddressManager = await OVM_L1CrossDomainMessenger.libAddressManager() + if (libAddressManager !== Lib_AddressManager.address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `OVM_L1CrossDomainMessenger could not be succesfully initialized.\n` + + `Attempted to set Lib_AddressManager to: ${Lib_AddressManager.address}\n` + + `Actual address after initialization: ${libAddressManager}\n` + + `This could indicate a compromised deployment.` ) } + + await Lib_AddressManager.setAddress( + 'OVM_L1CrossDomainMessenger', + result.address + ) } deployFn.tags = ['OVM_L1CrossDomainMessenger'] diff --git a/deploy/OVM_L1MultiMessageRelayer.deploy.ts b/deploy/OVM_L1MultiMessageRelayer.deploy.ts index c7fd04cea..d99de73b0 100644 --- a/deploy/OVM_L1MultiMessageRelayer.deploy.ts +++ b/deploy/OVM_L1MultiMessageRelayer.deploy.ts @@ -1,28 +1,35 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_L1MultiMessageRelayer', { + const result = await deploy('OVM_L1MultiMessageRelayer', { from: deployer, args: [Lib_AddressManager.address], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_L1MultiMessageRelayer', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_L1MultiMessageRelayer', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_SafetyChecker.deploy.ts b/deploy/OVM_SafetyChecker.deploy.ts index 9eee08c36..fc4af6ec7 100644 --- a/deploy/OVM_SafetyChecker.deploy.ts +++ b/deploy/OVM_SafetyChecker.deploy.ts @@ -1,26 +1,32 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const contract = await deploy('OVM_SafetyChecker', { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('OVM_SafetyChecker', { from: deployer, args: [], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_SafetyChecker', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress('OVM_SafetyChecker', result.address) } deployFn.tags = ['OVM_SafetyChecker'] diff --git a/deploy/OVM_StateCommitmentChain.deploy.ts b/deploy/OVM_StateCommitmentChain.deploy.ts index 59af0b212..8be76accd 100644 --- a/deploy/OVM_StateCommitmentChain.deploy.ts +++ b/deploy/OVM_StateCommitmentChain.deploy.ts @@ -1,12 +1,22 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_StateCommitmentChain', { + const result = await deploy('OVM_StateCommitmentChain', { from: deployer, args: [ Lib_AddressManager.address, @@ -16,17 +26,14 @@ const deployFn: DeployFunction = async (hre) => { log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_StateCommitmentChain', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_StateCommitmentChain', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/OVM_StateManagerFactory.deploy.ts b/deploy/OVM_StateManagerFactory.deploy.ts index 8afe9d168..1aa0ee050 100644 --- a/deploy/OVM_StateManagerFactory.deploy.ts +++ b/deploy/OVM_StateManagerFactory.deploy.ts @@ -1,26 +1,32 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const contract = await deploy('OVM_StateManagerFactory', { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('OVM_StateManagerFactory', { from: deployer, args: [], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_StateManagerFactory', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress('OVM_StateManagerFactory', result.address) } deployFn.tags = ['OVM_StateManagerFactory'] diff --git a/deploy/OVM_StateTransitionerFactory.deploy.ts b/deploy/OVM_StateTransitionerFactory.deploy.ts index c06132b91..7144a0117 100644 --- a/deploy/OVM_StateTransitionerFactory.deploy.ts +++ b/deploy/OVM_StateTransitionerFactory.deploy.ts @@ -1,28 +1,35 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('OVM_StateTransitionerFactory', { + const result = await deploy('OVM_StateTransitionerFactory', { from: deployer, args: [Lib_AddressManager.address], log: true, }) - if (contract.newlyDeployed) { - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'OVM_StateTransitionerFactory', - contract.address - ) + if (!result.newlyDeployed) { + return } + + await Lib_AddressManager.setAddress( + 'OVM_StateTransitionerFactory', + result.address + ) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts index a5257755a..51a02a75e 100644 --- a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts @@ -1,41 +1,61 @@ -import { ethers } from 'ethers' +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + const deployFn: DeployFunction = async (hre) => { - const { deploy, execute, rawTx } = hre.deployments + const { deploy } = hre.deployments const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await hre.deployments.get('Lib_AddressManager') + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) - const contract = await deploy('Proxy__OVM_L1CrossDomainMessenger', { + const result = await deploy('Proxy__OVM_L1CrossDomainMessenger', { contract: 'Lib_ResolvedDelegateProxy', from: deployer, args: [Lib_AddressManager.address, 'OVM_L1CrossDomainMessenger'], log: true, }) - if (contract.newlyDeployed) { - await rawTx({ - to: contract.address, - from: deployer, - data: - ethers.utils.id('initialize(address)').slice(0, 10) + - Lib_AddressManager.address.slice(2).padStart(64, '0'), - }) - - await execute( - 'Lib_AddressManager', - { - from: deployer, - }, - 'setAddress', - 'Proxy__OVM_L1CrossDomainMessenger', - contract.address + if (!result.newlyDeployed) { + return + } + + const Proxy__OVM_L1CrossDomainMessenger = await getDeployedContract( + hre, + 'Proxy__OVM_L1CrossDomainMessenger', + { + signerOrProvider: deployer, + iface: 'OVM_L1CrossDomainMessenger', + } + ) + + await Proxy__OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address) + + const libAddressManager = await Proxy__OVM_L1CrossDomainMessenger.libAddressManager() + if (libAddressManager !== Lib_AddressManager.address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `Proxy__OVM_L1CrossDomainMessenger could not be succesfully initialized.\n` + + `Attempted to set Lib_AddressManager to: ${Lib_AddressManager.address}\n` + + `Actual address after initialization: ${libAddressManager}\n` + + `This could indicate a compromised deployment.` ) } + + await Lib_AddressManager.setAddress( + 'Proxy__OVM_L1CrossDomainMessenger', + result.address + ) } -deployFn.dependencies = ['OVM_L1CrossDomainMessenger'] +deployFn.dependencies = ['Lib_AddressManager', 'OVM_L1CrossDomainMessenger'] deployFn.tags = ['Proxy__OVM_L1CrossDomainMessenger'] export default deployFn diff --git a/deploy/mockOVM_BondManager.deploy.ts b/deploy/mockOVM_BondManager.deploy.ts new file mode 100644 index 000000000..f584f5589 --- /dev/null +++ b/deploy/mockOVM_BondManager.deploy.ts @@ -0,0 +1,35 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const { deploy } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('mockOVM_BondManager', { + from: deployer, + args: [Lib_AddressManager.address], + log: true, + }) + + if (!result.newlyDeployed) { + return + } + + await Lib_AddressManager.setAddress('OVM_BondManager', result.address) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['mockOVM_BondManager'] + +export default deployFn diff --git a/hardhat.config.ts b/hardhat.config.ts index 52754db39..3f4c714b9 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -22,6 +22,15 @@ const config: HardhatUserConfig = { saveDeployments: false, tags: ['test', 'local'], }, + goerli: { + accounts: [ + '0xe103483d1895337a75facd0bc4d80e5672b35de7cee684e0e92e3e49557450f4', + ], + url: 'https://goerli.infura.io/v3/3220334641dc41dca4f0d0ab2c65712e', + live: true, + saveDeployments: true, + tags: ['test', 'goerli'], + }, }, mocha: { timeout: 50000, diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts new file mode 100644 index 000000000..6214d6ab6 --- /dev/null +++ b/src/hardhat-deploy-ethers.ts @@ -0,0 +1,55 @@ +/* Imports: External */ +import { Contract } from 'ethers' +import { Provider } from '@ethersproject/abstract-provider' +import { Signer } from '@ethersproject/abstract-signer' +import { HardhatRuntimeEnvironment } from 'hardhat/types' + +export const getDeployedContract = async ( + hre: HardhatRuntimeEnvironment, + name: string, + options: { + iface?: string + signerOrProvider?: Signer | Provider | string + } = {} +): Promise => { + const deployed = await hre.deployments.get(name) + + await hre.ethers.provider.waitForTransaction(deployed.receipt.transactionHash) + + // Get the correct interface. + let iface = new hre.ethers.utils.Interface(deployed.abi) + if (options.iface) { + const factory = await hre.ethers.getContractFactory(options.iface) + iface = factory.interface + } + + let signerOrProvider: Signer | Provider = hre.ethers.provider + if (options.signerOrProvider) { + if (typeof options.signerOrProvider === 'string') { + signerOrProvider = hre.ethers.provider.getSigner(options.signerOrProvider) + } else { + signerOrProvider = options.signerOrProvider + } + } + + const def = Object.defineProperty + Object.defineProperty = (obj, name, prop) => { + prop.writable = true + return def(obj, name, prop) + } + const contract = new Contract(deployed.address, iface, signerOrProvider) + Object.defineProperty = def + + for (const name of Object.keys(contract.functions)) { + const fn = contract[name].bind(contract) + ;(contract as any)[name] = async (...args: any) => { + const result = await fn(...args) + if (typeof result === 'object' && typeof result.wait === 'function') { + await result.wait() + } + return result + } + } + + return contract +} From 2e9f3d010a16b9ab201973687bdb492cea123821 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 00:17:21 -0700 Subject: [PATCH 14/41] I committed my private key again. There goes my goerli eth --- hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 3f4c714b9..75942a262 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -24,7 +24,7 @@ const config: HardhatUserConfig = { }, goerli: { accounts: [ - '0xe103483d1895337a75facd0bc4d80e5672b35de7cee684e0e92e3e49557450f4', + '', ], url: 'https://goerli.infura.io/v3/3220334641dc41dca4f0d0ab2c65712e', live: true, From 46af00f0f0c37f824878ef23ec53dcf80b53a8b0 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 00:17:43 -0700 Subject: [PATCH 15/41] and my infura api key too --- hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 75942a262..a801adaa0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -26,7 +26,7 @@ const config: HardhatUserConfig = { accounts: [ '', ], - url: 'https://goerli.infura.io/v3/3220334641dc41dca4f0d0ab2c65712e', + url: '', live: true, saveDeployments: true, tags: ['test', 'goerli'], From c978988be0dc81dda92d0f70e60d0926d54bcb55 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 00:27:01 -0700 Subject: [PATCH 16/41] Fix lint errors --- hardhat.config.ts | 9 --------- package.json | 8 ++++---- src/hardhat-deploy-ethers.ts | 14 +++++++++----- tslint.json | 3 ++- yarn.lock | 11 +++++++++++ 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index a801adaa0..52754db39 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -22,15 +22,6 @@ const config: HardhatUserConfig = { saveDeployments: false, tags: ['test', 'local'], }, - goerli: { - accounts: [ - '', - ], - url: '', - live: true, - saveDeployments: true, - tags: ['test', 'goerli'], - }, }, mocha: { timeout: 50000, diff --git a/package.json b/package.json index a98daef4f..aa667bdde 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,9 @@ "test": "yarn run test:contracts", "test:contracts": "hardhat test --show-stack-traces", "test:gas": "hardhat test \"test/contracts/OVM/execution/OVM_StateManager.gas-spec.ts\" --no-compile --show-stack-traces", - "lint": "yarn run lint:typescript", - "lint:typescript": "tslint --format stylish --project .", - "lint:fix": "yarn run lint:fix:typescript", - "lint:fix:typescript": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy,hardhat}/**/*.ts\"", + "lint": "yarn lint:fix && yarn run lint:check", + "lint:check": "tslint --format stylish --project .", + "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,deploy,hardhat}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", "serve": "./bin/serve_dump.sh", @@ -53,6 +52,7 @@ "devDependencies": { "@eth-optimism/plugins": "^1.0.0-alpha.2", "@eth-optimism/smock": "^1.0.0-alpha.3", + "@ethersproject/abstract-signer": "^5.0.14", "@nomiclabs/hardhat-ethers": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1", "@typechain/ethers-v5": "1.0.0", diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index 6214d6ab6..73f3e32c4 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -32,17 +32,21 @@ export const getDeployedContract = async ( } } + // Temporarily override Object.defineProperty to bypass ether's object protection. const def = Object.defineProperty - Object.defineProperty = (obj, name, prop) => { + Object.defineProperty = (obj, propName, prop) => { prop.writable = true - return def(obj, name, prop) + return def(obj, propName, prop) } + const contract = new Contract(deployed.address, iface, signerOrProvider) + + // Now reset Object.defineProperty Object.defineProperty = def - for (const name of Object.keys(contract.functions)) { - const fn = contract[name].bind(contract) - ;(contract as any)[name] = async (...args: any) => { + for (const fnName of Object.keys(contract.functions)) { + const fn = contract[fnName].bind(contract) + ;(contract as any)[fnName] = async (...args: any) => { const result = await fn(...args) if (typeof result === 'object' && typeof result.wait === 'function') { await result.wait() diff --git a/tslint.json b/tslint.json index ac34ac901..af84fadf7 100644 --- a/tslint.json +++ b/tslint.json @@ -2,6 +2,7 @@ "extends": "@eth-optimism/dev/tslint.json", "rules": { "array-type": false, - "class-name": false + "class-name": false, + "prefer-conditional-expression": false } } diff --git a/yarn.lock b/yarn.lock index 7f9a1d6a4..2ae5fcdeb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -238,6 +238,17 @@ "@ethersproject/logger" "^5.0.8" "@ethersproject/properties" "^5.0.7" +"@ethersproject/abstract-signer@^5.0.14": + version "5.0.14" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.14.tgz#30ef912b0f86599d90fdffc65c110452e7b55cf1" + integrity sha512-JztBwVO7o5OHLh2vyjordlS4/1EjRyaECtc8vPdXTF1i4dXN+J0coeRoPN6ZFbBvi/YbaB6br2fvqhst1VQD/g== + dependencies: + "@ethersproject/abstract-provider" "^5.0.8" + "@ethersproject/bignumber" "^5.0.13" + "@ethersproject/bytes" "^5.0.9" + "@ethersproject/logger" "^5.0.8" + "@ethersproject/properties" "^5.0.7" + "@ethersproject/address@5.0.10", "@ethersproject/address@>=5.0.0-beta.128", "@ethersproject/address@^5.0.2", "@ethersproject/address@^5.0.9": version "5.0.10" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.0.10.tgz#2bc69fdff4408e0570471cd19dee577ab06a10d0" From aba6d1f9d6f079be1e5b349add03484d67ba19b3 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 01:08:19 -0700 Subject: [PATCH 17/41] Use strict ordering --- ..._AddressManager.deploy.ts => 000-Lib_AddressManager.deploy.ts} | 0 ...loy.ts => 001-OVM_ChainStorageContainer_ctc_batches.deploy.ts} | 0 ...eploy.ts => 002-OVM_ChainStorageContainer_ctc_queue.deploy.ts} | 0 ...loy.ts => 003-OVM_ChainStorageContainer_scc_batches.deploy.ts} | 0 ...hain.deploy.ts => 004-OVM_CanonicalTransactionChain.deploy.ts} | 0 ...mentChain.deploy.ts => 005-OVM_StateCommitmentChain.deploy.ts} | 0 ...cutionManager.deploy.ts => 006-OVM_ExecutionManager.deploy.ts} | 0 ...VM_FraudVerifier.deploy.ts => 007-OVM_FraudVerifier.deploy.ts} | 0 ...VM_BondManager.deploy.ts => 008-mockOVM_BondManager.deploy.ts} | 0 ...VM_SafetyChecker.deploy.ts => 009-OVM_SafetyChecker.deploy.ts} | 0 ...gerFactory.deploy.ts => 010-OVM_StateManagerFactory.deploy.ts} | 0 ...ctory.deploy.ts => 011-OVM_StateTransitionerFactory.deploy.ts} | 0 ...eRelayer.deploy.ts => 012-OVM_L1MultiMessageRelayer.deploy.ts} | 0 ...ssenger.deploy.ts => 013-OVM_L1CrossDomainMessenger.deploy.ts} | 0 ....deploy.ts => 014-Proxy__OVM_L1CrossDomainMessenger.deploy.ts} | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename deploy/{Lib_AddressManager.deploy.ts => 000-Lib_AddressManager.deploy.ts} (100%) rename deploy/{OVM_ChainStorageContainer_ctc_batches.deploy.ts => 001-OVM_ChainStorageContainer_ctc_batches.deploy.ts} (100%) rename deploy/{OVM_ChainStorageContainer_ctc_queue.deploy.ts => 002-OVM_ChainStorageContainer_ctc_queue.deploy.ts} (100%) rename deploy/{OVM_ChainStorageContainer_scc_batches.deploy.ts => 003-OVM_ChainStorageContainer_scc_batches.deploy.ts} (100%) rename deploy/{OVM_CanonicalTransactionChain.deploy.ts => 004-OVM_CanonicalTransactionChain.deploy.ts} (100%) rename deploy/{OVM_StateCommitmentChain.deploy.ts => 005-OVM_StateCommitmentChain.deploy.ts} (100%) rename deploy/{OVM_ExecutionManager.deploy.ts => 006-OVM_ExecutionManager.deploy.ts} (100%) rename deploy/{OVM_FraudVerifier.deploy.ts => 007-OVM_FraudVerifier.deploy.ts} (100%) rename deploy/{mockOVM_BondManager.deploy.ts => 008-mockOVM_BondManager.deploy.ts} (100%) rename deploy/{OVM_SafetyChecker.deploy.ts => 009-OVM_SafetyChecker.deploy.ts} (100%) rename deploy/{OVM_StateManagerFactory.deploy.ts => 010-OVM_StateManagerFactory.deploy.ts} (100%) rename deploy/{OVM_StateTransitionerFactory.deploy.ts => 011-OVM_StateTransitionerFactory.deploy.ts} (100%) rename deploy/{OVM_L1MultiMessageRelayer.deploy.ts => 012-OVM_L1MultiMessageRelayer.deploy.ts} (100%) rename deploy/{OVM_L1CrossDomainMessenger.deploy.ts => 013-OVM_L1CrossDomainMessenger.deploy.ts} (100%) rename deploy/{Proxy__OVM_L1CrossDomainMessenger.deploy.ts => 014-Proxy__OVM_L1CrossDomainMessenger.deploy.ts} (100%) diff --git a/deploy/Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts similarity index 100% rename from deploy/Lib_AddressManager.deploy.ts rename to deploy/000-Lib_AddressManager.deploy.ts diff --git a/deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts similarity index 100% rename from deploy/OVM_ChainStorageContainer_ctc_batches.deploy.ts rename to deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts diff --git a/deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts similarity index 100% rename from deploy/OVM_ChainStorageContainer_ctc_queue.deploy.ts rename to deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts diff --git a/deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts similarity index 100% rename from deploy/OVM_ChainStorageContainer_scc_batches.deploy.ts rename to deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts diff --git a/deploy/OVM_CanonicalTransactionChain.deploy.ts b/deploy/004-OVM_CanonicalTransactionChain.deploy.ts similarity index 100% rename from deploy/OVM_CanonicalTransactionChain.deploy.ts rename to deploy/004-OVM_CanonicalTransactionChain.deploy.ts diff --git a/deploy/OVM_StateCommitmentChain.deploy.ts b/deploy/005-OVM_StateCommitmentChain.deploy.ts similarity index 100% rename from deploy/OVM_StateCommitmentChain.deploy.ts rename to deploy/005-OVM_StateCommitmentChain.deploy.ts diff --git a/deploy/OVM_ExecutionManager.deploy.ts b/deploy/006-OVM_ExecutionManager.deploy.ts similarity index 100% rename from deploy/OVM_ExecutionManager.deploy.ts rename to deploy/006-OVM_ExecutionManager.deploy.ts diff --git a/deploy/OVM_FraudVerifier.deploy.ts b/deploy/007-OVM_FraudVerifier.deploy.ts similarity index 100% rename from deploy/OVM_FraudVerifier.deploy.ts rename to deploy/007-OVM_FraudVerifier.deploy.ts diff --git a/deploy/mockOVM_BondManager.deploy.ts b/deploy/008-mockOVM_BondManager.deploy.ts similarity index 100% rename from deploy/mockOVM_BondManager.deploy.ts rename to deploy/008-mockOVM_BondManager.deploy.ts diff --git a/deploy/OVM_SafetyChecker.deploy.ts b/deploy/009-OVM_SafetyChecker.deploy.ts similarity index 100% rename from deploy/OVM_SafetyChecker.deploy.ts rename to deploy/009-OVM_SafetyChecker.deploy.ts diff --git a/deploy/OVM_StateManagerFactory.deploy.ts b/deploy/010-OVM_StateManagerFactory.deploy.ts similarity index 100% rename from deploy/OVM_StateManagerFactory.deploy.ts rename to deploy/010-OVM_StateManagerFactory.deploy.ts diff --git a/deploy/OVM_StateTransitionerFactory.deploy.ts b/deploy/011-OVM_StateTransitionerFactory.deploy.ts similarity index 100% rename from deploy/OVM_StateTransitionerFactory.deploy.ts rename to deploy/011-OVM_StateTransitionerFactory.deploy.ts diff --git a/deploy/OVM_L1MultiMessageRelayer.deploy.ts b/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts similarity index 100% rename from deploy/OVM_L1MultiMessageRelayer.deploy.ts rename to deploy/012-OVM_L1MultiMessageRelayer.deploy.ts diff --git a/deploy/OVM_L1CrossDomainMessenger.deploy.ts b/deploy/013-OVM_L1CrossDomainMessenger.deploy.ts similarity index 100% rename from deploy/OVM_L1CrossDomainMessenger.deploy.ts rename to deploy/013-OVM_L1CrossDomainMessenger.deploy.ts diff --git a/deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts b/deploy/014-Proxy__OVM_L1CrossDomainMessenger.deploy.ts similarity index 100% rename from deploy/Proxy__OVM_L1CrossDomainMessenger.deploy.ts rename to deploy/014-Proxy__OVM_L1CrossDomainMessenger.deploy.ts From 219c9c16fbc8ea5e60439dc89e9d1c55f6a59245 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Sat, 27 Mar 2021 02:21:32 +0200 Subject: [PATCH 18/41] refactor: use helper for easy AddressManager deployments (#350) --- ...hainStorageContainer_ctc_batches.deploy.ts | 29 +++------------ ..._ChainStorageContainer_ctc_queue.deploy.ts | 29 +++------------ ...hainStorageContainer_scc_batches.deploy.ts | 29 +++------------ ...04-OVM_CanonicalTransactionChain.deploy.ts | 28 ++------------ deploy/005-OVM_StateCommitmentChain.deploy.ts | 28 ++------------ deploy/006-OVM_ExecutionManager.deploy.ts | 25 ++----------- deploy/007-OVM_FraudVerifier.deploy.ts | 26 +++---------- deploy/008-mockOVM_BondManager.deploy.ts | 1 + deploy/009-OVM_SafetyChecker.deploy.ts | 25 +++---------- deploy/010-OVM_StateManagerFactory.deploy.ts | 25 +++---------- ...011-OVM_StateTransitionerFactory.deploy.ts | 29 +++------------ .../012-OVM_L1MultiMessageRelayer.deploy.ts | 29 +++------------ src/hardhat-deploy-ethers.ts | 37 +++++++++++++++++++ 13 files changed, 90 insertions(+), 250 deletions(-) diff --git a/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts index a4d819f7c..99413c327 100644 --- a/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts +++ b/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -2,35 +2,16 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_ChainStorageContainer:CTC:batches', { + name: 'OVM_ChainStorageContainer:CTC:batches', contract: 'OVM_ChainStorageContainer', - from: deployer, - args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], - log: true, - }) - - if (!result.newlyDeployed) { - return + args: ['OVM_CanonicalTransactionChain'], } - - await Lib_AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:batches', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts index b7ab1ef41..29f64dac4 100644 --- a/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts +++ b/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -2,35 +2,16 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_ChainStorageContainer:CTC:queue', { + name: 'OVM_ChainStorageContainer:CTC:queue', contract: 'OVM_ChainStorageContainer', - from: deployer, - args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], - log: true, - }) - - if (!result.newlyDeployed) { - return + args: ['OVM_CanonicalTransactionChain'], } - - await Lib_AddressManager.setAddress( - 'OVM_ChainStorageContainer:CTC:queue', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts index 4e8bbe475..fc7df045f 100644 --- a/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts +++ b/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -2,35 +2,16 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_ChainStorageContainer:SCC:queue', { + name: 'OVM_ChainStorageContainer:SCC:queue', contract: 'OVM_ChainStorageContainer', - from: deployer, - args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'], - log: true, - }) - - if (!result.newlyDeployed) { - return + args: ['OVM_StateCommitmentChain'], } - - await Lib_AddressManager.setAddress( - 'OVM_ChainStorageContainer:SCC:queue', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/004-OVM_CanonicalTransactionChain.deploy.ts b/deploy/004-OVM_CanonicalTransactionChain.deploy.ts index b9af75bb3..17447b8f2 100644 --- a/deploy/004-OVM_CanonicalTransactionChain.deploy.ts +++ b/deploy/004-OVM_CanonicalTransactionChain.deploy.ts @@ -2,39 +2,19 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_CanonicalTransactionChain', { - from: deployer, + name: 'OVM_CanonicalTransactionChain', args: [ - Lib_AddressManager.address, (hre as any).deployConfig.ctcForceInclusionPeriodSeconds, (hre as any).deployConfig.ctcForceInclusionPeriodBlocks, (hre as any).deployConfig.ctcMaxTransactionGasLimit, ], - log: true, - }) - - if (!result.newlyDeployed) { - return } - - await Lib_AddressManager.setAddress( - 'OVM_CanonicalTransactionChain', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/005-OVM_StateCommitmentChain.deploy.ts b/deploy/005-OVM_StateCommitmentChain.deploy.ts index 8be76accd..e7b00bc2e 100644 --- a/deploy/005-OVM_StateCommitmentChain.deploy.ts +++ b/deploy/005-OVM_StateCommitmentChain.deploy.ts @@ -2,38 +2,18 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_StateCommitmentChain', { - from: deployer, + name: 'OVM_StateCommitmentChain', args: [ - Lib_AddressManager.address, (hre as any).deployConfig.sccFraudProofWindow, (hre as any).deployConfig.sccSequencerPublishWindow, ], - log: true, - }) - - if (!result.newlyDeployed) { - return } - - await Lib_AddressManager.setAddress( - 'OVM_StateCommitmentChain', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/006-OVM_ExecutionManager.deploy.ts b/deploy/006-OVM_ExecutionManager.deploy.ts index a8fd27c78..05a2c493c 100644 --- a/deploy/006-OVM_ExecutionManager.deploy.ts +++ b/deploy/006-OVM_ExecutionManager.deploy.ts @@ -2,24 +2,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_ExecutionManager', { - from: deployer, + name: 'OVM_ExecutionManager', args: [ - Lib_AddressManager.address, { minTransactionGasLimit: (hre as any).deployConfig .emMinTransactionGasLimit, @@ -33,14 +22,8 @@ const deployFn: DeployFunction = async (hre) => { ovmCHAINID: (hre as any).deployConfig.emOvmChainId, }, ], - log: true, - }) - - if (!result.newlyDeployed) { - return } - - await Lib_AddressManager.setAddress('OVM_ExecutionManager', result.address) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/007-OVM_FraudVerifier.deploy.ts b/deploy/007-OVM_FraudVerifier.deploy.ts index 88a01703a..a87090cdf 100644 --- a/deploy/007-OVM_FraudVerifier.deploy.ts +++ b/deploy/007-OVM_FraudVerifier.deploy.ts @@ -2,31 +2,15 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_FraudVerifier', { - from: deployer, - args: [Lib_AddressManager.address], - log: true, - }) - - if (!result.newlyDeployed) { - return + name: 'OVM_FraudVerifier', + args: [], } - - await Lib_AddressManager.setAddress('OVM_FraudVerifier', result.address) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/008-mockOVM_BondManager.deploy.ts b/deploy/008-mockOVM_BondManager.deploy.ts index f584f5589..b94539eda 100644 --- a/deploy/008-mockOVM_BondManager.deploy.ts +++ b/deploy/008-mockOVM_BondManager.deploy.ts @@ -16,6 +16,7 @@ const deployFn: DeployFunction = async (hre) => { } ) + // TODO: Why is this mocked? const result = await deploy('mockOVM_BondManager', { from: deployer, args: [Lib_AddressManager.address], diff --git a/deploy/009-OVM_SafetyChecker.deploy.ts b/deploy/009-OVM_SafetyChecker.deploy.ts index fc4af6ec7..88f255d10 100644 --- a/deploy/009-OVM_SafetyChecker.deploy.ts +++ b/deploy/009-OVM_SafetyChecker.deploy.ts @@ -2,31 +2,16 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_SafetyChecker', { - from: deployer, + name: 'OVM_SafetyChecker', args: [], - log: true, - }) - - if (!result.newlyDeployed) { - return + withAddressManager: false, } - - await Lib_AddressManager.setAddress('OVM_SafetyChecker', result.address) + await deploy(cfg) } deployFn.tags = ['OVM_SafetyChecker'] diff --git a/deploy/010-OVM_StateManagerFactory.deploy.ts b/deploy/010-OVM_StateManagerFactory.deploy.ts index 1aa0ee050..fc4a302d0 100644 --- a/deploy/010-OVM_StateManagerFactory.deploy.ts +++ b/deploy/010-OVM_StateManagerFactory.deploy.ts @@ -2,31 +2,16 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_StateManagerFactory', { - from: deployer, + name: 'OVM_StateManagerFactory', args: [], - log: true, - }) - - if (!result.newlyDeployed) { - return + withAddressManager: false, } - - await Lib_AddressManager.setAddress('OVM_StateManagerFactory', result.address) + await deploy(cfg) } deployFn.tags = ['OVM_StateManagerFactory'] diff --git a/deploy/011-OVM_StateTransitionerFactory.deploy.ts b/deploy/011-OVM_StateTransitionerFactory.deploy.ts index 7144a0117..18ba24eb3 100644 --- a/deploy/011-OVM_StateTransitionerFactory.deploy.ts +++ b/deploy/011-OVM_StateTransitionerFactory.deploy.ts @@ -2,34 +2,15 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_StateTransitionerFactory', { - from: deployer, - args: [Lib_AddressManager.address], - log: true, - }) - - if (!result.newlyDeployed) { - return + name: 'OVM_StateTransitionerFactory', + args: [], } - - await Lib_AddressManager.setAddress( - 'OVM_StateTransitionerFactory', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts b/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts index d99de73b0..ce6a9c3cb 100644 --- a/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts +++ b/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts @@ -2,34 +2,15 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { deploy } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const { deploy } = hre.deployments - const { deployer } = await hre.getNamedAccounts() - - const Lib_AddressManager = await getDeployedContract( + const cfg = { hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) - - const result = await deploy('OVM_L1MultiMessageRelayer', { - from: deployer, - args: [Lib_AddressManager.address], - log: true, - }) - - if (!result.newlyDeployed) { - return + name: 'OVM_L1MultiMessageRelayer', + args: [], } - - await Lib_AddressManager.setAddress( - 'OVM_L1MultiMessageRelayer', - result.address - ) + await deploy(cfg) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index 73f3e32c4..aaef5dac9 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -4,6 +4,43 @@ import { Provider } from '@ethersproject/abstract-provider' import { Signer } from '@ethersproject/abstract-signer' import { HardhatRuntimeEnvironment } from 'hardhat/types' +export const deploy = async (cfg: { + hre: HardhatRuntimeEnvironment + name: string + args: any[] + contract?: string + withAddressManager?: boolean +}) => { + let { hre, name, args, contract, withAddressManager } = cfg + const { deploy: hhDeploy } = hre.deployments + + // TODO: Cache these 2 across calls? + const { deployer } = await hre.getNamedAccounts() + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + // by default use the address manager + if (withAddressManager == undefined || withAddressManager == true) { + args = [Lib_AddressManager.address, ...args] + } + + const result = await hhDeploy(name, { + contract, + from: deployer, + args, + log: true, + }) + + if (result.newlyDeployed) { + await Lib_AddressManager.setAddress(name, result.address) + } +} + export const getDeployedContract = async ( hre: HardhatRuntimeEnvironment, name: string, From 74224888b43632f940165080ab2502ca34f4f15a Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 26 Mar 2021 17:32:05 -0700 Subject: [PATCH 19/41] Clean up georgios pr --- ...ChainStorageContainer_ctc_batches.deploy.ts | 17 ++++++++++++----- ...M_ChainStorageContainer_ctc_queue.deploy.ts | 17 ++++++++++++----- ...ChainStorageContainer_scc_batches.deploy.ts | 17 ++++++++++++----- ...004-OVM_CanonicalTransactionChain.deploy.ts | 16 ++++++++++++---- deploy/005-OVM_StateCommitmentChain.deploy.ts | 16 ++++++++++++---- deploy/006-OVM_ExecutionManager.deploy.ts | 16 ++++++++++++---- deploy/007-OVM_FraudVerifier.deploy.ts | 17 ++++++++++++----- deploy/008-mockOVM_BondManager.deploy.ts | 1 - deploy/009-OVM_SafetyChecker.deploy.ts | 8 +++----- deploy/010-OVM_StateManagerFactory.deploy.ts | 8 +++----- .../011-OVM_StateTransitionerFactory.deploy.ts | 17 ++++++++++++----- deploy/012-OVM_L1MultiMessageRelayer.deploy.ts | 17 ++++++++++++----- src/hardhat-deploy-ethers.ts | 18 ++++++++---------- 13 files changed, 122 insertions(+), 63 deletions(-) diff --git a/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts b/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts index 99413c327..95f88e754 100644 --- a/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts +++ b/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts @@ -2,16 +2,23 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_ChainStorageContainer:CTC:batches', contract: 'OVM_ChainStorageContainer', - args: ['OVM_CanonicalTransactionChain'], - } - await deploy(cfg) + args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts b/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts index 29f64dac4..02dd9918f 100644 --- a/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts +++ b/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts @@ -2,16 +2,23 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_ChainStorageContainer:CTC:queue', contract: 'OVM_ChainStorageContainer', - args: ['OVM_CanonicalTransactionChain'], - } - await deploy(cfg) + args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts b/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts index fc7df045f..0092dad80 100644 --- a/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts +++ b/deploy/003-OVM_ChainStorageContainer_scc_batches.deploy.ts @@ -2,16 +2,23 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_ChainStorageContainer:SCC:queue', contract: 'OVM_ChainStorageContainer', - args: ['OVM_StateCommitmentChain'], - } - await deploy(cfg) + args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/004-OVM_CanonicalTransactionChain.deploy.ts b/deploy/004-OVM_CanonicalTransactionChain.deploy.ts index 17447b8f2..a663f4398 100644 --- a/deploy/004-OVM_CanonicalTransactionChain.deploy.ts +++ b/deploy/004-OVM_CanonicalTransactionChain.deploy.ts @@ -2,19 +2,27 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_CanonicalTransactionChain', args: [ + Lib_AddressManager.address, (hre as any).deployConfig.ctcForceInclusionPeriodSeconds, (hre as any).deployConfig.ctcForceInclusionPeriodBlocks, (hre as any).deployConfig.ctcMaxTransactionGasLimit, ], - } - await deploy(cfg) + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/005-OVM_StateCommitmentChain.deploy.ts b/deploy/005-OVM_StateCommitmentChain.deploy.ts index e7b00bc2e..f84c41ea9 100644 --- a/deploy/005-OVM_StateCommitmentChain.deploy.ts +++ b/deploy/005-OVM_StateCommitmentChain.deploy.ts @@ -2,18 +2,26 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_StateCommitmentChain', args: [ + Lib_AddressManager.address, (hre as any).deployConfig.sccFraudProofWindow, (hre as any).deployConfig.sccSequencerPublishWindow, ], - } - await deploy(cfg) + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/006-OVM_ExecutionManager.deploy.ts b/deploy/006-OVM_ExecutionManager.deploy.ts index 05a2c493c..e21feba00 100644 --- a/deploy/006-OVM_ExecutionManager.deploy.ts +++ b/deploy/006-OVM_ExecutionManager.deploy.ts @@ -2,13 +2,22 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_ExecutionManager', args: [ + Lib_AddressManager.address, { minTransactionGasLimit: (hre as any).deployConfig .emMinTransactionGasLimit, @@ -22,8 +31,7 @@ const deployFn: DeployFunction = async (hre) => { ovmCHAINID: (hre as any).deployConfig.emOvmChainId, }, ], - } - await deploy(cfg) + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/007-OVM_FraudVerifier.deploy.ts b/deploy/007-OVM_FraudVerifier.deploy.ts index a87090cdf..a6c77f5e7 100644 --- a/deploy/007-OVM_FraudVerifier.deploy.ts +++ b/deploy/007-OVM_FraudVerifier.deploy.ts @@ -2,15 +2,22 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_FraudVerifier', - args: [], - } - await deploy(cfg) + args: [Lib_AddressManager.address], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/008-mockOVM_BondManager.deploy.ts b/deploy/008-mockOVM_BondManager.deploy.ts index b94539eda..f584f5589 100644 --- a/deploy/008-mockOVM_BondManager.deploy.ts +++ b/deploy/008-mockOVM_BondManager.deploy.ts @@ -16,7 +16,6 @@ const deployFn: DeployFunction = async (hre) => { } ) - // TODO: Why is this mocked? const result = await deploy('mockOVM_BondManager', { from: deployer, args: [Lib_AddressManager.address], diff --git a/deploy/009-OVM_SafetyChecker.deploy.ts b/deploy/009-OVM_SafetyChecker.deploy.ts index 88f255d10..24223dbaa 100644 --- a/deploy/009-OVM_SafetyChecker.deploy.ts +++ b/deploy/009-OVM_SafetyChecker.deploy.ts @@ -2,16 +2,14 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { deployAndRegister } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + await deployAndRegister({ hre, name: 'OVM_SafetyChecker', args: [], - withAddressManager: false, - } - await deploy(cfg) + }) } deployFn.tags = ['OVM_SafetyChecker'] diff --git a/deploy/010-OVM_StateManagerFactory.deploy.ts b/deploy/010-OVM_StateManagerFactory.deploy.ts index fc4a302d0..295e3b968 100644 --- a/deploy/010-OVM_StateManagerFactory.deploy.ts +++ b/deploy/010-OVM_StateManagerFactory.deploy.ts @@ -2,16 +2,14 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { deployAndRegister } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + await deployAndRegister({ hre, name: 'OVM_StateManagerFactory', args: [], - withAddressManager: false, - } - await deploy(cfg) + }) } deployFn.tags = ['OVM_StateManagerFactory'] diff --git a/deploy/011-OVM_StateTransitionerFactory.deploy.ts b/deploy/011-OVM_StateTransitionerFactory.deploy.ts index 18ba24eb3..2611f359e 100644 --- a/deploy/011-OVM_StateTransitionerFactory.deploy.ts +++ b/deploy/011-OVM_StateTransitionerFactory.deploy.ts @@ -2,15 +2,22 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_StateTransitionerFactory', - args: [], - } - await deploy(cfg) + args: [Lib_AddressManager.address], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts b/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts index ce6a9c3cb..8b74aefa3 100644 --- a/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts +++ b/deploy/012-OVM_L1MultiMessageRelayer.deploy.ts @@ -2,15 +2,22 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' /* Imports: Internal */ -import { deploy } from '../src/hardhat-deploy-ethers' +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { - const cfg = { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ hre, name: 'OVM_L1MultiMessageRelayer', - args: [], - } - await deploy(cfg) + args: [Lib_AddressManager.address], + }) } deployFn.dependencies = ['Lib_AddressManager'] diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index aaef5dac9..9a2e7b20c 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -4,15 +4,18 @@ import { Provider } from '@ethersproject/abstract-provider' import { Signer } from '@ethersproject/abstract-signer' import { HardhatRuntimeEnvironment } from 'hardhat/types' -export const deploy = async (cfg: { +export const deployAndRegister = async ({ + hre, + name, + args, + contract, +}: { hre: HardhatRuntimeEnvironment name: string args: any[] contract?: string - withAddressManager?: boolean }) => { - let { hre, name, args, contract, withAddressManager } = cfg - const { deploy: hhDeploy } = hre.deployments + const { deploy } = hre.deployments // TODO: Cache these 2 across calls? const { deployer } = await hre.getNamedAccounts() @@ -24,12 +27,7 @@ export const deploy = async (cfg: { } ) - // by default use the address manager - if (withAddressManager == undefined || withAddressManager == true) { - args = [Lib_AddressManager.address, ...args] - } - - const result = await hhDeploy(name, { + const result = await deploy(name, { contract, from: deployer, args, From 86b2f4dbd55f7f3cb76c2475f64d0d123bc65883 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 14:51:36 -0700 Subject: [PATCH 20/41] use dotenv to manage deployer keys --- .env.example | 7 +++++++ hardhat.config.ts | 45 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + yarn.lock | 14 ++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..64d5413fd --- /dev/null +++ b/.env.example @@ -0,0 +1,7 @@ +CONTRACTS_KOVAN_DEPLOYER_KEY= +CONTRACTS_GOERLI_DEPLOYER_KEY= +CONTRACTS_MAINNET_DEPLOYER_KEY= + +CONTRACTS_KOVAN_RPC_URL= +CONTRACTS_GOERLI_RPC_URL= +CONTRACTS_MAINNET_RPC_URL= diff --git a/hardhat.config.ts b/hardhat.config.ts index 0dab66b69..9641afa8b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,5 +1,6 @@ import { HardhatUserConfig } from 'hardhat/types' import 'solidity-coverage' +import * as dotenv from 'dotenv' import { DEFAULT_ACCOUNTS_HARDHAT, @@ -14,6 +15,9 @@ import '@typechain/hardhat' import '@eth-optimism/plugins/hardhat/compiler' import './hh' +// Load environment variables from .env +dotenv.config() + const config: HardhatUserConfig = { networks: { hardhat: { @@ -21,7 +25,7 @@ const config: HardhatUserConfig = { blockGasLimit: RUN_OVM_TEST_GAS * 2, live: false, saveDeployments: false, - tags: ['test', 'local'], + tags: ['local'], }, }, mocha: { @@ -53,4 +57,43 @@ const config: HardhatUserConfig = { }, } +if ( + process.env.CONTRACTS_GOERLI_DEPLOYER_KEY && + process.env.CONTRACTS_GOERLI_RPC_URL +) { + config.networks.goerli = { + accounts: [process.env.CONTRACTS_GOERLI_DEPLOYER_KEY], + url: process.env.CONTRACTS_GOERLI_RPC_URL, + live: true, + saveDeployments: true, + tags: ['goerli'], + } +} + +if ( + process.env.CONTRACTS_KOVAN_DEPLOYER_KEY && + process.env.CONTRACTS_KOVAN_RPC_URL +) { + config.networks.kovan = { + accounts: [process.env.CONTRACTS_KOVAN_DEPLOYER_KEY], + url: process.env.CONTRACTS_KOVAN_RPC_URL, + live: true, + saveDeployments: true, + tags: ['kovan'], + } +} + +if ( + process.env.CONTRACTS_MAINNET_DEPLOYER_KEY && + process.env.CONTRACTS_MAINNET_RPC_URL +) { + config.networks.mainnet = { + accounts: [process.env.CONTRACTS_MAINNET_DEPLOYER_KEY], + url: process.env.CONTRACTS_KOVAN_RPC_URL, + live: true, + saveDeployments: true, + tags: ['mainnet'], + } +} + export default config diff --git a/package.json b/package.json index aca790f53..882a43e2a 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "buffer-xor": "^2.0.2", "chai": "^4.3.1", "copyfiles": "^2.3.0", + "dotenv": "^8.2.0", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", "hardhat": "^2.0.8", diff --git a/yarn.lock b/yarn.lock index 2170cc492..60ea7f67a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3020,6 +3020,11 @@ dom-walk@^0.1.0: resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== +dotenv@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" + integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== + dotignore@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/dotignore/-/dotignore-0.1.2.tgz#f942f2200d28c3a76fbdd6f0ee9f3257c8a2e905" @@ -4169,6 +4174,15 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-extra@^9.0.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" From f3b2b7eade66bc67304df3f8d8603d6e45b42f11 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 7 Apr 2021 14:52:49 -0700 Subject: [PATCH 21/41] Update src/hardhat-deploy-ethers.ts Co-authored-by: Georgios Konstantopoulos --- src/hardhat-deploy-ethers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index 9a2e7b20c..648ffb668 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -79,6 +79,7 @@ export const getDeployedContract = async ( // Now reset Object.defineProperty Object.defineProperty = def + // Override each function call to also `.wait()` so as to simplify the deploy scripts' syntax. for (const fnName of Object.keys(contract.functions)) { const fn = contract[fnName].bind(contract) ;(contract as any)[fnName] = async (...args: any) => { From b99dd5b3cdd2ef9ac21a2752a073212e1677ff9f Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 14:57:58 -0700 Subject: [PATCH 22/41] Stricter checking on address set --- package.json | 4 +--- src/hardhat-deploy-ethers.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 882a43e2a..b6170da54 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,7 @@ "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", - "serve": "./bin/serve_dump.sh", - "deploy:hh": "hardhat deploy", - "verify": "hardhat etherscan-verify" + "serve": "./bin/serve_dump.sh" }, "peerDependencies": { "ethers": "^5.0.0" diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index 648ffb668..c59c13089 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -35,7 +35,19 @@ export const deployAndRegister = async ({ }) if (result.newlyDeployed) { - await Lib_AddressManager.setAddress(name, result.address) + const tx = await Lib_AddressManager.setAddress(name, result.address) + await tx.wait() + + const remoteAddress = await Lib_AddressManager.getAddress(name) + if (remoteAddress !== result.address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `Call to Lib_AddressManager.setAddress(${name}) was unsuccessful.\n` + + `Attempted to set address to: ${result.address}\n` + + `Actual address was set to: ${remoteAddress}\n` + + `This could indicate a compromised deployment.` + ) + } } } From b60c6b5a1888c3a1701a9d1f118b4a81519a8c31 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 15:16:44 -0700 Subject: [PATCH 23/41] add argument for sequencer address --- deploy/000-Lib_AddressManager.deploy.ts | 19 +++++++ hh/tasks/task-deploy.ts | 42 +++++++++++---- package.json | 2 +- src/hardhat-deploy-ethers.ts | 68 +++++++++++++++++-------- 4 files changed, 97 insertions(+), 34 deletions(-) diff --git a/deploy/000-Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts index c77791b80..b14c8c0b1 100644 --- a/deploy/000-Lib_AddressManager.deploy.ts +++ b/deploy/000-Lib_AddressManager.deploy.ts @@ -1,4 +1,5 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' +import { registerAddress } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { const { deploy } = hre.deployments @@ -9,6 +10,24 @@ const deployFn: DeployFunction = async (hre) => { args: [], log: true, }) + + await registerAddress({ + hre, + name: 'OVM_L2CrossDomainMessenger', + address: '0x4200000000000000000000000000000000000007', + }) + + await registerAddress({ + hre, + name: 'OVM_DecompressionPrecompileAddress', + address: '0x4200000000000000000000000000000000000005', + }) + + await registerAddress({ + hre, + name: 'OVM_Sequencer', + address: (hre as any).deployConfig.ovmSequencerAddress, + }) } deployFn.tags = ['Lib_AddressManager', 'required'] diff --git a/hh/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts index d14979cce..9adf1c181 100644 --- a/hh/tasks/task-deploy.ts +++ b/hh/tasks/task-deploy.ts @@ -1,6 +1,7 @@ /* Imports: External */ +import { ethers } from 'ethers' import { task } from 'hardhat/config' -import { int } from 'hardhat/internal/core/params/argumentTypes' +import * as types from 'hardhat/internal/core/params/argumentTypes' const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS = 60 * 60 * 24 * 30 // 30 days const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS = (60 * 60 * 24 * 30) / 15 // 30 days in blocks @@ -12,69 +13,88 @@ const DEFAULT_EM_SECONDS_PER_EPOCH = 0 const DEFAULT_EM_OVM_CHAIN_ID = 420 const DEFAULT_SCC_FRAUD_PROOF_WINDOW = 60 * 60 * 24 * 7 // 7 days const DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW = 60 * 30 // 30 minutes +const DEFAULT_OVM_SEQUENCER_ADDRESS = ethers.constants.AddressZero task('deploy') .addOptionalParam( 'ctcForceInclusionPeriodSeconds', 'Number of seconds that the sequencer has to include transactions before the L1 queue.', DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS, - int + types.int ) .addOptionalParam( 'ctcForceInclusionPeriodBlocks', 'Number of blocks that the sequencer has to include transactions before the L1 queue.', DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS, - int + types.int ) .addOptionalParam( 'ctcMaxTransactionGasLimit', 'Max gas limit for L1 queue transactions.', DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT, - int + types.int ) .addOptionalParam( 'emMinTransactionGasLimit', 'Minimum allowed transaction gas limit.', DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT, - int + types.int ) .addOptionalParam( 'emMaxTransactionGasLimit', 'Maximum allowed transaction gas limit.', DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT, - int + types.int ) .addOptionalParam( 'emMaxGasPerQueuePerEpoch', 'Maximum gas allowed in a given queue for each epoch.', DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH, - int + types.int ) .addOptionalParam( 'emSecondsPerEpoch', 'Number of seconds in each epoch.', DEFAULT_EM_SECONDS_PER_EPOCH, - int + types.int ) .addOptionalParam( 'emOvmChainId', 'Chain ID for the L2 network.', DEFAULT_EM_OVM_CHAIN_ID, - int + types.int ) .addOptionalParam( 'sccFraudProofWindow', 'Number of seconds until a transaction is considered finalized.', DEFAULT_SCC_FRAUD_PROOF_WINDOW, - int + types.int ) .addOptionalParam( 'sccSequencerPublishWindow', 'Number of seconds that the sequencer is exclusively allowed to post state roots.', DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW, - int + types.int + ) + .addOptionalParam( + 'ovmSequencerAddress', + 'Address of the sequencer. Must be provided or this deployment will fail.', + DEFAULT_OVM_SEQUENCER_ADDRESS, + types.string ) .setAction(async (args, hre: any, runSuper) => { + if (args.ovmSequencerAddress === DEFAULT_OVM_SEQUENCER_ADDRESS) { + throw new Error( + 'argument for --ovm-sequencer-address is required but was not provided' + ) + } + + if (!ethers.utils.isAddress(args.ovmSequencerAddress)) { + throw new Error( + `argument for --ovm-sequencer-address is not a valid address: ${args.ovmSequencerAddress}` + ) + } + hre.deployConfig = args return runSuper(args) }) diff --git a/package.json b/package.json index b6170da54..4691045b9 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage", "lint": "yarn lint:fix && yarn lint:check", "lint:check": "tslint --format stylish --project .", - "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test}/**/*.ts\"", + "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,hh,deploy}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", "serve": "./bin/serve_dump.sh" diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index c59c13089..b137eac0d 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -4,6 +4,47 @@ import { Provider } from '@ethersproject/abstract-provider' import { Signer } from '@ethersproject/abstract-signer' import { HardhatRuntimeEnvironment } from 'hardhat/types' +export const registerAddress = async ({ + hre, + name, + address, +}): Promise => { + // TODO: Cache these 2 across calls? + const { deployer } = await hre.getNamedAccounts() + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const currentAddress = await Lib_AddressManager.getAddress(name) + if (address === currentAddress) { + console.log( + `Not setting address for ${name} because it's already set to the correct value.` + ) + return + } + + console.log(`Setting address for ${name} to ${address}...`) + const tx = await Lib_AddressManager.setAddress(name, address) + await tx.wait() + + const remoteAddress = await Lib_AddressManager.getAddress(name) + if (remoteAddress !== address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `Call to Lib_AddressManager.setAddress(${name}) was unsuccessful.\n` + + `Attempted to set address to: ${address}\n` + + `Actual address was set to: ${remoteAddress}\n` + + `This could indicate a compromised deployment.` + ) + } + + console.log(`Successfully set address for ${name}!`) +} + export const deployAndRegister = async ({ hre, name, @@ -16,16 +57,7 @@ export const deployAndRegister = async ({ contract?: string }) => { const { deploy } = hre.deployments - - // TODO: Cache these 2 across calls? const { deployer } = await hre.getNamedAccounts() - const Lib_AddressManager = await getDeployedContract( - hre, - 'Lib_AddressManager', - { - signerOrProvider: deployer, - } - ) const result = await deploy(name, { contract, @@ -35,19 +67,11 @@ export const deployAndRegister = async ({ }) if (result.newlyDeployed) { - const tx = await Lib_AddressManager.setAddress(name, result.address) - await tx.wait() - - const remoteAddress = await Lib_AddressManager.getAddress(name) - if (remoteAddress !== result.address) { - throw new Error( - `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + - `Call to Lib_AddressManager.setAddress(${name}) was unsuccessful.\n` + - `Attempted to set address to: ${result.address}\n` + - `Actual address was set to: ${remoteAddress}\n` + - `This could indicate a compromised deployment.` - ) - } + await registerAddress({ + hre, + name, + address: result.address, + }) } } From b5e02afca4e4a5d583309b5a3dafc902b54ec461 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 15:31:36 -0700 Subject: [PATCH 24/41] minor tweaks to console.log comments --- .gitignore | 3 +++ src/hardhat-deploy-ethers.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5f7afa77c..01a98fd14 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ build/ # Coverage output coverage/ coverage.json + +# Environment variables +.env diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index b137eac0d..6f471c6bc 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -22,12 +22,12 @@ export const registerAddress = async ({ const currentAddress = await Lib_AddressManager.getAddress(name) if (address === currentAddress) { console.log( - `Not setting address for ${name} because it's already set to the correct value.` + `✓ Not registering address for ${name} because it's already been correctly registered` ) return } - console.log(`Setting address for ${name} to ${address}...`) + console.log(`Registering address for ${name} to ${address}...`) const tx = await Lib_AddressManager.setAddress(name, address) await tx.wait() @@ -42,7 +42,7 @@ export const registerAddress = async ({ ) } - console.log(`Successfully set address for ${name}!`) + console.log(`✓ Registered address for ${name}`) } export const deployAndRegister = async ({ From 1c685a42b90760d0d7cca0d5bdb39e13eff154a8 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 15:45:27 -0700 Subject: [PATCH 25/41] move predeploy addresses into their own file --- deploy/000-Lib_AddressManager.deploy.ts | 8 ++++++-- src/contract-dumps.ts | 14 +------------- src/predeploys.ts | 12 ++++++++++++ 3 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 src/predeploys.ts diff --git a/deploy/000-Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts index b14c8c0b1..bbb06010d 100644 --- a/deploy/000-Lib_AddressManager.deploy.ts +++ b/deploy/000-Lib_AddressManager.deploy.ts @@ -1,5 +1,9 @@ +/* Imports: External */ import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ import { registerAddress } from '../src/hardhat-deploy-ethers' +import { predeploys } from '../src/predeploys' const deployFn: DeployFunction = async (hre) => { const { deploy } = hre.deployments @@ -14,13 +18,13 @@ const deployFn: DeployFunction = async (hre) => { await registerAddress({ hre, name: 'OVM_L2CrossDomainMessenger', - address: '0x4200000000000000000000000000000000000007', + address: predeploys.OVM_L2CrossDomainMessenger, }) await registerAddress({ hre, name: 'OVM_DecompressionPrecompileAddress', - address: '0x4200000000000000000000000000000000000005', + address: predeploys.OVM_SequencerEntrypoint, }) await registerAddress({ diff --git a/src/contract-dumps.ts b/src/contract-dumps.ts index 04a10c978..697f35f12 100644 --- a/src/contract-dumps.ts +++ b/src/contract-dumps.ts @@ -8,6 +8,7 @@ import { fromHexString, toHexString, remove0x } from '@eth-optimism/core-utils' /* Internal Imports */ import { deploy, RollupDeployConfig } from './contract-deployment' import { getContractDefinition } from './contract-defs' +import { predeploys } from './predeploys' interface StorageDump { [key: string]: string @@ -160,19 +161,6 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise => { config = { ...config, ...cfg } - const predeploys = { - OVM_L2ToL1MessagePasser: '0x4200000000000000000000000000000000000000', - OVM_L1MessageSender: '0x4200000000000000000000000000000000000001', - OVM_DeployerWhitelist: '0x4200000000000000000000000000000000000002', - OVM_ECDSAContractAccount: '0x4200000000000000000000000000000000000003', - OVM_ProxySequencerEntrypoint: '0x4200000000000000000000000000000000000004', - OVM_SequencerEntrypoint: '0x4200000000000000000000000000000000000005', - OVM_ETH: '0x4200000000000000000000000000000000000006', - OVM_L2CrossDomainMessenger: '0x4200000000000000000000000000000000000007', - Lib_AddressManager: '0x4200000000000000000000000000000000000008', - ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', - } - const ovmCompiled = [ 'OVM_L2ToL1MessagePasser', 'OVM_L2CrossDomainMessenger', diff --git a/src/predeploys.ts b/src/predeploys.ts new file mode 100644 index 000000000..a442cf02c --- /dev/null +++ b/src/predeploys.ts @@ -0,0 +1,12 @@ +export const predeploys = { + OVM_L2ToL1MessagePasser: '0x4200000000000000000000000000000000000000', + OVM_L1MessageSender: '0x4200000000000000000000000000000000000001', + OVM_DeployerWhitelist: '0x4200000000000000000000000000000000000002', + OVM_ECDSAContractAccount: '0x4200000000000000000000000000000000000003', + OVM_ProxySequencerEntrypoint: '0x4200000000000000000000000000000000000004', + OVM_SequencerEntrypoint: '0x4200000000000000000000000000000000000005', + OVM_ETH: '0x4200000000000000000000000000000000000006', + OVM_L2CrossDomainMessenger: '0x4200000000000000000000000000000000000007', + Lib_AddressManager: '0x4200000000000000000000000000000000000008', + ERC1820Registry: '0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24', +} From 186490ca9e9c431392141f52e50c28b6eb02dd48 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 15:59:20 -0700 Subject: [PATCH 26/41] add small comment for clarity --- hh/tasks/task-deploy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/hh/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts index 9adf1c181..8b4509874 100644 --- a/hh/tasks/task-deploy.ts +++ b/hh/tasks/task-deploy.ts @@ -83,6 +83,7 @@ task('deploy') types.string ) .setAction(async (args, hre: any, runSuper) => { + // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. if (args.ovmSequencerAddress === DEFAULT_OVM_SEQUENCER_ADDRESS) { throw new Error( 'argument for --ovm-sequencer-address is required but was not provided' From fce852afb62dad56d56aafdd1d89d6453ceece18 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 17:39:51 -0700 Subject: [PATCH 27/41] update deploy script --- .env.example | 2 + bin/deploy.js | 120 ------------------ bin/deploy.ts | 35 +++++ deploy/000-Lib_AddressManager.deploy.ts | 6 + deploy/009-OVM_ExecutionManager.deploy.ts | 40 ++++++ deploy/010-OVM_FraudVerifer.deploy.ts | 26 ++++ deploy/011-OVM_StateManagerFactory.deploy.ts | 17 +++ ...012-OVM_StateTransitionerFactory.deploy.ts | 26 ++++ deploy/013-OVM_SafetyChecker.deploy.ts | 17 +++ .../014-OVM_L1MultiMessageRelayer.deploy.ts | 26 ++++ hardhat.config.ts | 15 ++- hh/tasks/task-deploy.ts | 37 +++++- package.json | 2 +- 13 files changed, 240 insertions(+), 129 deletions(-) delete mode 100755 bin/deploy.js create mode 100755 bin/deploy.ts create mode 100644 deploy/009-OVM_ExecutionManager.deploy.ts create mode 100644 deploy/010-OVM_FraudVerifer.deploy.ts create mode 100644 deploy/011-OVM_StateManagerFactory.deploy.ts create mode 100644 deploy/012-OVM_StateTransitionerFactory.deploy.ts create mode 100644 deploy/013-OVM_SafetyChecker.deploy.ts create mode 100644 deploy/014-OVM_L1MultiMessageRelayer.deploy.ts diff --git a/.env.example b/.env.example index 64d5413fd..1b81f1983 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ CONTRACTS_KOVAN_DEPLOYER_KEY= CONTRACTS_GOERLI_DEPLOYER_KEY= CONTRACTS_MAINNET_DEPLOYER_KEY= +CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY= CONTRACTS_KOVAN_RPC_URL= CONTRACTS_GOERLI_RPC_URL= CONTRACTS_MAINNET_RPC_URL= +CONTRACTS_CUSTOM_NETWORK_RPC_URL= diff --git a/bin/deploy.js b/bin/deploy.js deleted file mode 100755 index 270d5f44b..000000000 --- a/bin/deploy.js +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env node - -const contracts = require('../build/src/contract-deployment/deploy'); -const { providers, Wallet, utils, ethers } = require('ethers'); -const { LedgerSigner } = require('@ethersproject/hardware-wallets'); -const { JsonRpcProvider } = providers; - -const env = process.env; -const key = env.DEPLOYER_PRIVATE_KEY; -const sequencerKey = env.SEQUENCER_PRIVATE_KEY; -let SEQUENCER_ADDRESS = env.SEQUENCER_ADDRESS; -const web3Url = env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545'; -const DEPLOY_TX_GAS_LIMIT = env.DEPLOY_TX_GAS_LIMIT || 5000000; -const MIN_TRANSACTION_GAS_LIMIT = env.MIN_TRANSACTION_GAS_LIMIT || 50000; -const MAX_TRANSACTION_GAS_LIMIT = env.MAX_TRANSACTION_GAS_LIMIT || 9000000; -const MAX_GAS_PER_QUEUE_PER_EPOCH = env.MAX_GAS_PER_QUEUE_PER_EPOCH || 250000000; -const SECONDS_PER_EPOCH = env.SECONDS_PER_EPOCH || 0; -const WAIT_FOR_RECEIPTS = env.WAIT_FOR_RECEIPTS === 'true'; -let WHITELIST_OWNER = env.WHITELIST_OWNER; -const WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT = env.WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT || true; -const FORCE_INCLUSION_PERIOD_SECONDS = env.FORCE_INCLUSION_PERIOD_SECONDS || 2592000; // 30 days -const FRAUD_PROOF_WINDOW_SECONDS = env.FRAUD_PROOF_WINDOW_SECONDS || (60 * 60 * 24 * 7); // 7 days -const SEQUENCER_PUBLISH_WINDOW_SECONDS = env.SEQUENCER_PUBLISH_WINDOW_SECONDS || (60 * 30); // 30 min -const CHAIN_ID = env.CHAIN_ID || 420; // layer 2 chainid -const USE_LEDGER = env.USE_LEDGER || false; -const ADDRESS_MANAGER_ADDRESS = env.ADDRESS_MANAGER_ADDRESS || undefined; -const HD_PATH = env.HD_PATH || utils.defaultPath; -const BLOCK_TIME_SECONDS = env.BLOCK_TIME_SECONDS || 15; -const L2_CROSS_DOMAIN_MESSENGER_ADDRESS = - env.L2_CROSS_DOMAIN_MESSENGER_ADDRESS || '0x4200000000000000000000000000000000000007'; -let RELAYER_ADDRESS = env.RELAYER_ADDRESS || '0x0000000000000000000000000000000000000000'; -const RELAYER_PRIVATE_KEY = env.RELAYER_PRIVATE_KEY; - -(async () => { - const provider = new JsonRpcProvider(web3Url); - let signer; - - // Use the ledger for the deployer - if (USE_LEDGER) { - signer = new LedgerSigner(provider, 'default', HD_PATH); - } else { - if (typeof key === 'undefined') - throw new Error('Must pass deployer key as DEPLOYER_PRIVATE_KEY'); - signer = new Wallet(key, provider); - } - - if (SEQUENCER_ADDRESS) { - if (!utils.isAddress(SEQUENCER_ADDRESS)) - throw new Error(`Invalid Sequencer Address: ${SEQUENCER_ADDRESS}`); - } else { - if (!sequencerKey) - throw new Error('Must pass sequencer key as SEQUENCER_PRIVATE_KEY'); - const sequencer = new Wallet(sequencerKey, provider); - SEQUENCER_ADDRESS = await sequencer.getAddress(); - } - - if (typeof WHITELIST_OWNER === 'undefined') - WHITELIST_OWNER = signer; - - // Use the address derived from RELAYER_PRIVATE_KEY if a private key - // is passed. Using the zero address as the relayer address will mean - // there is no relayer authentication. - if (RELAYER_PRIVATE_KEY) { - if (!utils.isAddress(RELAYER_ADDRESS)) - throw new Error(`Invalid Relayer Address: ${RELAYER_ADDRESS}`); - const relayer = new Wallet(RELAYER_PRIVATE_KEY, provider); - RELAYER_ADDRESS = await relayer.getAddress(); - } - - const result = await contracts.deploy({ - deploymentSigner: signer, - transactionChainConfig: { - forceInclusionPeriodSeconds: FORCE_INCLUSION_PERIOD_SECONDS, - sequencer: SEQUENCER_ADDRESS, - forceInclusionPeriodBlocks: Math.ceil(FORCE_INCLUSION_PERIOD_SECONDS/BLOCK_TIME_SECONDS), - }, - stateChainConfig: { - fraudProofWindowSeconds: FRAUD_PROOF_WINDOW_SECONDS, - sequencerPublishWindowSeconds: SEQUENCER_PUBLISH_WINDOW_SECONDS, - }, - ovmGlobalContext: { - ovmCHAINID: CHAIN_ID, - L2CrossDomainMessengerAddress: L2_CROSS_DOMAIN_MESSENGER_ADDRESS - }, - l1CrossDomainMessengerConfig: { - relayerAddress: RELAYER_ADDRESS, - }, - ovmGasMeteringConfig: { - minTransactionGasLimit: MIN_TRANSACTION_GAS_LIMIT, - maxTransactionGasLimit: MAX_TRANSACTION_GAS_LIMIT, - maxGasPerQueuePerEpoch: MAX_GAS_PER_QUEUE_PER_EPOCH, - secondsPerEpoch: SECONDS_PER_EPOCH - }, - whitelistConfig: { - owner: WHITELIST_OWNER, - allowArbitraryContractDeployment: WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT - }, - deployOverrides: { - gasLimit: DEPLOY_TX_GAS_LIMIT - }, - waitForReceipts: WAIT_FOR_RECEIPTS, - addressManager: ADDRESS_MANAGER_ADDRESS, - }); - - const { failedDeployments, AddressManager } = result; - if (failedDeployments.length !== 0) - throw new Error(`Contract deployment failed: ${failedDeployments.join(',')}`); - - const out = {}; - out.AddressManager = AddressManager.address; - out.OVM_Sequencer = SEQUENCER_ADDRESS; - out.Deployer = await signer.getAddress() - for (const [name, contract] of Object.entries(result.contracts)) { - out[name] = contract.address; - } - console.log(JSON.stringify(out, null, 2)); -})().catch(err => { - console.log(JSON.stringify({error: err.message, stack: err.stack}, null, 2)); - process.exit(1); -}); diff --git a/bin/deploy.ts b/bin/deploy.ts new file mode 100755 index 000000000..1644635dd --- /dev/null +++ b/bin/deploy.ts @@ -0,0 +1,35 @@ +#!/usr/bin/env ts-node-script + +process.env.HARDHAT_NETWORK = 'custom' +process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY = + process.env.SEQUENCER_PRIVATE_KEY +process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL = + process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545' + +import hre from 'hardhat' + +const main = async () => { + hre.run('deploy', { + l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, + ctcForceInclusionPeriodSeconds: process.env.FORCE_INCLUSION_PERIOD_SECONDS, + ctcMaxTransactionGasLimit: process.env.MAX_TRANSACTION_GAS_LIMIT, + emMinTransactionGasLimit: process.env.MIN_TRANSACTION_GAS_LIMIT, + emMaxtransactionGasLimit: process.env.MAX_TRANSACTION_GAS_LIMIT, + emMaxGasPerQueuePerEpoch: process.env.MAX_GAS_PER_QUEUE_PER_EPOCH, + emSecondsPerEpoch: process.env.SECONDS_PER_EPOCH, + emOvmChainId: process.env.CHAIN_ID, + sccFraudProofWindow: process.env.FRAUD_PROOF_WINDOW_SECONDS, + sccSequencerPublishWindow: process.env.SEQUENCER_PUBLISH_WINDOW_SECONDS, + ovmSequencerAddress: process.env.SEQUENCER_ADDRESS, + ovmRelayerAddress: process.env.RELAYER_ADDRESS, + }) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.log( + JSON.stringify({ error: error.message, stack: error.stack }, null, 2) + ) + process.exit(1) + }) diff --git a/deploy/000-Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts index bbb06010d..963bda7f1 100644 --- a/deploy/000-Lib_AddressManager.deploy.ts +++ b/deploy/000-Lib_AddressManager.deploy.ts @@ -32,6 +32,12 @@ const deployFn: DeployFunction = async (hre) => { name: 'OVM_Sequencer', address: (hre as any).deployConfig.ovmSequencerAddress, }) + + await registerAddress({ + hre, + name: 'OVM_L2BatchMessageRelayer', + address: (hre as any).deployConfig.ovmRelayerAddress, + }) } deployFn.tags = ['Lib_AddressManager', 'required'] diff --git a/deploy/009-OVM_ExecutionManager.deploy.ts b/deploy/009-OVM_ExecutionManager.deploy.ts new file mode 100644 index 000000000..c1e62aeb3 --- /dev/null +++ b/deploy/009-OVM_ExecutionManager.deploy.ts @@ -0,0 +1,40 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ + hre, + name: 'OVM_ExecutionManager', + args: [ + Lib_AddressManager.address, + { + minTransactionGasLimit: (hre as any).deployConfig + .emMinTransactionGasLimit, + maxTransactionGasLimit: (hre as any).deployConfig + .emMaxTransactionGasLimit, + maxGasPerQueuePerEpoch: (hre as any).deployConfig + .emMaxGasPerQueuePerEpoch, + secondsPerEpoch: (hre as any).deployConfig.emSecondsPerEpoch, + }, + { + ovmCHAINID: (hre as any).deployConfig.emOvmChainId, + }, + ], + }) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_ExecutionManager'] + +export default deployFn diff --git a/deploy/010-OVM_FraudVerifer.deploy.ts b/deploy/010-OVM_FraudVerifer.deploy.ts new file mode 100644 index 000000000..a6c77f5e7 --- /dev/null +++ b/deploy/010-OVM_FraudVerifer.deploy.ts @@ -0,0 +1,26 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ + hre, + name: 'OVM_FraudVerifier', + args: [Lib_AddressManager.address], + }) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_FraudVerifier'] + +export default deployFn diff --git a/deploy/011-OVM_StateManagerFactory.deploy.ts b/deploy/011-OVM_StateManagerFactory.deploy.ts new file mode 100644 index 000000000..dde5f88ab --- /dev/null +++ b/deploy/011-OVM_StateManagerFactory.deploy.ts @@ -0,0 +1,17 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { deployAndRegister } from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + await deployAndRegister({ + hre, + name: 'OVM_StateManagerFactory', + args: [], + }) +} + +deployFn.tags = ['OVM_FraudVerifier'] + +export default deployFn diff --git a/deploy/012-OVM_StateTransitionerFactory.deploy.ts b/deploy/012-OVM_StateTransitionerFactory.deploy.ts new file mode 100644 index 000000000..2611f359e --- /dev/null +++ b/deploy/012-OVM_StateTransitionerFactory.deploy.ts @@ -0,0 +1,26 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ + hre, + name: 'OVM_StateTransitionerFactory', + args: [Lib_AddressManager.address], + }) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_StateTransitionerFactory'] + +export default deployFn diff --git a/deploy/013-OVM_SafetyChecker.deploy.ts b/deploy/013-OVM_SafetyChecker.deploy.ts new file mode 100644 index 000000000..24223dbaa --- /dev/null +++ b/deploy/013-OVM_SafetyChecker.deploy.ts @@ -0,0 +1,17 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { deployAndRegister } from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + await deployAndRegister({ + hre, + name: 'OVM_SafetyChecker', + args: [], + }) +} + +deployFn.tags = ['OVM_SafetyChecker'] + +export default deployFn diff --git a/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts b/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts new file mode 100644 index 000000000..8b74aefa3 --- /dev/null +++ b/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts @@ -0,0 +1,26 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { + deployAndRegister, + getDeployedContract, +} from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + await deployAndRegister({ + hre, + name: 'OVM_L1MultiMessageRelayer', + args: [Lib_AddressManager.address], + }) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_L1MultiMessageRelayer'] + +export default deployFn diff --git a/hardhat.config.ts b/hardhat.config.ts index 9641afa8b..bc1383392 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -89,11 +89,24 @@ if ( ) { config.networks.mainnet = { accounts: [process.env.CONTRACTS_MAINNET_DEPLOYER_KEY], - url: process.env.CONTRACTS_KOVAN_RPC_URL, + url: process.env.CONTRACTS_MAINNET_RPC_URL, live: true, saveDeployments: true, tags: ['mainnet'], } } +if ( + process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY && + process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL +) { + config.networks.custom = { + accounts: [process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY], + url: process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL, + live: true, + saveDeployments: true, + tags: ['custom'], + } +} + export default config diff --git a/hh/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts index 8b4509874..d0bbfdc2e 100644 --- a/hh/tasks/task-deploy.ts +++ b/hh/tasks/task-deploy.ts @@ -3,8 +3,8 @@ import { ethers } from 'ethers' import { task } from 'hardhat/config' import * as types from 'hardhat/internal/core/params/argumentTypes' +const DEFAULT_L1_BLOCK_TIME_SECONDS = 15 const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS = 60 * 60 * 24 * 30 // 30 days -const DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS = (60 * 60 * 24 * 30) / 15 // 30 days in blocks const DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT = 9_000_000 const DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT = 50_000 const DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT = 9_000_000 @@ -14,18 +14,19 @@ const DEFAULT_EM_OVM_CHAIN_ID = 420 const DEFAULT_SCC_FRAUD_PROOF_WINDOW = 60 * 60 * 24 * 7 // 7 days const DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW = 60 * 30 // 30 minutes const DEFAULT_OVM_SEQUENCER_ADDRESS = ethers.constants.AddressZero +const DEFAULT_OVM_RELAYER_ADDRESS = ethers.constants.AddressZero task('deploy') .addOptionalParam( - 'ctcForceInclusionPeriodSeconds', - 'Number of seconds that the sequencer has to include transactions before the L1 queue.', - DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS, + 'l1BlockTimeSeconds', + 'Number of seconds on average between every L1 block.', + DEFAULT_L1_BLOCK_TIME_SECONDS, types.int ) .addOptionalParam( - 'ctcForceInclusionPeriodBlocks', - 'Number of blocks that the sequencer has to include transactions before the L1 queue.', - DEFAULT_CTC_FORCE_INCLUSION_PERIOD_BLOCKS, + 'ctcForceInclusionPeriodSeconds', + 'Number of seconds that the sequencer has to include transactions before the L1 queue.', + DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS, types.int ) .addOptionalParam( @@ -82,6 +83,12 @@ task('deploy') DEFAULT_OVM_SEQUENCER_ADDRESS, types.string ) + .addOptionalParam( + 'ovmRelayerAddress', + 'Address of the message relayer. Must be provided or this deployment will fail.', + DEFAULT_OVM_RELAYER_ADDRESS, + types.string + ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. if (args.ovmSequencerAddress === DEFAULT_OVM_SEQUENCER_ADDRESS) { @@ -96,6 +103,22 @@ task('deploy') ) } + if (args.ovmRelayerAddress === DEFAULT_OVM_RELAYER_ADDRESS) { + throw new Error( + 'argument for --ovm-relayer-address is required but was not provided' + ) + } + + if (!ethers.utils.isAddress(args.ovmRelayerAddress)) { + throw new Error( + `argument for --ovm-relayer-address is not a valid address: ${args.ovmRelayerAddress}` + ) + } + + args.ctcForceInclusionPeriodBlocks = Math.floor( + args.ctcForceInclusionPeriodSeconds / args.l1BlockTimeSeconds + ) + hre.deployConfig = args return runSuper(args) }) diff --git a/package.json b/package.json index 4691045b9..352045c7c 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage", "lint": "yarn lint:fix && yarn lint:check", "lint:check": "tslint --format stylish --project .", - "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,hh,deploy}/**/*.ts\"", + "lint:fix": "prettier --config prettier-config.json --write \"hardhat.config.ts\" \"{src,test,hh,deploy,bin}/**/*.ts\"", "clean": "rm -rf ./build ./artifacts ./artifacts-ovm ./cache ./cache-ovm", "deploy": "./bin/deploy.js", "serve": "./bin/serve_dump.sh" From 9bf7288b5ea3d943200783e923a25938bf1fad05 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 17:40:58 -0700 Subject: [PATCH 28/41] fix incorrect env var in deploy script --- bin/deploy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/deploy.ts b/bin/deploy.ts index 1644635dd..6c8b87da1 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -2,7 +2,7 @@ process.env.HARDHAT_NETWORK = 'custom' process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY = - process.env.SEQUENCER_PRIVATE_KEY + process.env.DEPLOYER_PRIVATE_KEY process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL = process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545' From a3e94478a94ea0bca6c73921c39e1a917bb7fffd Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 18:04:31 -0700 Subject: [PATCH 29/41] adding deploy.js shim to get ci to work --- .env.example | 4 +-- bin/deploy.js | 23 +++++++++++++++++ bin/deploy.ts | 7 +++--- hardhat.config.ts | 64 ++++++++++++----------------------------------- 4 files changed, 44 insertions(+), 54 deletions(-) create mode 100755 bin/deploy.js diff --git a/.env.example b/.env.example index 1b81f1983..aeffa0673 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ CONTRACTS_KOVAN_DEPLOYER_KEY= CONTRACTS_GOERLI_DEPLOYER_KEY= CONTRACTS_MAINNET_DEPLOYER_KEY= -CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY= +CONTRACTS_CUSTOM_DEPLOYER_KEY= CONTRACTS_KOVAN_RPC_URL= CONTRACTS_GOERLI_RPC_URL= CONTRACTS_MAINNET_RPC_URL= -CONTRACTS_CUSTOM_NETWORK_RPC_URL= +CONTRACTS_CUSTOM_RPC_URL= diff --git a/bin/deploy.js b/bin/deploy.js new file mode 100755 index 000000000..f86db90f8 --- /dev/null +++ b/bin/deploy.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node + +const path = require('path') +const { spawn } = require('child_process') + +const main = async () => { + const task = spawn(path.join(__dirname, 'deploy.ts'), { stdio: 'inherit' }) + + await new Promise((resolve) => { + task.on('exit', () => { + resolve() + }) + }) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.log( + JSON.stringify({ error: error.message, stack: error.stack }, null, 2) + ) + process.exit(1) + }) diff --git a/bin/deploy.ts b/bin/deploy.ts index 6c8b87da1..e37093b46 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -1,15 +1,14 @@ #!/usr/bin/env ts-node-script process.env.HARDHAT_NETWORK = 'custom' -process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY = - process.env.DEPLOYER_PRIVATE_KEY -process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL = +process.env.CONTRACTS_CUSTOM_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY +process.env.CONTRACTS_CUSTOM_RPC_URL = process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545' import hre from 'hardhat' const main = async () => { - hre.run('deploy', { + await hre.run('deploy', { l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, ctcForceInclusionPeriodSeconds: process.env.FORCE_INCLUSION_PERIOD_SECONDS, ctcMaxTransactionGasLimit: process.env.MAX_TRANSACTION_GAS_LIMIT, diff --git a/hardhat.config.ts b/hardhat.config.ts index bc1383392..d2bb82fa8 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -57,56 +57,24 @@ const config: HardhatUserConfig = { }, } -if ( - process.env.CONTRACTS_GOERLI_DEPLOYER_KEY && - process.env.CONTRACTS_GOERLI_RPC_URL -) { - config.networks.goerli = { - accounts: [process.env.CONTRACTS_GOERLI_DEPLOYER_KEY], - url: process.env.CONTRACTS_GOERLI_RPC_URL, - live: true, - saveDeployments: true, - tags: ['goerli'], +const registerNetwork = (network: string) => { + const rpcUrl = process.env[`CONTRACTS_${network.toUpperCase()}_RPC_URL`] + const deployKey = + process.env[`CONTRACTS_${network.toUpperCase()}_DEPLOYER_KEY`] + if (deployKey && rpcUrl) { + config.networks[network] = { + accounts: [deployKey], + url: rpcUrl, + live: true, + saveDeployments: true, + tags: [network], + } } } -if ( - process.env.CONTRACTS_KOVAN_DEPLOYER_KEY && - process.env.CONTRACTS_KOVAN_RPC_URL -) { - config.networks.kovan = { - accounts: [process.env.CONTRACTS_KOVAN_DEPLOYER_KEY], - url: process.env.CONTRACTS_KOVAN_RPC_URL, - live: true, - saveDeployments: true, - tags: ['kovan'], - } -} - -if ( - process.env.CONTRACTS_MAINNET_DEPLOYER_KEY && - process.env.CONTRACTS_MAINNET_RPC_URL -) { - config.networks.mainnet = { - accounts: [process.env.CONTRACTS_MAINNET_DEPLOYER_KEY], - url: process.env.CONTRACTS_MAINNET_RPC_URL, - live: true, - saveDeployments: true, - tags: ['mainnet'], - } -} - -if ( - process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY && - process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL -) { - config.networks.custom = { - accounts: [process.env.CONTRACTS_CUSTOM_NETWORK_DEPLOYER_KEY], - url: process.env.CONTRACTS_CUSTOM_NETWORK_RPC_URL, - live: true, - saveDeployments: true, - tags: ['custom'], - } -} +registerNetwork('kovan') +registerNetwork('goerli') +registerNetwork('mainnet') +registerNetwork('custom') export default config From 8e79dc2a5a0f5e466ec68c46f40456caedea2ab2 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 18:09:20 -0700 Subject: [PATCH 30/41] simplify deployment environment vars --- .env.example | 12 +++--------- bin/deploy.ts | 5 +++-- hardhat.config.ts | 28 +++++++++++----------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.env.example b/.env.example index aeffa0673..04fc74c78 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,3 @@ -CONTRACTS_KOVAN_DEPLOYER_KEY= -CONTRACTS_GOERLI_DEPLOYER_KEY= -CONTRACTS_MAINNET_DEPLOYER_KEY= -CONTRACTS_CUSTOM_DEPLOYER_KEY= - -CONTRACTS_KOVAN_RPC_URL= -CONTRACTS_GOERLI_RPC_URL= -CONTRACTS_MAINNET_RPC_URL= -CONTRACTS_CUSTOM_RPC_URL= +CONTRACTS_TARGET_NETWORK= +CONTRACTS_DEPLOYER_KEY= +CONTRACTS_RPC_URL= diff --git a/bin/deploy.ts b/bin/deploy.ts index e37093b46..b7addc7ce 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -1,8 +1,9 @@ #!/usr/bin/env ts-node-script process.env.HARDHAT_NETWORK = 'custom' -process.env.CONTRACTS_CUSTOM_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY -process.env.CONTRACTS_CUSTOM_RPC_URL = +process.env.CONTRACTS_TARGET_NETWORK = 'custom' +process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY +process.env.CONTRACTS_RPC_URL = process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545' import hre from 'hardhat' diff --git a/hardhat.config.ts b/hardhat.config.ts index d2bb82fa8..3509da6c6 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -57,24 +57,18 @@ const config: HardhatUserConfig = { }, } -const registerNetwork = (network: string) => { - const rpcUrl = process.env[`CONTRACTS_${network.toUpperCase()}_RPC_URL`] - const deployKey = - process.env[`CONTRACTS_${network.toUpperCase()}_DEPLOYER_KEY`] - if (deployKey && rpcUrl) { - config.networks[network] = { - accounts: [deployKey], - url: rpcUrl, - live: true, - saveDeployments: true, - tags: [network], - } +if ( + process.env.CONTRACTS_TARGET_NETWORK && + process.env.CONTRACTS_DEPLOYER_KEY && + process.env.CONTRACTS_RPC_URL +) { + config.networks[process.env.CONTRACTS_TARGET_NETWORK] = { + accounts: [process.env.CONTRACTS_DEPLOYER_KEY], + url: process.env.CONTRACTS_RPC_URL, + live: true, + saveDeployments: true, + tags: [process.env.CONTRACTS_TARGET_NETWORK], } } -registerNetwork('kovan') -registerNetwork('goerli') -registerNetwork('mainnet') -registerNetwork('custom') - export default config From 7046b542040e41f1a6ab550d14686df653cfa9f9 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 18:28:46 -0700 Subject: [PATCH 31/41] temporary tweaks to get a ci run to pass --- bin/deploy.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/deploy.ts b/bin/deploy.ts index b7addc7ce..1fd000538 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -1,5 +1,7 @@ #!/usr/bin/env ts-node-script +import { Wallet } from 'ethers' + process.env.HARDHAT_NETWORK = 'custom' process.env.CONTRACTS_TARGET_NETWORK = 'custom' process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY @@ -9,6 +11,9 @@ process.env.CONTRACTS_RPC_URL = import hre from 'hardhat' const main = async () => { + const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) + const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) + await hre.run('deploy', { l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, ctcForceInclusionPeriodSeconds: process.env.FORCE_INCLUSION_PERIOD_SECONDS, @@ -18,10 +23,10 @@ const main = async () => { emMaxGasPerQueuePerEpoch: process.env.MAX_GAS_PER_QUEUE_PER_EPOCH, emSecondsPerEpoch: process.env.SECONDS_PER_EPOCH, emOvmChainId: process.env.CHAIN_ID, - sccFraudProofWindow: process.env.FRAUD_PROOF_WINDOW_SECONDS, + sccFraudProofWindow: parseInt(process.env.FRAUD_PROOF_WINDOW_SECONDS, 10), sccSequencerPublishWindow: process.env.SEQUENCER_PUBLISH_WINDOW_SECONDS, - ovmSequencerAddress: process.env.SEQUENCER_ADDRESS, - ovmRelayerAddress: process.env.RELAYER_ADDRESS, + ovmSequencerAddress: sequencer.address, + ovmRelayerAddress: deployer.address, }) } From 25446688c32e8a32e7c3f6161f19db12e95d08ec Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 20:50:40 -0700 Subject: [PATCH 32/41] print out deploy artifacts --- bin/deploy.js | 15 ++++++++++++++- package.json | 1 + src/hardhat-deploy-ethers.ts | 2 ++ yarn.lock | 7 ++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/bin/deploy.js b/bin/deploy.js index f86db90f8..d8dec63ad 100755 --- a/bin/deploy.js +++ b/bin/deploy.js @@ -2,15 +2,28 @@ const path = require('path') const { spawn } = require('child_process') +const dirtree = require('directory-tree') const main = async () => { - const task = spawn(path.join(__dirname, 'deploy.ts'), { stdio: 'inherit' }) + const task = spawn(path.join(__dirname, 'deploy.ts')) await new Promise((resolve) => { task.on('exit', () => { resolve() }) }) + + const contracts = dirtree( + path.resolve(__dirname, `../deployments/custom`) + ).children.filter((child) => { + return child.extension === '.json' + }).reduce((contracts, child) => { + const artifact = require(path.resolve(__dirname, `../deployments/custom/${child.name}`)) + contracts[child.name.replace('.json', '')] = artifact.address + return contracts + }, {}) + + console.log(contracts) } main() diff --git a/package.json b/package.json index cffc1dc43..fe051036d 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "buffer-xor": "^2.0.2", "chai": "^4.3.1", "copyfiles": "^2.3.0", + "directory-tree": "^2.2.7", "dotenv": "^8.2.0", "ethereum-waffle": "^3.3.0", "ethers": "^5.0.31", diff --git a/src/hardhat-deploy-ethers.ts b/src/hardhat-deploy-ethers.ts index 6f471c6bc..39b6df0fa 100644 --- a/src/hardhat-deploy-ethers.ts +++ b/src/hardhat-deploy-ethers.ts @@ -66,6 +66,8 @@ export const deployAndRegister = async ({ log: true, }) + await hre.ethers.provider.waitForTransaction(result.transactionHash) + if (result.newlyDeployed) { await registerAddress({ hre, diff --git a/yarn.lock b/yarn.lock index 60ea7f67a..a06b1dc5a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -78,7 +78,7 @@ dependencies: node-fetch "^2.6.1" -"@eth-optimism/smock@^1.0.0-alpha.3": +"@eth-optimism/smock@1.0.0-alpha.3": version "1.0.0-alpha.3" resolved "https://registry.yarnpkg.com/@eth-optimism/smock/-/smock-1.0.0-alpha.3.tgz#5f3e8f137407c4c62f06aed60bac3dc282632f89" integrity sha512-TKqbmElCWQ0qM6qj8JajqOijZVKl47L/5v2NnEWBJERKZ6zkuFxT0Y8HtUCM3r4ZEURuXFbRxRLP/ZTrOG6axg== @@ -3015,6 +3015,11 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" +directory-tree@^2.2.7: + version "2.2.7" + resolved "https://registry.yarnpkg.com/directory-tree/-/directory-tree-2.2.7.tgz#4617c794ee89d5618f03fffb7486c7e49df52ad2" + integrity sha512-fgTad/YdV6Y2njsCRK4fl4ZUlGhmb5xj1qrZUIMjvnrKvghVqh8dkB+OUssjYVvb/Q2L+5+8XG0l5uTGI9/8iQ== + dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" From 59260bf964edaf1e62d3793333b592914fc2d1c1 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 21:03:21 -0700 Subject: [PATCH 33/41] fix artifact log output format --- bin/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/deploy.js b/bin/deploy.js index d8dec63ad..50c041e12 100755 --- a/bin/deploy.js +++ b/bin/deploy.js @@ -23,7 +23,7 @@ const main = async () => { return contracts }, {}) - console.log(contracts) + console.log(JSON.stringify(contracts, null, 2)) } main() From d08136c63381719411664edda6680fa0ab181217 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 21:13:17 -0700 Subject: [PATCH 34/41] fix contract names in artifact log output --- bin/deploy.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/deploy.js b/bin/deploy.js index 50c041e12..a29140d9d 100755 --- a/bin/deploy.js +++ b/bin/deploy.js @@ -13,13 +13,19 @@ const main = async () => { }) }) + const nicknames = { + 'Lib_AddressManager': 'AddressManager', + 'mockOVM_BondManager': 'OVM_BondManager' + } + const contracts = dirtree( path.resolve(__dirname, `../deployments/custom`) ).children.filter((child) => { return child.extension === '.json' }).reduce((contracts, child) => { + const contractName = child.name.replace('.json', '') const artifact = require(path.resolve(__dirname, `../deployments/custom/${child.name}`)) - contracts[child.name.replace('.json', '')] = artifact.address + contracts[nicknames[contractName] || contractName] = artifact.address return contracts }, {}) From 3430623b9dd9bd7f70e6d38105a5876a4dc6e7c8 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 21:38:58 -0700 Subject: [PATCH 35/41] add eth gateway to deploy --- .../007-OVM_L1CrossDomainMessenger.deploy.ts | 1 + deploy/015-OVM_L1ETHGateway.deploy.ts | 56 +++++++++++++++++ deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts | 62 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 deploy/015-OVM_L1ETHGateway.deploy.ts create mode 100644 deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts diff --git a/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts b/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts index e9b26f6c8..22238db61 100644 --- a/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts @@ -53,6 +53,7 @@ const deployFn: DeployFunction = async (hre) => { ) } +deployFn.dependencies = ['Lib_AddressManager'] deployFn.tags = ['OVM_L1CrossDomainMessenger'] export default deployFn diff --git a/deploy/015-OVM_L1ETHGateway.deploy.ts b/deploy/015-OVM_L1ETHGateway.deploy.ts new file mode 100644 index 000000000..33bed13a2 --- /dev/null +++ b/deploy/015-OVM_L1ETHGateway.deploy.ts @@ -0,0 +1,56 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { predeploys } from '../src/predeploys' + +const deployFn: DeployFunction = async (hre) => { + const { deploy } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('OVM_L1ETHGateway', { + from: deployer, + args: [], + log: true, + }) + + if (!result.newlyDeployed) { + return + } + + const OVM_L1ETHGateway = await getDeployedContract(hre, 'OVM_L1ETHGateway', { + signerOrProvider: deployer, + }) + + await OVM_L1ETHGateway.initialize( + Lib_AddressManager.address, + predeploys.OVM_ETH + ) + + const libAddressManager = await OVM_L1ETHGateway.libAddressManager() + if (libAddressManager !== Lib_AddressManager.address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `OVM_L1ETHGateway could not be succesfully initialized.\n` + + `Attempted to set Lib_AddressManager to: ${Lib_AddressManager.address}\n` + + `Actual address after initialization: ${libAddressManager}\n` + + `This could indicate a compromised deployment.` + ) + } + + await Lib_AddressManager.setAddress('OVM_L1ETHGateway', result.address) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['OVM_L1ETHGateway'] + +export default deployFn diff --git a/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts b/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts new file mode 100644 index 000000000..2c57e94b4 --- /dev/null +++ b/deploy/016-Proxy__OVM_L1ETHGateway.deploy.ts @@ -0,0 +1,62 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' +import { predeploys } from '../src/predeploys' + +const deployFn: DeployFunction = async (hre) => { + const { deploy } = hre.deployments + const { deployer } = await hre.getNamedAccounts() + + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } + ) + + const result = await deploy('Proxy__OVM_L1ETHGateway', { + contract: 'Lib_ResolvedDelegateProxy', + from: deployer, + args: [Lib_AddressManager.address, 'OVM_L1ETHGateway'], + log: true, + }) + + if (!result.newlyDeployed) { + return + } + + const Proxy__OVM_L1ETHGateway = await getDeployedContract( + hre, + 'Proxy__OVM_L1ETHGateway', + { + signerOrProvider: deployer, + iface: 'OVM_L1ETHGateway', + } + ) + + await Proxy__OVM_L1ETHGateway.initialize( + Lib_AddressManager.address, + predeploys.OVM_ETH + ) + + const libAddressManager = await Proxy__OVM_L1ETHGateway.libAddressManager() + if (libAddressManager !== Lib_AddressManager.address) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `Proxy__OVM_L1ETHGateway could not be succesfully initialized.\n` + + `Attempted to set Lib_AddressManager to: ${Lib_AddressManager.address}\n` + + `Actual address after initialization: ${libAddressManager}\n` + + `This could indicate a compromised deployment.` + ) + } + + await Lib_AddressManager.setAddress('Proxy__OVM_L1ETHGateway', result.address) +} + +deployFn.dependencies = ['Lib_AddressManager', 'OVM_L1ETHGateway'] +deployFn.tags = ['Proxy__OVM_L1ETHGateway'] + +export default deployFn From 0be683207c12e0557c9861cd45ad3ee3d33af7e2 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 7 Apr 2021 22:18:12 -0700 Subject: [PATCH 36/41] add OVM_Proposer to address manager --- bin/deploy.ts | 3 +-- deploy/000-Lib_AddressManager.deploy.ts | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/deploy.ts b/bin/deploy.ts index 1fd000538..6b3e4e7f5 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -12,7 +12,6 @@ import hre from 'hardhat' const main = async () => { const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) - const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) await hre.run('deploy', { l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, @@ -26,7 +25,7 @@ const main = async () => { sccFraudProofWindow: parseInt(process.env.FRAUD_PROOF_WINDOW_SECONDS, 10), sccSequencerPublishWindow: process.env.SEQUENCER_PUBLISH_WINDOW_SECONDS, ovmSequencerAddress: sequencer.address, - ovmRelayerAddress: deployer.address, + ovmRelayerAddress: sequencer.address, }) } diff --git a/deploy/000-Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts index 963bda7f1..4dbe7e26f 100644 --- a/deploy/000-Lib_AddressManager.deploy.ts +++ b/deploy/000-Lib_AddressManager.deploy.ts @@ -33,6 +33,12 @@ const deployFn: DeployFunction = async (hre) => { address: (hre as any).deployConfig.ovmSequencerAddress, }) + await registerAddress({ + hre, + name: 'OVM_Proposer', + address: (hre as any).deployConfig.ovmSequencerAddress, + }) + await registerAddress({ hre, name: 'OVM_L2BatchMessageRelayer', From 1a280c5abe6a851de31b7021590250c534379233 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 8 Apr 2021 10:39:19 -0700 Subject: [PATCH 37/41] add some comments for clarity --- bin/deploy.js | 5 +++++ bin/deploy.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/bin/deploy.js b/bin/deploy.js index a29140d9d..26d0574a1 100755 --- a/bin/deploy.js +++ b/bin/deploy.js @@ -13,6 +13,9 @@ const main = async () => { }) }) + // Stuff below this line is currently required for CI to work properly. We probably want to + // update our CI so this is no longer necessary. But I'm adding it for backwards compat so we can + // get the hardhat-deploy stuff merged. Woot. const nicknames = { 'Lib_AddressManager': 'AddressManager', 'mockOVM_BondManager': 'OVM_BondManager' @@ -29,6 +32,8 @@ const main = async () => { return contracts }, {}) + // We *must* console.log here because CI will pipe the output of this script into an + // addresses.json file. Also something we should probably remove. console.log(JSON.stringify(contracts, null, 2)) } diff --git a/bin/deploy.ts b/bin/deploy.ts index 6b3e4e7f5..6c2299c4d 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -2,6 +2,10 @@ import { Wallet } from 'ethers' +// Ensures that all relevant environment vars are properly set. These lines *must* come before the +// hardhat import because importing will load the config (which relies on these vars). Necessary +// because CI currently uses different var names than the ones we've chosen here. +// TODO: Update CI so that we don't have to do this anymore. process.env.HARDHAT_NETWORK = 'custom' process.env.CONTRACTS_TARGET_NETWORK = 'custom' process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY From 1cfe7ee47191e37be768d01175a102c7d376cebb Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 8 Apr 2021 12:05:07 -0700 Subject: [PATCH 38/41] remove bytecode hash from compiler settings --- hardhat.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hardhat.config.ts b/hardhat.config.ts index 3509da6c6..76e1707bd 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -35,6 +35,9 @@ const config: HardhatUserConfig = { version: '0.7.6', settings: { optimizer: { enabled: true, runs: 200 }, + metadata: { + bytecodeHash: 'none', + }, outputSelection: { '*': { '*': ['storageLayout'], From 77d0e8812e3fda34ae1ae1254ac63058f37d530d Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 8 Apr 2021 14:51:12 -0700 Subject: [PATCH 39/41] minor tweaks in response to review --- .env.example | 5 ++ bin/deploy.ts | 3 +- deploy/000-Lib_AddressManager.deploy.ts | 2 +- .../007-OVM_L1CrossDomainMessenger.deploy.ts | 3 ++ deploy/015-OVM_L1ETHGateway.deploy.ts | 3 ++ hh/tasks/task-deploy.ts | 47 +++++++++---------- 6 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.env.example b/.env.example index 04fc74c78..4489118ab 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,8 @@ +# name of the network to deploy to e.g., kovan or mainnet CONTRACTS_TARGET_NETWORK= + +# private key for the account that will execute the deploy CONTRACTS_DEPLOYER_KEY= + +# rpc url for the node that will receive deploy transactions CONTRACTS_RPC_URL= diff --git a/bin/deploy.ts b/bin/deploy.ts index 6c2299c4d..76d922c22 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -6,7 +6,7 @@ import { Wallet } from 'ethers' // hardhat import because importing will load the config (which relies on these vars). Necessary // because CI currently uses different var names than the ones we've chosen here. // TODO: Update CI so that we don't have to do this anymore. -process.env.HARDHAT_NETWORK = 'custom' +process.env.HARDHAT_NETWORK = 'custom' // "custom" here is an arbitrary name. only used for CI. process.env.CONTRACTS_TARGET_NETWORK = 'custom' process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY process.env.CONTRACTS_RPC_URL = @@ -29,6 +29,7 @@ const main = async () => { sccFraudProofWindow: parseInt(process.env.FRAUD_PROOF_WINDOW_SECONDS, 10), sccSequencerPublishWindow: process.env.SEQUENCER_PUBLISH_WINDOW_SECONDS, ovmSequencerAddress: sequencer.address, + ovmProposerAddress: sequencer.address, ovmRelayerAddress: sequencer.address, }) } diff --git a/deploy/000-Lib_AddressManager.deploy.ts b/deploy/000-Lib_AddressManager.deploy.ts index 4dbe7e26f..620e9f1aa 100644 --- a/deploy/000-Lib_AddressManager.deploy.ts +++ b/deploy/000-Lib_AddressManager.deploy.ts @@ -36,7 +36,7 @@ const deployFn: DeployFunction = async (hre) => { await registerAddress({ hre, name: 'OVM_Proposer', - address: (hre as any).deployConfig.ovmSequencerAddress, + address: (hre as any).deployConfig.ovmProposerAddress, }) await registerAddress({ diff --git a/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts b/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts index 22238db61..5ab6678dc 100644 --- a/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts +++ b/deploy/007-OVM_L1CrossDomainMessenger.deploy.ts @@ -34,6 +34,9 @@ const deployFn: DeployFunction = async (hre) => { } ) + // NOTE: this initialization is *not* technically required (we only need to initialize the proxy) + // but it feels safer to initialize this anyway. Otherwise someone else could come along and + // initialize this. await OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address) const libAddressManager = await OVM_L1CrossDomainMessenger.libAddressManager() diff --git a/deploy/015-OVM_L1ETHGateway.deploy.ts b/deploy/015-OVM_L1ETHGateway.deploy.ts index 33bed13a2..85aa3cc15 100644 --- a/deploy/015-OVM_L1ETHGateway.deploy.ts +++ b/deploy/015-OVM_L1ETHGateway.deploy.ts @@ -31,6 +31,9 @@ const deployFn: DeployFunction = async (hre) => { signerOrProvider: deployer, }) + // NOTE: this initialization is *not* technically required (we only need to initialize the proxy) + // but it feels safer to initialize this anyway. Otherwise someone else could come along and + // initialize this. await OVM_L1ETHGateway.initialize( Lib_AddressManager.address, predeploys.OVM_ETH diff --git a/hh/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts index d0bbfdc2e..cdfd7a79e 100644 --- a/hh/tasks/task-deploy.ts +++ b/hh/tasks/task-deploy.ts @@ -13,8 +13,6 @@ const DEFAULT_EM_SECONDS_PER_EPOCH = 0 const DEFAULT_EM_OVM_CHAIN_ID = 420 const DEFAULT_SCC_FRAUD_PROOF_WINDOW = 60 * 60 * 24 * 7 // 7 days const DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW = 60 * 30 // 30 minutes -const DEFAULT_OVM_SEQUENCER_ADDRESS = ethers.constants.AddressZero -const DEFAULT_OVM_RELAYER_ADDRESS = ethers.constants.AddressZero task('deploy') .addOptionalParam( @@ -80,40 +78,39 @@ task('deploy') .addOptionalParam( 'ovmSequencerAddress', 'Address of the sequencer. Must be provided or this deployment will fail.', - DEFAULT_OVM_SEQUENCER_ADDRESS, + undefined, + types.string + ) + .addOptionalParam( + 'ovmProposerAddress', + 'Address of the account that will propose state roots. Must be provided or this deployment will fail.', + undefined, types.string ) .addOptionalParam( 'ovmRelayerAddress', 'Address of the message relayer. Must be provided or this deployment will fail.', - DEFAULT_OVM_RELAYER_ADDRESS, + undefined, types.string ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. - if (args.ovmSequencerAddress === DEFAULT_OVM_SEQUENCER_ADDRESS) { - throw new Error( - 'argument for --ovm-sequencer-address is required but was not provided' - ) - } - - if (!ethers.utils.isAddress(args.ovmSequencerAddress)) { - throw new Error( - `argument for --ovm-sequencer-address is not a valid address: ${args.ovmSequencerAddress}` - ) - } - - if (args.ovmRelayerAddress === DEFAULT_OVM_RELAYER_ADDRESS) { - throw new Error( - 'argument for --ovm-relayer-address is required but was not provided' - ) + const validateAddressArg = (argName: string) => { + if (args[argName] === undefined) { + throw new Error( + `argument for ${argName} is required but was not provided` + ) + } + if (!ethers.utils.isAddress(args[argName])) { + throw new Error( + `argument for ${argName} is not a valid address: ${args[argName]}` + ) + } } - if (!ethers.utils.isAddress(args.ovmRelayerAddress)) { - throw new Error( - `argument for --ovm-relayer-address is not a valid address: ${args.ovmRelayerAddress}` - ) - } + validateAddressArg('ovmSequencerAddress') + validateAddressArg('ovmProposerAddress') + validateAddressArg('ovmRelayerAddress') args.ctcForceInclusionPeriodBlocks = Math.floor( args.ctcForceInclusionPeriodSeconds / args.l1BlockTimeSeconds From c45e3d6257297e62201736d1a3e692c3bb048d54 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 8 Apr 2021 15:06:28 -0700 Subject: [PATCH 40/41] transfer address manager ownership after deploy --- bin/deploy.ts | 2 ++ deploy/017-finalize.ts | 43 +++++++++++++++++++++++++++++++++++++++++ hh/tasks/task-deploy.ts | 7 +++++++ 3 files changed, 52 insertions(+) create mode 100644 deploy/017-finalize.ts diff --git a/bin/deploy.ts b/bin/deploy.ts index 76d922c22..402ca9539 100755 --- a/bin/deploy.ts +++ b/bin/deploy.ts @@ -16,6 +16,7 @@ import hre from 'hardhat' const main = async () => { const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) + const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) await hre.run('deploy', { l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, @@ -31,6 +32,7 @@ const main = async () => { ovmSequencerAddress: sequencer.address, ovmProposerAddress: sequencer.address, ovmRelayerAddress: sequencer.address, + ovmAddressManagerOwner: deployer.address, }) } diff --git a/deploy/017-finalize.ts b/deploy/017-finalize.ts new file mode 100644 index 000000000..ccf767322 --- /dev/null +++ b/deploy/017-finalize.ts @@ -0,0 +1,43 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getDeployedContract } from '../src/hardhat-deploy-ethers' + +const deployFn: DeployFunction = async (hre) => { + const Lib_AddressManager = await getDeployedContract( + hre, + 'Lib_AddressManager' + ) + + const owner = (hre as any).deployConfig.ovmAddressManagerOwner + const remoteOwner = await Lib_AddressManager.owner() + if (remoteOwner === owner) { + console.log( + `✓ Not changing owner of Lib_AddressManager because it's already correctly set` + ) + return + } + + console.log(`Transferring ownership of Lib_AddressManager to ${owner}...`) + const tx = await Lib_AddressManager.transferOwnership(owner) + await tx.wait() + + const newRemoteOwner = await Lib_AddressManager.owner() + if (newRemoteOwner !== owner) { + throw new Error( + `\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` + + `Could not transfer ownership of Lib_AddressManager.\n` + + `Attempted to set owner of Lib_AddressManager to: ${owner}\n` + + `Actual owner after transaction: ${newRemoteOwner}\n` + + `This could indicate a compromised deployment.` + ) + } + + console.log(`✓ Set owner of Lib_AddressManager to: ${owner}`) +} + +deployFn.dependencies = ['Lib_AddressManager'] +deployFn.tags = ['finalize'] + +export default deployFn diff --git a/hh/tasks/task-deploy.ts b/hh/tasks/task-deploy.ts index cdfd7a79e..35d2e041b 100644 --- a/hh/tasks/task-deploy.ts +++ b/hh/tasks/task-deploy.ts @@ -93,6 +93,12 @@ task('deploy') undefined, types.string ) + .addOptionalParam( + 'ovmAddressManagerOwner', + 'Address that will own the Lib_AddressManager. Must be provided or this deployment will fail.', + undefined, + types.string + ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. const validateAddressArg = (argName: string) => { @@ -111,6 +117,7 @@ task('deploy') validateAddressArg('ovmSequencerAddress') validateAddressArg('ovmProposerAddress') validateAddressArg('ovmRelayerAddress') + validateAddressArg('ovmAddressManagerOwner') args.ctcForceInclusionPeriodBlocks = Math.floor( args.ctcForceInclusionPeriodSeconds / args.l1BlockTimeSeconds From bc79723f6c30b38d5447d79aea62a160c196cb81 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 8 Apr 2021 15:07:56 -0700 Subject: [PATCH 41/41] explicitly attach deployer to address manager --- deploy/017-finalize.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy/017-finalize.ts b/deploy/017-finalize.ts index ccf767322..6a47302f1 100644 --- a/deploy/017-finalize.ts +++ b/deploy/017-finalize.ts @@ -5,9 +5,13 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' import { getDeployedContract } from '../src/hardhat-deploy-ethers' const deployFn: DeployFunction = async (hre) => { + const { deployer } = await hre.getNamedAccounts() const Lib_AddressManager = await getDeployedContract( hre, - 'Lib_AddressManager' + 'Lib_AddressManager', + { + signerOrProvider: deployer, + } ) const owner = (hre as any).deployConfig.ovmAddressManagerOwner